From cd235b9172e2014c491aeac31839d09c544dcd30 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Fri, 23 Feb 2024 14:32:56 -0800 Subject: [PATCH] rename ResourceInitializer to ResourceUploader --- BasicCompute/BasicComputeGame.cs | 8 ++-- BasicStencil/BasicStencilGame.cs | 8 ++-- CompressedTextures/CompressedTexturesGame.cs | 12 +++--- ComputeUniforms/ComputeUniformsGame.cs | 8 ++-- CopyTexture/CopyTextureGame.cs | 12 +++--- Cube/CubeGame.cs | 16 ++++---- CullFace/CullFaceGame.cs | 10 ++--- DepthMSAA/DepthMSAAGame.cs | 16 ++++---- DrawIndirect/DrawIndirectGame.cs | 10 ++--- GetBufferData/GetBufferDataGame.cs | 8 ++-- .../InstancingAndOffsetsGame.cs | 10 ++--- MSAA/MSAAGame.cs | 10 ++--- MSAACube/MSAACubeGame.cs | 41 +++++++++---------- RenderTexture2D/RenderTexture2DGame.cs | 10 ++--- RenderTexture3D/RenderTexture3DGame.cs | 10 ++--- RenderTextureCube/RenderTextureCubeGame.cs | 10 ++--- .../RenderTextureMipmapsGame.cs | 10 ++--- Texture3D/Texture3DGame.cs | 12 +++--- TexturedQuad/TexturedQuadGame.cs | 18 ++++---- 19 files changed, 118 insertions(+), 121 deletions(-) diff --git a/BasicCompute/BasicComputeGame.cs b/BasicCompute/BasicComputeGame.cs index 3f30641..123b8cd 100644 --- a/BasicCompute/BasicComputeGame.cs +++ b/BasicCompute/BasicComputeGame.cs @@ -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(); diff --git a/BasicStencil/BasicStencilGame.cs b/BasicStencil/BasicStencilGame.cs index b775bd8..3a195b3 100644 --- a/BasicStencil/BasicStencilGame.cs +++ b/BasicStencil/BasicStencilGame.cs @@ -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) { } diff --git a/CompressedTextures/CompressedTexturesGame.cs b/CompressedTextures/CompressedTexturesGame.cs index c7a730c..fdc83a0 100644 --- a/CompressedTextures/CompressedTexturesGame.cs +++ b/CompressedTextures/CompressedTexturesGame.cs @@ -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( + indexBuffer = resourceUploader.CreateBuffer( [ 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) diff --git a/ComputeUniforms/ComputeUniformsGame.cs b/ComputeUniforms/ComputeUniformsGame.cs index 25db3da..07de4b7 100644 --- a/ComputeUniforms/ComputeUniformsGame.cs +++ b/ComputeUniforms/ComputeUniformsGame.cs @@ -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( diff --git a/CopyTexture/CopyTextureGame.cs b/CopyTexture/CopyTextureGame.cs index 1724f90..8342502 100644 --- a/CopyTexture/CopyTextureGame.cs +++ b/CopyTexture/CopyTextureGame.cs @@ -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( + indexBuffer = resourceUploader.CreateBuffer( [ 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( diff --git a/Cube/CubeGame.cs b/Cube/CubeGame.cs index 96045e5..70e71ac 100644 --- a/Cube/CubeGame.cs +++ b/Cube/CubeGame.cs @@ -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[] { diff --git a/CullFace/CullFaceGame.cs b/CullFace/CullFaceGame.cs index 09d1852..2cdd896 100644 --- a/CullFace/CullFaceGame.cs +++ b/CullFace/CullFaceGame.cs @@ -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) diff --git a/DepthMSAA/DepthMSAAGame.cs b/DepthMSAA/DepthMSAAGame.cs index 290eab4..3b3a284 100644 --- a/DepthMSAA/DepthMSAAGame.cs +++ b/DepthMSAA/DepthMSAAGame.cs @@ -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( + quadIndexBuffer = resourceUploader.CreateBuffer( [ 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( + cubeIndexBuffer = resourceUploader.CreateBuffer( [ 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) diff --git a/DrawIndirect/DrawIndirectGame.cs b/DrawIndirect/DrawIndirectGame.cs index 11a7627..be2c00b 100644 --- a/DrawIndirect/DrawIndirectGame.cs +++ b/DrawIndirect/DrawIndirectGame.cs @@ -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) { } diff --git a/GetBufferData/GetBufferDataGame.cs b/GetBufferData/GetBufferDataGame.cs index 4d95af7..46b1d89 100644 --- a/GetBufferData/GetBufferDataGame.cs +++ b/GetBufferData/GetBufferDataGame.cs @@ -29,12 +29,12 @@ namespace MoonWorks.Test int vertexSize = Marshal.SizeOf(); - 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); diff --git a/InstancingAndOffsets/InstancingAndOffsetsGame.cs b/InstancingAndOffsets/InstancingAndOffsetsGame.cs index 2ab062e..b4a798f 100644 --- a/InstancingAndOffsets/InstancingAndOffsetsGame.cs +++ b/InstancingAndOffsets/InstancingAndOffsetsGame.cs @@ -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( + indexBuffer = resourceUploader.CreateBuffer( [ 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) diff --git a/MSAA/MSAAGame.cs b/MSAA/MSAAGame.cs index 0f2ec32..f649ffd 100644 --- a/MSAA/MSAAGame.cs +++ b/MSAA/MSAAGame.cs @@ -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( + quadIndexBuffer = resourceUploader.CreateBuffer( [ 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) diff --git a/MSAACube/MSAACubeGame.cs b/MSAACube/MSAACubeGame.cs index ec51e88..f233ebd 100644 --- a/MSAACube/MSAACubeGame.cs +++ b/MSAACube/MSAACubeGame.cs @@ -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(GraphicsDevice, BufferUsageFlags.Vertex, 24); - indexBuffer = Buffer.Create(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( + [ + 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); diff --git a/RenderTexture2D/RenderTexture2DGame.cs b/RenderTexture2D/RenderTexture2DGame.cs index 6100b6d..2c7b526 100644 --- a/RenderTexture2D/RenderTexture2DGame.cs +++ b/RenderTexture2D/RenderTexture2DGame.cs @@ -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( + indexBuffer = resourceUploader.CreateBuffer( [ 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) { diff --git a/RenderTexture3D/RenderTexture3DGame.cs b/RenderTexture3D/RenderTexture3DGame.cs index a98b7d1..654e435 100644 --- a/RenderTexture3D/RenderTexture3DGame.cs +++ b/RenderTexture3D/RenderTexture3DGame.cs @@ -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( + indexBuffer = resourceUploader.CreateBuffer( [ 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, diff --git a/RenderTextureCube/RenderTextureCubeGame.cs b/RenderTextureCube/RenderTextureCubeGame.cs index aa207f8..7be5e5f 100644 --- a/RenderTextureCube/RenderTextureCubeGame.cs +++ b/RenderTextureCube/RenderTextureCubeGame.cs @@ -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( + indexBuffer = resourceUploader.CreateBuffer( [ 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, diff --git a/RenderTextureMipmaps/RenderTextureMipmapsGame.cs b/RenderTextureMipmaps/RenderTextureMipmapsGame.cs index 6fc9fdd..0674d1d 100644 --- a/RenderTextureMipmaps/RenderTextureMipmapsGame.cs +++ b/RenderTextureMipmaps/RenderTextureMipmapsGame.cs @@ -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( + indexBuffer = resourceUploader.CreateBuffer( [ 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, diff --git a/Texture3D/Texture3DGame.cs b/Texture3D/Texture3DGame.cs index 5c9a4d1..4cd7ee5 100644 --- a/Texture3D/Texture3DGame.cs +++ b/Texture3D/Texture3DGame.cs @@ -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( + indexBuffer = resourceUploader.CreateBuffer( [ 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) diff --git a/TexturedQuad/TexturedQuadGame.cs b/TexturedQuad/TexturedQuadGame.cs index 771ff38..080bc50 100644 --- a/TexturedQuad/TexturedQuadGame.cs +++ b/TexturedQuad/TexturedQuadGame.cs @@ -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)