diff --git a/BasicCompute/BasicComputeGame.cs b/BasicCompute/BasicComputeGame.cs index 7d4d3c5..83d2791 100644 --- a/BasicCompute/BasicComputeGame.cs +++ b/BasicCompute/BasicComputeGame.cs @@ -51,11 +51,7 @@ namespace MoonWorks.Test vertShaderModule, fragShaderModule ); - drawPipelineCreateInfo.VertexInputState = new VertexInputState( - VertexBinding.Create(), - VertexAttribute.Create("Position", 0), - VertexAttribute.Create("TexCoord", 1) - ); + drawPipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); drawPipelineCreateInfo.FragmentShaderInfo.SamplerBindingCount = 1; drawPipeline = new GraphicsPipeline( diff --git a/ComputeUniforms/ComputeUniformsGame.cs b/ComputeUniforms/ComputeUniformsGame.cs index 87ecbae..70d66d1 100644 --- a/ComputeUniforms/ComputeUniformsGame.cs +++ b/ComputeUniforms/ComputeUniformsGame.cs @@ -52,11 +52,7 @@ namespace MoonWorks.Test vertShaderModule, fragShaderModule ); - drawPipelineCreateInfo.VertexInputState = new VertexInputState( - VertexBinding.Create(), - VertexAttribute.Create("Position", 0), - VertexAttribute.Create("TexCoord", 1) - ); + drawPipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); drawPipelineCreateInfo.FragmentShaderInfo.SamplerBindingCount = 1; drawPipeline = new GraphicsPipeline( diff --git a/Cube/CubeGame.cs b/Cube/CubeGame.cs index e973cc4..cf1c3b5 100644 --- a/Cube/CubeGame.cs +++ b/Cube/CubeGame.cs @@ -165,11 +165,7 @@ namespace MoonWorks.Test ), DepthStencilState = DepthStencilState.DepthReadWrite, VertexShaderInfo = GraphicsShaderInfo.Create(cubeVertShaderModule, "main", 0), - VertexInputState = new VertexInputState( - VertexBinding.Create(), - VertexAttribute.Create("Position", 0), - VertexAttribute.Create("Color", 1) - ), + VertexInputState = VertexInputState.CreateSingleBinding(), PrimitiveType = PrimitiveType.TriangleList, FragmentShaderInfo = GraphicsShaderInfo.Create(cubeFragShaderModule, "main", 0), RasterizerState = RasterizerState.CW_CullBack, @@ -193,10 +189,7 @@ namespace MoonWorks.Test ), DepthStencilState = DepthStencilState.DepthReadWrite, VertexShaderInfo = GraphicsShaderInfo.Create(skyboxVertShaderModule, "main", 0), - VertexInputState = new VertexInputState( - VertexBinding.Create(), - VertexAttribute.Create("Position", 0) - ), + VertexInputState = VertexInputState.CreateSingleBinding(), PrimitiveType = PrimitiveType.TriangleList, FragmentShaderInfo = GraphicsShaderInfo.Create(skyboxFragShaderModule, "main", 1), RasterizerState = RasterizerState.CW_CullNone, @@ -214,11 +207,7 @@ namespace MoonWorks.Test blitVertShaderModule, blitFragShaderModule ); - blitPipelineCreateInfo.VertexInputState = new VertexInputState( - VertexBinding.Create(), - VertexAttribute.Create("Position", 0), - VertexAttribute.Create("TexCoord", 1) - ); + blitPipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); blitPipelineCreateInfo.FragmentShaderInfo = GraphicsShaderInfo.Create(blitFragShaderModule, "main", 1); blitPipeline = new GraphicsPipeline(GraphicsDevice, blitPipelineCreateInfo); } diff --git a/CullFace/CullFaceGame.cs b/CullFace/CullFaceGame.cs index c3c5a2f..a3bcd2f 100644 --- a/CullFace/CullFaceGame.cs +++ b/CullFace/CullFaceGame.cs @@ -31,11 +31,7 @@ namespace MoonWorks.Test vertShaderModule, fragShaderModule ); - pipelineCreateInfo.VertexInputState = new VertexInputState( - VertexBinding.Create(), - VertexAttribute.Create("Position", 0), - VertexAttribute.Create("Color", 1) - ); + pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); pipelineCreateInfo.RasterizerState = RasterizerState.CW_CullNone; CW_CullNonePipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); diff --git a/DrawIndirect/DrawIndirectGame.cs b/DrawIndirect/DrawIndirectGame.cs index d0a62b1..e7611da 100644 --- a/DrawIndirect/DrawIndirectGame.cs +++ b/DrawIndirect/DrawIndirectGame.cs @@ -23,11 +23,7 @@ namespace MoonWorks.Test vertShaderModule, fragShaderModule ); - pipelineCreateInfo.VertexInputState = new VertexInputState( - VertexBinding.Create(), - VertexAttribute.Create("Position", 0), - VertexAttribute.Create("Color", 1) - ); + pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); graphicsPipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); // Create and populate the vertex buffer diff --git a/MSAA/MSAAGame.cs b/MSAA/MSAAGame.cs index 748f8b4..2323ad3 100644 --- a/MSAA/MSAAGame.cs +++ b/MSAA/MSAAGame.cs @@ -45,11 +45,7 @@ namespace MoonWorks.Test blitVertShaderModule, blitFragShaderModule ); - pipelineCreateInfo.VertexInputState = new VertexInputState( - VertexBinding.Create(), - VertexAttribute.Create("Position", 0), - VertexAttribute.Create("TexCoord", 1) - ); + pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); pipelineCreateInfo.FragmentShaderInfo.SamplerBindingCount = 1; blitPipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); diff --git a/MoonWorks.Test.Common/VertexTypes.cs b/MoonWorks.Test.Common/VertexTypes.cs index b25b520..3b86311 100644 --- a/MoonWorks.Test.Common/VertexTypes.cs +++ b/MoonWorks.Test.Common/VertexTypes.cs @@ -5,7 +5,7 @@ using MoonWorks.Math.Float; namespace MoonWorks.Test { [StructLayout(LayoutKind.Sequential)] - public struct PositionVertex + public struct PositionVertex : IVertexType { public Vector3 Position; @@ -14,6 +14,11 @@ namespace MoonWorks.Test Position = position; } + public static VertexElementFormat[] Formats { get; } = new VertexElementFormat[1] + { + VertexElementFormat.Vector3 + }; + public override string ToString() { return Position.ToString(); @@ -21,7 +26,7 @@ namespace MoonWorks.Test } [StructLayout(LayoutKind.Sequential)] - public struct PositionColorVertex + public struct PositionColorVertex : IVertexType { public Vector3 Position; public Color Color; @@ -32,6 +37,12 @@ namespace MoonWorks.Test Color = color; } + public static VertexElementFormat[] Formats { get; } = new VertexElementFormat[2] + { + VertexElementFormat.Vector3, + VertexElementFormat.Color + }; + public override string ToString() { return Position + " | " + Color; @@ -39,7 +50,7 @@ namespace MoonWorks.Test } [StructLayout(LayoutKind.Sequential)] - public struct PositionTextureVertex + public struct PositionTextureVertex : IVertexType { public Vector3 Position; public Vector2 TexCoord; @@ -50,6 +61,12 @@ namespace MoonWorks.Test TexCoord = texCoord; } + public static VertexElementFormat[] Formats { get; } = new VertexElementFormat[2] + { + VertexElementFormat.Vector3, + VertexElementFormat.Vector2 + }; + public override string ToString() { return Position + " | " + TexCoord; diff --git a/TexturedAnimatedQuad/TexturedAnimatedQuadGame.cs b/TexturedAnimatedQuad/TexturedAnimatedQuadGame.cs index d8b7f5f..9905ff4 100644 --- a/TexturedAnimatedQuad/TexturedAnimatedQuadGame.cs +++ b/TexturedAnimatedQuad/TexturedAnimatedQuadGame.cs @@ -50,11 +50,7 @@ namespace MoonWorks.Test fragShaderModule ); pipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions[0].BlendState = ColorAttachmentBlendState.AlphaBlend; - pipelineCreateInfo.VertexInputState = new VertexInputState( - VertexBinding.Create(), - VertexAttribute.Create("Position", 0), - VertexAttribute.Create("TexCoord", 1) - ); + pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); pipelineCreateInfo.VertexShaderInfo = GraphicsShaderInfo.Create(vertShaderModule, "main", 0); pipelineCreateInfo.FragmentShaderInfo = GraphicsShaderInfo.Create(fragShaderModule, "main", 1); pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); diff --git a/TexturedQuad/TexturedQuadGame.cs b/TexturedQuad/TexturedQuadGame.cs index bbdeda5..aa6c592 100644 --- a/TexturedQuad/TexturedQuadGame.cs +++ b/TexturedQuad/TexturedQuadGame.cs @@ -38,11 +38,7 @@ namespace MoonWorks.Test vertShaderModule, fragShaderModule ); - pipelineCreateInfo.VertexInputState = new VertexInputState( - VertexBinding.Create(), - VertexAttribute.Create("Position", 0), - VertexAttribute.Create("TexCoord", 1) - ); + pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); pipelineCreateInfo.FragmentShaderInfo.SamplerBindingCount = 1; pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); diff --git a/TriangleVertexBuffer/TriangleVertexBufferGame.cs b/TriangleVertexBuffer/TriangleVertexBufferGame.cs index 9b92f6d..287bbd1 100644 --- a/TriangleVertexBuffer/TriangleVertexBufferGame.cs +++ b/TriangleVertexBuffer/TriangleVertexBufferGame.cs @@ -21,11 +21,7 @@ namespace MoonWorks.Test vertShaderModule, fragShaderModule ); - pipelineCreateInfo.VertexInputState = new VertexInputState( - VertexBinding.Create(), - VertexAttribute.Create("Position", 0), - VertexAttribute.Create("Color", 1) - ); + pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding(); pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); // Create and populate the vertex buffer