rename ResourceInitializer to ResourceUploader

refresh2
cosmonaut 2024-02-23 14:32:56 -08:00
parent 795331c133
commit cd235b9172
19 changed files with 118 additions and 121 deletions

View File

@ -83,8 +83,8 @@ namespace MoonWorks.Test
sampler = new Sampler(GraphicsDevice, new SamplerCreateInfo());
// Upload GPU resources and dispatch compute work
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
vertexBuffer = resourceInitializer.CreateBuffer(
var resourceUploader = new ResourceUploader(GraphicsDevice);
vertexBuffer = resourceUploader.CreateBuffer(
[
new PositionTextureVertex(new Vector3(-1, -1, 0), new Vector2(0, 0)),
new PositionTextureVertex(new Vector3(1, -1, 0), new Vector2(1, 0)),
@ -96,8 +96,8 @@ namespace MoonWorks.Test
BufferUsageFlags.Vertex
);
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
CommandBuffer cmdbuf = GraphicsDevice.AcquireCommandBuffer();

View File

@ -61,9 +61,9 @@ namespace MoonWorks.Test
TextureUsageFlags.DepthStencilTarget
);
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
var resourceUploader = new ResourceUploader(GraphicsDevice);
vertexBuffer = resourceInitializer.CreateBuffer(
vertexBuffer = resourceUploader.CreateBuffer(
[
new PositionColorVertex(new Vector3(-0.5f, 0.5f, 0), Color.Yellow),
new PositionColorVertex(new Vector3(0.5f, 0.5f, 0), Color.Yellow),
@ -76,8 +76,8 @@ namespace MoonWorks.Test
BufferUsageFlags.Vertex
);
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
}
protected override void Update(System.TimeSpan delta) { }

View File

@ -47,9 +47,9 @@ namespace MoonWorks.Test
textures = new Texture[textureNames.Length];
// Create and populate the GPU resources
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
var resourceUploader = new ResourceUploader(GraphicsDevice);
vertexBuffer = resourceInitializer.CreateBuffer(
vertexBuffer = resourceUploader.CreateBuffer(
[
new PositionTextureVertex(new Vector3(-1, -1, 0), new Vector2(0, 0)),
new PositionTextureVertex(new Vector3(1, -1, 0), new Vector2(1, 0)),
@ -59,7 +59,7 @@ namespace MoonWorks.Test
BufferUsageFlags.Vertex
);
indexBuffer = resourceInitializer.CreateBuffer<ushort>(
indexBuffer = resourceUploader.CreateBuffer<ushort>(
[
0, 1, 2,
0, 2, 3,
@ -70,11 +70,11 @@ namespace MoonWorks.Test
for (int i = 0; i < textureNames.Length; i += 1)
{
Logger.LogInfo(textureNames[i]);
textures[i] = resourceInitializer.CreateTextureFromDDS(TestUtils.GetTexturePath(textureNames[i] + ".dds"));
textures[i] = resourceUploader.CreateTextureFromDDS(TestUtils.GetTexturePath(textureNames[i] + ".dds"));
}
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
}
protected override void Update(System.TimeSpan delta)

View File

@ -72,9 +72,9 @@ namespace MoonWorks.Test
// Upload GPU resources and dispatch compute work
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
var resourceUploader = new ResourceUploader(GraphicsDevice);
vertexBuffer = resourceInitializer.CreateBuffer(
vertexBuffer = resourceUploader.CreateBuffer(
[
new PositionTextureVertex(new Vector3(-1, -1, 0), new Vector2(0, 0)),
new PositionTextureVertex(new Vector3(1, -1, 0), new Vector2(1, 0)),
@ -86,8 +86,8 @@ namespace MoonWorks.Test
BufferUsageFlags.Vertex
);
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
CommandBuffer cmdbuf = GraphicsDevice.AcquireCommandBuffer();
GradientTextureComputeUniforms gradientUniforms = new GradientTextureComputeUniforms(

View File

@ -35,9 +35,9 @@ namespace MoonWorks.Test
sampler = new Sampler(GraphicsDevice, SamplerCreateInfo.PointClamp);
// Create and populate the GPU resources
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
var resourceUploader = new ResourceUploader(GraphicsDevice);
vertexBuffer = resourceInitializer.CreateBuffer(
vertexBuffer = resourceUploader.CreateBuffer(
[
new PositionTextureVertex(new Vector3(-1f, 0f, 0), new Vector2(0, 0)),
new PositionTextureVertex(new Vector3( 0f, 0f, 0), new Vector2(1, 0)),
@ -57,7 +57,7 @@ namespace MoonWorks.Test
BufferUsageFlags.Vertex
);
indexBuffer = resourceInitializer.CreateBuffer<ushort>(
indexBuffer = resourceUploader.CreateBuffer<ushort>(
[
0, 1, 2,
0, 2, 3,
@ -65,12 +65,12 @@ namespace MoonWorks.Test
BufferUsageFlags.Index
);
originalTexture = resourceInitializer.CreateTexture2D(
originalTexture = resourceUploader.CreateTexture2D(
TestUtils.GetTexturePath("ravioli.png")
);
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
// Load the texture bytes so we can compare them.
var pixels = ImageUtils.GetPixelDataFromFile(

View File

@ -55,7 +55,7 @@ namespace MoonWorks.Test
// Upload cubemap layers one at a time to minimize transfer size
unsafe void LoadCubemap(string[] imagePaths)
{
var cubemapUploader = new ResourceInitializer(GraphicsDevice);
var cubemapUploader = new ResourceUploader(GraphicsDevice);
for (uint i = 0; i < imagePaths.Length; i++)
{
@ -304,15 +304,15 @@ namespace MoonWorks.Test
new PositionTextureVertex(new Vector3(-1, 1, 0), new Vector2(0, 1)),
]);
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
var resourceUploader = new ResourceUploader(GraphicsDevice);
cubeVertexBuffer = resourceInitializer.CreateBuffer(cubeVertexData, BufferUsageFlags.Vertex);
skyboxVertexBuffer = resourceInitializer.CreateBuffer(skyboxVertexData, BufferUsageFlags.Vertex);
indexBuffer = resourceInitializer.CreateBuffer(indexData, BufferUsageFlags.Index);
blitVertexBuffer = resourceInitializer.CreateBuffer(blitVertexData, BufferUsageFlags.Vertex);
cubeVertexBuffer = resourceUploader.CreateBuffer(cubeVertexData, BufferUsageFlags.Vertex);
skyboxVertexBuffer = resourceUploader.CreateBuffer(skyboxVertexData, BufferUsageFlags.Vertex);
indexBuffer = resourceUploader.CreateBuffer(indexData, BufferUsageFlags.Index);
blitVertexBuffer = resourceUploader.CreateBuffer(blitVertexData, BufferUsageFlags.Vertex);
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
LoadCubemap(new string[]
{

View File

@ -52,9 +52,9 @@ namespace MoonWorks.Test
CCW_CullBackPipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
// Create and populate the vertex buffers
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
var resourceUploader = new ResourceUploader(GraphicsDevice);
cwVertexBuffer = resourceInitializer.CreateBuffer(
cwVertexBuffer = resourceUploader.CreateBuffer(
[
new PositionColorVertex(new Vector3(0, -1, 0), Color.Blue),
new PositionColorVertex(new Vector3(1, 1, 0), Color.Green),
@ -63,7 +63,7 @@ namespace MoonWorks.Test
BufferUsageFlags.Vertex
);
ccwVertexBuffer = resourceInitializer.CreateBuffer(
ccwVertexBuffer = resourceUploader.CreateBuffer(
[
new PositionColorVertex(new Vector3(-1, 1, 0), Color.Red),
new PositionColorVertex(new Vector3(1, 1, 0), Color.Green),
@ -72,8 +72,8 @@ namespace MoonWorks.Test
BufferUsageFlags.Vertex
);
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
}
protected override void Update(System.TimeSpan delta)

View File

@ -105,9 +105,9 @@ namespace MoonWorks.Test
rtSampler = new Sampler(GraphicsDevice, SamplerCreateInfo.PointClamp);
// Create the buffers
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
var resourceUploader = new ResourceUploader(GraphicsDevice);
quadVertexBuffer = resourceInitializer.CreateBuffer(
quadVertexBuffer = resourceUploader.CreateBuffer(
[
new PositionTextureVertex(new Vector3(-1, -1, 0), new Vector2(0, 0)),
new PositionTextureVertex(new Vector3(1, -1, 0), new Vector2(1, 0)),
@ -117,7 +117,7 @@ namespace MoonWorks.Test
BufferUsageFlags.Vertex
);
quadIndexBuffer = resourceInitializer.CreateBuffer<ushort>(
quadIndexBuffer = resourceUploader.CreateBuffer<ushort>(
[
0, 1, 2,
0, 2, 3,
@ -158,7 +158,7 @@ namespace MoonWorks.Test
new PositionColorVertex(new Vector3(1, 1, -1), new Color(0f, 0.5f, 0f))
]);
cubeVertexBuffer1 = resourceInitializer.CreateBuffer(
cubeVertexBuffer1 = resourceUploader.CreateBuffer(
cubeVertexData,
BufferUsageFlags.Vertex
);
@ -169,12 +169,12 @@ namespace MoonWorks.Test
cubeVertexData[i].Position.Z += 3;
}
cubeVertexBuffer2 = resourceInitializer.CreateBuffer(
cubeVertexBuffer2 = resourceUploader.CreateBuffer(
cubeVertexData,
BufferUsageFlags.Vertex
);
cubeIndexBuffer = resourceInitializer.CreateBuffer<uint>(
cubeIndexBuffer = resourceUploader.CreateBuffer<uint>(
[
0, 1, 2, 0, 2, 3,
6, 5, 4, 7, 6, 4,
@ -186,8 +186,8 @@ namespace MoonWorks.Test
BufferUsageFlags.Index
);
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
}
protected override void Update(System.TimeSpan delta)

View File

@ -26,9 +26,9 @@ namespace MoonWorks.Test
graphicsPipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
// Create and populate the vertex buffer
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
var resourceUploader = new ResourceUploader(GraphicsDevice);
vertexBuffer = resourceInitializer.CreateBuffer(
vertexBuffer = resourceUploader.CreateBuffer(
[
new PositionColorVertex(new Vector3(-0.5f, -1, 0), Color.Blue),
new PositionColorVertex(new Vector3(-1f, 1, 0), Color.Green),
@ -41,7 +41,7 @@ namespace MoonWorks.Test
BufferUsageFlags.Vertex
);
drawBuffer = resourceInitializer.CreateBuffer(
drawBuffer = resourceUploader.CreateBuffer(
[
new IndirectDrawCommand(3, 1, 3, 0),
new IndirectDrawCommand(3, 1, 0, 0),
@ -49,8 +49,8 @@ namespace MoonWorks.Test
BufferUsageFlags.Indirect
);
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
}
protected override void Update(System.TimeSpan delta) { }

View File

@ -29,12 +29,12 @@ namespace MoonWorks.Test
int vertexSize = Marshal.SizeOf<PositionVertex>();
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
var resourceUploader = new ResourceUploader(GraphicsDevice);
var vertexBuffer = resourceInitializer.CreateBuffer(vertices, BufferUsageFlags.Vertex);
var vertexBuffer = resourceUploader.CreateBuffer(vertices, BufferUsageFlags.Vertex);
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
var transferBuffer = new TransferBuffer(GraphicsDevice, vertexBuffer.Size);

View File

@ -31,9 +31,9 @@ namespace MoonWorks.Test
pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
// Create and populate the vertex and index buffers
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
var resourceUploader = new ResourceUploader(GraphicsDevice);
vertexBuffer = resourceInitializer.CreateBuffer(
vertexBuffer = resourceUploader.CreateBuffer(
[
new PositionColorVertex(new Vector3(-1, 1, 0), Color.Red),
new PositionColorVertex(new Vector3(1, 1, 0), Color.Lime),
@ -50,7 +50,7 @@ namespace MoonWorks.Test
BufferUsageFlags.Vertex
);
indexBuffer = resourceInitializer.CreateBuffer<ushort>(
indexBuffer = resourceUploader.CreateBuffer<ushort>(
[
0, 1, 2,
3, 4, 5,
@ -58,8 +58,8 @@ namespace MoonWorks.Test
BufferUsageFlags.Index
);
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
}
protected override void Update(System.TimeSpan delta)

View File

@ -67,9 +67,9 @@ namespace MoonWorks.Test
rtSampler = new Sampler(GraphicsDevice, SamplerCreateInfo.PointClamp);
// Create and populate the vertex and index buffers
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
var resourceUploader = new ResourceUploader(GraphicsDevice);
quadVertexBuffer = resourceInitializer.CreateBuffer(
quadVertexBuffer = resourceUploader.CreateBuffer(
[
new PositionTextureVertex(new Vector3(-1, -1, 0), new Vector2(0, 0)),
new PositionTextureVertex(new Vector3(1, -1, 0), new Vector2(1, 0)),
@ -79,7 +79,7 @@ namespace MoonWorks.Test
BufferUsageFlags.Vertex
);
quadIndexBuffer = resourceInitializer.CreateBuffer<ushort>(
quadIndexBuffer = resourceUploader.CreateBuffer<ushort>(
[
0, 1, 2,
0, 2, 3
@ -87,8 +87,8 @@ namespace MoonWorks.Test
BufferUsageFlags.Index
);
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
}
protected override void Update(System.TimeSpan delta)

View File

@ -12,8 +12,8 @@ namespace MoonWorks.Test
private GraphicsPipeline cubemapPipeline;
private Texture[] renderTargets = new Texture[4];
private Buffer vertexBuffer;
private Buffer indexBuffer;
private GpuBuffer vertexBuffer;
private GpuBuffer indexBuffer;
private Sampler sampler;
private Vector3 camPos = new Vector3(0, 0, 4f);
@ -76,14 +76,10 @@ namespace MoonWorks.Test
sampler = new Sampler(GraphicsDevice, SamplerCreateInfo.PointClamp);
// Create and populate the GPU resources
vertexBuffer = Buffer.Create<PositionVertex>(GraphicsDevice, BufferUsageFlags.Vertex, 24);
indexBuffer = Buffer.Create<ushort>(GraphicsDevice, BufferUsageFlags.Index, 36);
var resourceUploader = new ResourceUploader(GraphicsDevice);
CommandBuffer cmdbuf = GraphicsDevice.AcquireCommandBuffer();
cmdbuf.SetBufferData(
vertexBuffer,
new PositionVertex[]
{
vertexBuffer = resourceUploader.CreateBuffer(
[
new PositionVertex(new Vector3(-10, -10, -10)),
new PositionVertex(new Vector3(10, -10, -10)),
new PositionVertex(new Vector3(10, 10, -10)),
@ -113,23 +109,24 @@ namespace MoonWorks.Test
new PositionVertex(new Vector3(-10, 10, 10)),
new PositionVertex(new Vector3(10, 10, 10)),
new PositionVertex(new Vector3(10, 10, -10))
}
],
BufferUsageFlags.Vertex
);
cmdbuf.SetBufferData(
indexBuffer,
new ushort[]
{
0, 1, 2, 0, 2, 3,
6, 5, 4, 7, 6, 4,
8, 9, 10, 8, 10, 11,
indexBuffer = resourceUploader.CreateBuffer<ushort>(
[
0, 1, 2, 0, 2, 3,
6, 5, 4, 7, 6, 4,
8, 9, 10, 8, 10, 11,
14, 13, 12, 15, 14, 12,
16, 17, 18, 16, 18, 19,
22, 21, 20, 23, 22, 20
}
],
BufferUsageFlags.Index
);
GraphicsDevice.Submit(cmdbuf);
resourceUploader.Upload();
resourceUploader.Dispose();
}
protected override void Update(System.TimeSpan delta)
@ -198,7 +195,7 @@ namespace MoonWorks.Test
cmdbuf.BeginRenderPass(rtAttachmentInfo);
cmdbuf.BindGraphicsPipeline(msaaPipelines[rtIndex]);
cmdbuf.DrawPrimitives(0, 1, 0, 0);
cmdbuf.DrawPrimitives(0, 1);
cmdbuf.EndRenderPass();
}
@ -207,8 +204,8 @@ namespace MoonWorks.Test
cmdbuf.BindVertexBuffers(vertexBuffer);
cmdbuf.BindIndexBuffer(indexBuffer, IndexElementSize.Sixteen);
cmdbuf.BindFragmentSamplers(new TextureSamplerBinding(rt, sampler));
uint vertexUniformOffset = cmdbuf.PushVertexShaderUniforms(vertUniforms);
cmdbuf.DrawIndexedPrimitives(0, 0, 12, vertexUniformOffset, 0);
cmdbuf.PushVertexShaderUniforms(vertUniforms);
cmdbuf.DrawIndexedPrimitives(0, 0, 12);
cmdbuf.EndRenderPass();
}
GraphicsDevice.Submit(cmdbuf);

View File

@ -34,9 +34,9 @@ namespace MoonWorks.Test
sampler = new Sampler(GraphicsDevice, samplerCreateInfo);
// Create and populate the GPU resources
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
var resourceUploader = new ResourceUploader(GraphicsDevice);
vertexBuffer = resourceInitializer.CreateBuffer(
vertexBuffer = resourceUploader.CreateBuffer(
[
new PositionTextureVertex(new Vector3(-1, -1, 0), new Vector2(0, 0)),
new PositionTextureVertex(new Vector3(0, -1, 0), new Vector2(1, 0)),
@ -61,7 +61,7 @@ namespace MoonWorks.Test
BufferUsageFlags.Vertex
);
indexBuffer = resourceInitializer.CreateBuffer<ushort>(
indexBuffer = resourceUploader.CreateBuffer<ushort>(
[
0, 1, 2,
0, 2, 3,
@ -69,8 +69,8 @@ namespace MoonWorks.Test
BufferUsageFlags.Index
);
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
for (int i = 0; i < textures.Length; i += 1)
{

View File

@ -49,9 +49,9 @@ namespace MoonWorks.Test
sampler = new Sampler(GraphicsDevice, SamplerCreateInfo.LinearWrap);
// Create and populate the GPU resources
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
var resourceUploader = new ResourceUploader(GraphicsDevice);
vertexBuffer = resourceInitializer.CreateBuffer(
vertexBuffer = resourceUploader.CreateBuffer(
[
new PositionTextureVertex(new Vector3(-1, -1, 0), new Vector2(0, 0)),
new PositionTextureVertex(new Vector3(1, -1, 0), new Vector2(1, 0)),
@ -61,7 +61,7 @@ namespace MoonWorks.Test
BufferUsageFlags.Vertex
);
indexBuffer = resourceInitializer.CreateBuffer<ushort>(
indexBuffer = resourceUploader.CreateBuffer<ushort>(
[
0, 1, 2,
0, 2, 3,
@ -69,8 +69,8 @@ namespace MoonWorks.Test
BufferUsageFlags.Index
);
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
rt = Texture.CreateTexture3D(
GraphicsDevice,

View File

@ -48,9 +48,9 @@ namespace MoonWorks.Test
sampler = new Sampler(GraphicsDevice, SamplerCreateInfo.PointClamp);
// Create and populate the GPU resources
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
var resourceUploader = new ResourceUploader(GraphicsDevice);
vertexBuffer = resourceInitializer.CreateBuffer(
vertexBuffer = resourceUploader.CreateBuffer(
[
new PositionVertex(new Vector3(-10, -10, -10)),
new PositionVertex(new Vector3(10, -10, -10)),
@ -85,7 +85,7 @@ namespace MoonWorks.Test
BufferUsageFlags.Vertex
);
indexBuffer = resourceInitializer.CreateBuffer<ushort>(
indexBuffer = resourceUploader.CreateBuffer<ushort>(
[
0, 1, 2, 0, 2, 3,
6, 5, 4, 7, 6, 4,
@ -97,8 +97,8 @@ namespace MoonWorks.Test
BufferUsageFlags.Index
);
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
cubemap = Texture.CreateTextureCube(
GraphicsDevice,

View File

@ -82,9 +82,9 @@ namespace MoonWorks.Test
samplers[4] = new Sampler(GraphicsDevice, samplerCreateInfo);
// Create and populate the GPU resources
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
var resourceUploader = new ResourceUploader(GraphicsDevice);
vertexBuffer = resourceInitializer.CreateBuffer(
vertexBuffer = resourceUploader.CreateBuffer(
[
new PositionTextureVertex(new Vector3(-1, -1, 0), new Vector2(0, 0)),
new PositionTextureVertex(new Vector3(1, -1, 0), new Vector2(1, 0)),
@ -94,7 +94,7 @@ namespace MoonWorks.Test
BufferUsageFlags.Vertex
);
indexBuffer = resourceInitializer.CreateBuffer<ushort>(
indexBuffer = resourceUploader.CreateBuffer<ushort>(
[
0, 1, 2,
0, 2, 3,
@ -102,8 +102,8 @@ namespace MoonWorks.Test
BufferUsageFlags.Index
);
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
texture = Texture.CreateTexture2D(
GraphicsDevice,

View File

@ -45,9 +45,9 @@ namespace MoonWorks.Test
sampler = new Sampler(GraphicsDevice, SamplerCreateInfo.PointClamp);
// Create and populate the GPU resources
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
var resourceUploader = new ResourceUploader(GraphicsDevice);
vertexBuffer = resourceInitializer.CreateBuffer(
vertexBuffer = resourceUploader.CreateBuffer(
[
new PositionTextureVertex(new Vector3(-1, -1, 0), new Vector2(0, 0)),
new PositionTextureVertex(new Vector3(1, -1, 0), new Vector2(1, 0)),
@ -57,7 +57,7 @@ namespace MoonWorks.Test
BufferUsageFlags.Vertex
);
indexBuffer = resourceInitializer.CreateBuffer<ushort>(
indexBuffer = resourceUploader.CreateBuffer<ushort>(
[
0, 1, 2,
0, 2, 3,
@ -84,14 +84,14 @@ namespace MoonWorks.Test
Depth = 1
};
resourceInitializer.SetTextureDataFromCompressed(
resourceUploader.SetTextureDataFromCompressed(
slice,
TestUtils.GetTexturePath($"tex3d_{i}.png")
);
}
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
}
protected override void Update(System.TimeSpan delta)

View File

@ -85,18 +85,18 @@ namespace MoonWorks.Test
// Create and populate the GPU resources
var resourceInitializer = new ResourceInitializer(GraphicsDevice);
var resourceUploader = new ResourceUploader(GraphicsDevice);
vertexBuffer = resourceInitializer.CreateBuffer(vertexData, BufferUsageFlags.Vertex);
indexBuffer = resourceInitializer.CreateBuffer(indexData, BufferUsageFlags.Index);
vertexBuffer = resourceUploader.CreateBuffer(vertexData, BufferUsageFlags.Vertex);
indexBuffer = resourceUploader.CreateBuffer(indexData, BufferUsageFlags.Index);
textures[0] = resourceInitializer.CreateTexture2D(TestUtils.GetTexturePath("ravioli.png"));
textures[1] = resourceInitializer.CreateTexture2D(pngBytes);
textures[2] = resourceInitializer.CreateTexture2D(TestUtils.GetTexturePath("ravioli.qoi"));
textures[3] = resourceInitializer.CreateTexture2D(qoiBytes);
textures[0] = resourceUploader.CreateTexture2D(TestUtils.GetTexturePath("ravioli.png"));
textures[1] = resourceUploader.CreateTexture2D(pngBytes);
textures[2] = resourceUploader.CreateTexture2D(TestUtils.GetTexturePath("ravioli.qoi"));
textures[3] = resourceUploader.CreateTexture2D(qoiBytes);
resourceInitializer.Upload();
resourceInitializer.Dispose();
resourceUploader.Upload();
resourceUploader.Dispose();
}
protected override void Update(System.TimeSpan delta)