diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5c7247b --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,7 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [] +} \ No newline at end of file diff --git a/Examples/BasicComputeExample.cs b/Examples/BasicComputeExample.cs index 875540f..086af9e 100644 --- a/Examples/BasicComputeExample.cs +++ b/Examples/BasicComputeExample.cs @@ -19,66 +19,66 @@ class BasicComputeExample : Example Window.SetTitle("BasicCompute"); - // Create the compute pipeline that writes texture data - Shader fillTextureComputeShader = new Shader( + // Create the compute pipeline that writes texture data + ComputePipeline fillTextureComputePipeline = new ComputePipeline( GraphicsDevice, TestUtils.GetShaderPath("FillTexture.comp"), "main", - ShaderStage.Compute, - ShaderFormat.SPIRV + new ComputePipelineCreateInfo + { + ShaderFormat = ShaderFormat.SPIRV, + ReadWriteStorageTextureCount = 1, + ThreadCountX = 8, + ThreadCountY = 8, + ThreadCountZ = 1 + } ); - ComputePipeline fillTextureComputePipeline = new ComputePipeline( - GraphicsDevice, - fillTextureComputeShader, - new ComputePipelineResourceInfo { ReadWriteStorageTextureCount = 1 } - ); - - fillTextureComputeShader.Dispose(); - - // Create the compute pipeline that calculates squares of numbers - Shader calculateSquaresComputeShader = new Shader( + // Create the compute pipeline that calculates squares of numbers + ComputePipeline calculateSquaresComputePipeline = new ComputePipeline( GraphicsDevice, TestUtils.GetShaderPath("CalculateSquares.comp"), "main", - ShaderStage.Compute, - ShaderFormat.SPIRV + new ComputePipelineCreateInfo + { + ShaderFormat = ShaderFormat.SPIRV, + ReadWriteStorageBufferCount = 1, + ThreadCountX = 8, + ThreadCountY = 1, + ThreadCountZ = 1 + } ); - ComputePipeline calculateSquaresComputePipeline = new ComputePipeline( - GraphicsDevice, - calculateSquaresComputeShader, - new ComputePipelineResourceInfo { ReadWriteStorageBufferCount = 1 } - ); - - calculateSquaresComputeShader.Dispose(); - // Create the graphics pipeline - Shader vertShaderModule = new Shader( + Shader vertShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("TexturedQuad.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV + } ); - Shader fragShaderModule = new Shader( + Shader fragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("TexturedQuad.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV, + SamplerCount = 1 + } ); GraphicsPipelineCreateInfo drawPipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo( Window.SwapchainFormat, - vertShaderModule, - fragShaderModule + vertShader, + fragShader ); drawPipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); - drawPipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo{ - SamplerCount = 1 - }; DrawPipeline = new GraphicsPipeline( GraphicsDevice, diff --git a/Examples/BasicStencilExample.cs b/Examples/BasicStencilExample.cs index 2b1efd3..274c962 100644 --- a/Examples/BasicStencilExample.cs +++ b/Examples/BasicStencilExample.cs @@ -24,15 +24,21 @@ namespace MoonWorksGraphicsTests GraphicsDevice, TestUtils.GetShaderPath("PositionColor.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV + } ); Shader fragShaderModule = new Shader( GraphicsDevice, TestUtils.GetShaderPath("SolidColor.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV + } ); // Create the graphics pipelines diff --git a/Examples/BasicTriangleExample.cs b/Examples/BasicTriangleExample.cs index 4516fea..52fea91 100644 --- a/Examples/BasicTriangleExample.cs +++ b/Examples/BasicTriangleExample.cs @@ -30,16 +30,22 @@ class BasicTriangleExample : Example GraphicsDevice, TestUtils.GetShaderPath("RawTriangle.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV + } ); Shader fragShaderModule = new Shader( GraphicsDevice, TestUtils.GetShaderPath("SolidColor.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV + } ); GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo( diff --git a/Examples/CompressedTexturesExample.cs b/Examples/CompressedTexturesExample.cs index 8d4891e..cf44960 100644 --- a/Examples/CompressedTexturesExample.cs +++ b/Examples/CompressedTexturesExample.cs @@ -38,16 +38,23 @@ class CompressedTexturesExample : Example GraphicsDevice, TestUtils.GetShaderPath("TexturedQuad.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV + } ); Shader fragShaderModule = new Shader( GraphicsDevice, TestUtils.GetShaderPath("TexturedQuad.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV, + SamplerCount = 1 + } ); // Create the graphics pipeline @@ -57,10 +64,7 @@ class CompressedTexturesExample : Example fragShaderModule ); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); - pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo - { - SamplerCount = 1 - }; + Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); // Create sampler diff --git a/Examples/ComputeUniformsExample.cs b/Examples/ComputeUniformsExample.cs index 41edab6..a339c17 100644 --- a/Examples/ComputeUniformsExample.cs +++ b/Examples/ComputeUniformsExample.cs @@ -21,25 +21,21 @@ class ComputeUniformsExample : Example Uniforms.Time = 0; // Create the compute pipeline that writes texture data - Shader gradientTextureComputeShader = new Shader( + GradientPipeline = new ComputePipeline( GraphicsDevice, TestUtils.GetShaderPath("GradientTexture.comp"), "main", - ShaderStage.Compute, - ShaderFormat.SPIRV - ); - - GradientPipeline = new ComputePipeline( - GraphicsDevice, - gradientTextureComputeShader, - new ComputePipelineResourceInfo { + new ComputePipelineCreateInfo + { + ShaderFormat = ShaderFormat.SPIRV, ReadWriteStorageTextureCount = 1, - UniformBufferCount = 1 + UniformBufferCount = 1, + ThreadCountX = 8, + ThreadCountY = 8, + ThreadCountZ = 1 } ); - gradientTextureComputeShader.Dispose(); - RenderTexture = Texture.CreateTexture2D( GraphicsDevice, Window.Width, diff --git a/Examples/CubeExample.cs b/Examples/CubeExample.cs index 3971f8f..12ff406 100644 --- a/Examples/CubeExample.cs +++ b/Examples/CubeExample.cs @@ -109,48 +109,71 @@ namespace MoonWorksGraphicsTests GraphicsDevice, TestUtils.GetShaderPath("PositionColorWithMatrix.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV, + UniformBufferCount = 1 + } ); Shader cubeFragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("SolidColor.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV + } ); Shader skyboxVertShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("Skybox.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV, + UniformBufferCount = 1 + } ); Shader skyboxFragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("Skybox.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV, + SamplerCount = 1 + } ); Shader blitVertShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("TexturedQuad.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV + } ); Shader blitFragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("TexturedDepthQuad.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV, + SamplerCount = 1, + UniformBufferCount = 1 + } ); DepthTexture = Texture.CreateTexture2D( @@ -209,10 +232,6 @@ namespace MoonWorksGraphicsTests RasterizerState = RasterizerState.CW_CullBack, MultisampleState = MultisampleState.None, VertexShader = cubeVertShader, - VertexShaderResourceInfo = new GraphicsPipelineResourceInfo - { - UniformBufferCount = 1 - }, FragmentShader = cubeFragShader }; CubePipeline = new GraphicsPipeline(GraphicsDevice, cubePipelineCreateInfo); @@ -237,15 +256,7 @@ namespace MoonWorksGraphicsTests RasterizerState = RasterizerState.CW_CullNone, MultisampleState = MultisampleState.None, VertexShader = skyboxVertShader, - VertexShaderResourceInfo = new GraphicsPipelineResourceInfo - { - UniformBufferCount = 1 - }, - FragmentShader = skyboxFragShader, - FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo - { - SamplerCount = 1 - } + FragmentShader = skyboxFragShader }; SkyboxPipeline = new GraphicsPipeline(GraphicsDevice, skyboxPipelineCreateInfo); @@ -260,11 +271,7 @@ namespace MoonWorksGraphicsTests blitFragShader ); blitPipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); - blitPipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo - { - SamplerCount = 1, - UniformBufferCount = 1 - }; + BlitPipeline = new GraphicsPipeline(GraphicsDevice, blitPipelineCreateInfo); } diff --git a/Examples/CullFaceExample.cs b/Examples/CullFaceExample.cs index 877e4ef..a2500d2 100644 --- a/Examples/CullFaceExample.cs +++ b/Examples/CullFaceExample.cs @@ -33,16 +33,22 @@ class CullFaceExample : Example GraphicsDevice, TestUtils.GetShaderPath("PositionColor.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV + } ); Shader fragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("SolidColor.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV + } ); // Create the graphics pipelines diff --git a/Examples/DepthMSAAExample.cs b/Examples/DepthMSAAExample.cs index 70fcb78..3b783db 100644 --- a/Examples/DepthMSAAExample.cs +++ b/Examples/DepthMSAAExample.cs @@ -43,16 +43,23 @@ class DepthMSAAExample : Example GraphicsDevice, TestUtils.GetShaderPath("PositionColorWithMatrix.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV, + UniformBufferCount = 1 + } ); Shader cubeFragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("SolidColor.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV + } ); GraphicsPipelineCreateInfo pipelineCreateInfo = new GraphicsPipelineCreateInfo @@ -70,10 +77,6 @@ class DepthMSAAExample : Example RasterizerState = RasterizerState.CW_CullBack, MultisampleState = MultisampleState.None, VertexShader = cubeVertShader, - VertexShaderResourceInfo = new GraphicsPipelineResourceInfo - { - UniformBufferCount = 1 - }, FragmentShader = cubeFragShader }; diff --git a/Examples/DrawIndirectExample.cs b/Examples/DrawIndirectExample.cs index 68f9553..284ddcd 100644 --- a/Examples/DrawIndirectExample.cs +++ b/Examples/DrawIndirectExample.cs @@ -24,16 +24,22 @@ class DrawIndirectExample : Example GraphicsDevice, TestUtils.GetShaderPath("PositionColor.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV + } ); Shader fragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("SolidColor.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV + } ); // Create the graphics pipeline diff --git a/Examples/InstancingAndOffsetsExample.cs b/Examples/InstancingAndOffsetsExample.cs index 86cab61..d075fa0 100644 --- a/Examples/InstancingAndOffsetsExample.cs +++ b/Examples/InstancingAndOffsetsExample.cs @@ -29,16 +29,22 @@ class InstancingAndOffsetsExample : Example GraphicsDevice, TestUtils.GetShaderPath("PositionColorInstanced.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV + } ); Shader fragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("SolidColor.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV + } ); // Create the graphics pipeline diff --git a/Examples/MSAACubeExample.cs b/Examples/MSAACubeExample.cs index a465d76..64bbc61 100644 --- a/Examples/MSAACubeExample.cs +++ b/Examples/MSAACubeExample.cs @@ -39,16 +39,22 @@ class MSAACubeExample : Example GraphicsDevice, TestUtils.GetShaderPath("RawTriangle.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV + } ); Shader triangleFragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("SolidColor.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV + } ); GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo( @@ -67,16 +73,24 @@ class MSAACubeExample : Example GraphicsDevice, TestUtils.GetShaderPath("Skybox.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV, + UniformBufferCount = 1 + } ); Shader cubemapFragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("Skybox.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV, + SamplerCount = 1 + } ); pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo( @@ -85,14 +99,7 @@ class MSAACubeExample : Example cubemapFragShader ); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); - pipelineCreateInfo.VertexShaderResourceInfo = new GraphicsPipelineResourceInfo - { - UniformBufferCount = 1 - }; - pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo - { - SamplerCount = 1, - }; + CubemapPipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); // Create the MSAA render targets diff --git a/Examples/MSAAExample.cs b/Examples/MSAAExample.cs index 21a8642..4fe0d44 100644 --- a/Examples/MSAAExample.cs +++ b/Examples/MSAAExample.cs @@ -30,16 +30,22 @@ class MSAAExample : Example GraphicsDevice, TestUtils.GetShaderPath("RawTriangle.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV + } ); Shader triangleFragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("SolidColor.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV + } ); GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo( diff --git a/Examples/RenderTextureCubeExample.cs b/Examples/RenderTextureCubeExample.cs index 096d339..b2fed72 100644 --- a/Examples/RenderTextureCubeExample.cs +++ b/Examples/RenderTextureCubeExample.cs @@ -41,16 +41,24 @@ class RenderTextureCubeExample : Example GraphicsDevice, TestUtils.GetShaderPath("Skybox.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV, + UniformBufferCount = 1 + } ); Shader fragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("Skybox.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV, + SamplerCount = 1 + } ); // Create the graphics pipeline @@ -60,14 +68,7 @@ class RenderTextureCubeExample : Example fragShader ); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); - pipelineCreateInfo.VertexShaderResourceInfo = new GraphicsPipelineResourceInfo - { - UniformBufferCount = 1 - }; - pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo - { - SamplerCount = 1 - }; + pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); // Create samplers diff --git a/Examples/RenderTextureMipmapsExample.cs b/Examples/RenderTextureMipmapsExample.cs index 7a07f90..6bd38d9 100644 --- a/Examples/RenderTextureMipmapsExample.cs +++ b/Examples/RenderTextureMipmapsExample.cs @@ -60,16 +60,24 @@ class RenderTextureMipmapsExample : Example GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadWithMatrix.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV, + UniformBufferCount = 1 + } ); Shader fragShaderModule = new Shader( GraphicsDevice, TestUtils.GetShaderPath("TexturedQuad.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV, + SamplerCount = 1 + } ); // Create the graphics pipeline @@ -79,14 +87,7 @@ class RenderTextureMipmapsExample : Example fragShaderModule ); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); - pipelineCreateInfo.VertexShaderResourceInfo = new GraphicsPipelineResourceInfo - { - UniformBufferCount = 1 - }; - pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo - { - SamplerCount = 1 - }; + Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); // Create samplers diff --git a/Examples/StoreLoadExample.cs b/Examples/StoreLoadExample.cs index bc30bcc..3cf1c75 100644 --- a/Examples/StoreLoadExample.cs +++ b/Examples/StoreLoadExample.cs @@ -20,16 +20,22 @@ class StoreLoadExample : Example GraphicsDevice, TestUtils.GetShaderPath("RawTriangle.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV + } ); Shader fragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("SolidColor.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV + } ); GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo( diff --git a/Examples/Texture3DCopyExample.cs b/Examples/Texture3DCopyExample.cs index 795290f..79211b1 100644 --- a/Examples/Texture3DCopyExample.cs +++ b/Examples/Texture3DCopyExample.cs @@ -44,15 +44,23 @@ class Texture3DCopyExample : Example GraphicsDevice, TestUtils.GetShaderPath("TexturedQuad.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV + } ); Shader fragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("TexturedQuad3D.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV, + SamplerCount = 1, + UniformBufferCount = 1 + } ); // Create the graphics pipeline @@ -62,11 +70,7 @@ class Texture3DCopyExample : Example fragShader ); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); - pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo - { - SamplerCount = 1, - UniformBufferCount = 1 - }; + Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); // Create samplers diff --git a/Examples/Texture3DExample.cs b/Examples/Texture3DExample.cs index 828c1e9..5dd28df 100644 --- a/Examples/Texture3DExample.cs +++ b/Examples/Texture3DExample.cs @@ -40,16 +40,24 @@ class Texture3DExample : Example GraphicsDevice, TestUtils.GetShaderPath("TexturedQuad.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV + } ); Shader fragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("TexturedQuad3D.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV, + SamplerCount = 1, + UniformBufferCount = 1 + } ); // Create the graphics pipeline @@ -59,11 +67,7 @@ class Texture3DExample : Example fragShader ); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); - pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo - { - SamplerCount = 1, - UniformBufferCount = 1 - }; + Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); // Create samplers diff --git a/Examples/TextureMipmapsExample.cs b/Examples/TextureMipmapsExample.cs index e8ad0f3..a13019c 100644 --- a/Examples/TextureMipmapsExample.cs +++ b/Examples/TextureMipmapsExample.cs @@ -30,16 +30,24 @@ class TextureMipmapsExample : Example GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadWithMatrix.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV, + UniformBufferCount = 1 + } ); Shader fragShaderModule = new Shader( GraphicsDevice, TestUtils.GetShaderPath("TexturedQuad.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV, + SamplerCount = 1 + } ); // Create the graphics pipeline @@ -49,14 +57,7 @@ class TextureMipmapsExample : Example fragShaderModule ); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); - pipelineCreateInfo.VertexShaderResourceInfo = new GraphicsPipelineResourceInfo - { - UniformBufferCount = 1 - }; - pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo - { - SamplerCount = 1 - }; + Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); Sampler = new Sampler(GraphicsDevice, SamplerCreateInfo.PointClamp); diff --git a/Examples/TexturedAnimatedQuadExample.cs b/Examples/TexturedAnimatedQuadExample.cs index d3d71c0..90bf530 100644 --- a/Examples/TexturedAnimatedQuadExample.cs +++ b/Examples/TexturedAnimatedQuadExample.cs @@ -39,16 +39,25 @@ class TexturedAnimatedQuadExample : Example GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadWithMatrix.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV, + UniformBufferCount = 1 + } ); Shader fragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadWithMultiplyColor.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV, + SamplerCount = 1, + UniformBufferCount = 1 + } ); // Create the graphics pipeline @@ -59,15 +68,7 @@ class TexturedAnimatedQuadExample : Example ); pipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions[0].BlendState = ColorAttachmentBlendState.AlphaBlend; pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); - pipelineCreateInfo.VertexShaderResourceInfo = new GraphicsPipelineResourceInfo - { - UniformBufferCount = 1 - }; - pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo - { - SamplerCount = 1, - UniformBufferCount = 1 - }; + Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); Sampler = new Sampler(GraphicsDevice, SamplerCreateInfo.PointClamp); diff --git a/Examples/TexturedQuadExample.cs b/Examples/TexturedQuadExample.cs index 134c477..10d210d 100644 --- a/Examples/TexturedQuadExample.cs +++ b/Examples/TexturedQuadExample.cs @@ -62,16 +62,23 @@ class TexturedQuadExample : Example GraphicsDevice, TestUtils.GetShaderPath("TexturedQuad.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV + } ); Shader fragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("TexturedQuad.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV, + SamplerCount = 1 + } ); // Create the graphics pipeline @@ -81,10 +88,7 @@ class TexturedQuadExample : Example fragShader ); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); - pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo - { - SamplerCount = 1 - }; + pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); // Create samplers diff --git a/Examples/TriangleVertexBufferExample.cs b/Examples/TriangleVertexBufferExample.cs index c74d479..fa46e41 100644 --- a/Examples/TriangleVertexBufferExample.cs +++ b/Examples/TriangleVertexBufferExample.cs @@ -22,15 +22,21 @@ class TriangleVertexBufferExample : Example GraphicsDevice, TestUtils.GetShaderPath("PositionColor.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV + } ); Shader fragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("SolidColor.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV + } ); // Create the graphics pipeline diff --git a/Examples/VertexSamplerExample.cs b/Examples/VertexSamplerExample.cs index c4e0748..d1af96f 100644 --- a/Examples/VertexSamplerExample.cs +++ b/Examples/VertexSamplerExample.cs @@ -21,33 +21,37 @@ class VertexSamplerExample : Example Window.SetTitle("VertexSampler"); // Load the shaders - Shader vertShaderModule = new Shader( + Shader vertShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("PositionSampler.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV, + SamplerCount = 1 + } ); - Shader fragShaderModule = new Shader( + Shader fragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("SolidColor.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV + } ); // Create the graphics pipeline GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo( Window.SwapchainFormat, - vertShaderModule, - fragShaderModule + vertShader, + fragShader ); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); - pipelineCreateInfo.VertexShaderResourceInfo = new GraphicsPipelineResourceInfo - { - SamplerCount = 1 - }; + Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); // Create and populate the GPU resources diff --git a/Examples/WindowResizingExample.cs b/Examples/WindowResizingExample.cs index 4a73080..74b94b4 100644 --- a/Examples/WindowResizingExample.cs +++ b/Examples/WindowResizingExample.cs @@ -35,16 +35,22 @@ class WindowResizingExample : Example GraphicsDevice, TestUtils.GetShaderPath("RawTriangle.vert"), "main", - ShaderStage.Vertex, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Vertex, + ShaderFormat = ShaderFormat.SPIRV + } ); Shader fragShader = new Shader( GraphicsDevice, TestUtils.GetShaderPath("SolidColor.frag"), "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV + new ShaderCreateInfo + { + ShaderStage = ShaderStage.Fragment, + ShaderFormat = ShaderFormat.SPIRV + } ); GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(