convert Cube test to use UploadAndWait
parent
1876258114
commit
795331c133
|
@ -52,15 +52,13 @@ namespace MoonWorks.Test
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Upload cubemap layers one at a time to minimize transfer size
|
||||||
unsafe void LoadCubemap(string[] imagePaths)
|
unsafe void LoadCubemap(string[] imagePaths)
|
||||||
{
|
{
|
||||||
var cubemapTransferBuffer = new TransferBuffer(GraphicsDevice, skyboxTexture.Width * skyboxTexture.Height * 4);
|
var cubemapUploader = new ResourceInitializer(GraphicsDevice);
|
||||||
|
|
||||||
/* Upload cubemap layers one at a time to minimize transfer size */
|
|
||||||
for (uint i = 0; i < imagePaths.Length; i++)
|
for (uint i = 0; i < imagePaths.Length; i++)
|
||||||
{
|
{
|
||||||
var commandBuffer = GraphicsDevice.AcquireCommandBuffer();
|
|
||||||
|
|
||||||
var textureSlice = new TextureSlice
|
var textureSlice = new TextureSlice
|
||||||
{
|
{
|
||||||
Texture = skyboxTexture,
|
Texture = skyboxTexture,
|
||||||
|
@ -75,18 +73,15 @@ namespace MoonWorks.Test
|
||||||
Depth = 1
|
Depth = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
ImageUtils.DecodeIntoTransferBuffer(imagePaths[i], cubemapTransferBuffer, 0, SetDataOptions.Overwrite);
|
cubemapUploader.SetTextureDataFromCompressed(
|
||||||
|
textureSlice,
|
||||||
|
imagePaths[i]
|
||||||
|
);
|
||||||
|
|
||||||
commandBuffer.BeginCopyPass();
|
cubemapUploader.UploadAndWait();
|
||||||
commandBuffer.UploadToTexture(cubemapTransferBuffer, textureSlice, new BufferImageCopy(0, 0, 0));
|
|
||||||
commandBuffer.EndCopyPass();
|
|
||||||
|
|
||||||
var fence = GraphicsDevice.SubmitAndAcquireFence(commandBuffer);
|
|
||||||
GraphicsDevice.WaitForFences(fence);
|
|
||||||
GraphicsDevice.ReleaseFence(fence);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cubemapTransferBuffer.Dispose();
|
cubemapUploader.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CubeGame() : base(TestUtils.GetStandardWindowCreateInfo(), TestUtils.GetStandardFrameLimiterSettings(), 60, true)
|
public CubeGame() : base(TestUtils.GetStandardWindowCreateInfo(), TestUtils.GetStandardFrameLimiterSettings(), 60, true)
|
||||||
|
|
Loading…
Reference in New Issue