Compare commits

...

3 Commits

24 changed files with 48 additions and 73 deletions

View File

@ -7,7 +7,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
</PropertyGroup> </PropertyGroup>

View File

@ -51,11 +51,7 @@ namespace MoonWorks.Test
vertShaderModule, vertShaderModule,
fragShaderModule fragShaderModule
); );
drawPipelineCreateInfo.VertexInputState = new VertexInputState( drawPipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>();
VertexBinding.Create<PositionTextureVertex>(),
VertexAttribute.Create<PositionTextureVertex>("Position", 0),
VertexAttribute.Create<PositionTextureVertex>("TexCoord", 1)
);
drawPipelineCreateInfo.FragmentShaderInfo.SamplerBindingCount = 1; drawPipelineCreateInfo.FragmentShaderInfo.SamplerBindingCount = 1;
drawPipeline = new GraphicsPipeline( drawPipeline = new GraphicsPipeline(

View File

@ -7,7 +7,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
</PropertyGroup> </PropertyGroup>

View File

@ -7,7 +7,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
</PropertyGroup> </PropertyGroup>

View File

@ -7,7 +7,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
</PropertyGroup> </PropertyGroup>

View File

@ -7,7 +7,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
</PropertyGroup> </PropertyGroup>

View File

@ -52,11 +52,7 @@ namespace MoonWorks.Test
vertShaderModule, vertShaderModule,
fragShaderModule fragShaderModule
); );
drawPipelineCreateInfo.VertexInputState = new VertexInputState( drawPipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>();
VertexBinding.Create<PositionTextureVertex>(),
VertexAttribute.Create<PositionTextureVertex>("Position", 0),
VertexAttribute.Create<PositionTextureVertex>("TexCoord", 1)
);
drawPipelineCreateInfo.FragmentShaderInfo.SamplerBindingCount = 1; drawPipelineCreateInfo.FragmentShaderInfo.SamplerBindingCount = 1;
drawPipeline = new GraphicsPipeline( drawPipeline = new GraphicsPipeline(

View File

@ -7,7 +7,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
</PropertyGroup> </PropertyGroup>

View File

@ -165,11 +165,7 @@ namespace MoonWorks.Test
), ),
DepthStencilState = DepthStencilState.DepthReadWrite, DepthStencilState = DepthStencilState.DepthReadWrite,
VertexShaderInfo = GraphicsShaderInfo.Create<ViewProjectionUniforms>(cubeVertShaderModule, "main", 0), VertexShaderInfo = GraphicsShaderInfo.Create<ViewProjectionUniforms>(cubeVertShaderModule, "main", 0),
VertexInputState = new VertexInputState( VertexInputState = VertexInputState.CreateSingleBinding<PositionColorVertex>(),
VertexBinding.Create<PositionColorVertex>(),
VertexAttribute.Create<PositionColorVertex>("Position", 0),
VertexAttribute.Create<PositionColorVertex>("Color", 1)
),
PrimitiveType = PrimitiveType.TriangleList, PrimitiveType = PrimitiveType.TriangleList,
FragmentShaderInfo = GraphicsShaderInfo.Create(cubeFragShaderModule, "main", 0), FragmentShaderInfo = GraphicsShaderInfo.Create(cubeFragShaderModule, "main", 0),
RasterizerState = RasterizerState.CW_CullBack, RasterizerState = RasterizerState.CW_CullBack,
@ -193,10 +189,7 @@ namespace MoonWorks.Test
), ),
DepthStencilState = DepthStencilState.DepthReadWrite, DepthStencilState = DepthStencilState.DepthReadWrite,
VertexShaderInfo = GraphicsShaderInfo.Create<ViewProjectionUniforms>(skyboxVertShaderModule, "main", 0), VertexShaderInfo = GraphicsShaderInfo.Create<ViewProjectionUniforms>(skyboxVertShaderModule, "main", 0),
VertexInputState = new VertexInputState( VertexInputState = VertexInputState.CreateSingleBinding<PositionVertex>(),
VertexBinding.Create<PositionVertex>(),
VertexAttribute.Create<PositionVertex>("Position", 0)
),
PrimitiveType = PrimitiveType.TriangleList, PrimitiveType = PrimitiveType.TriangleList,
FragmentShaderInfo = GraphicsShaderInfo.Create(skyboxFragShaderModule, "main", 1), FragmentShaderInfo = GraphicsShaderInfo.Create(skyboxFragShaderModule, "main", 1),
RasterizerState = RasterizerState.CW_CullNone, RasterizerState = RasterizerState.CW_CullNone,
@ -214,11 +207,7 @@ namespace MoonWorks.Test
blitVertShaderModule, blitVertShaderModule,
blitFragShaderModule blitFragShaderModule
); );
blitPipelineCreateInfo.VertexInputState = new VertexInputState( blitPipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>();
VertexBinding.Create<PositionTextureVertex>(),
VertexAttribute.Create<PositionTextureVertex>("Position", 0),
VertexAttribute.Create<PositionTextureVertex>("TexCoord", 1)
);
blitPipelineCreateInfo.FragmentShaderInfo = GraphicsShaderInfo.Create<DepthUniforms>(blitFragShaderModule, "main", 1); blitPipelineCreateInfo.FragmentShaderInfo = GraphicsShaderInfo.Create<DepthUniforms>(blitFragShaderModule, "main", 1);
blitPipeline = new GraphicsPipeline(GraphicsDevice, blitPipelineCreateInfo); blitPipeline = new GraphicsPipeline(GraphicsDevice, blitPipelineCreateInfo);
} }

View File

@ -7,7 +7,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
</PropertyGroup> </PropertyGroup>

View File

@ -31,11 +31,7 @@ namespace MoonWorks.Test
vertShaderModule, vertShaderModule,
fragShaderModule fragShaderModule
); );
pipelineCreateInfo.VertexInputState = new VertexInputState( pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionColorVertex>();
VertexBinding.Create<PositionColorVertex>(),
VertexAttribute.Create<PositionColorVertex>("Position", 0),
VertexAttribute.Create<PositionColorVertex>("Color", 1)
);
pipelineCreateInfo.RasterizerState = RasterizerState.CW_CullNone; pipelineCreateInfo.RasterizerState = RasterizerState.CW_CullNone;
CW_CullNonePipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); CW_CullNonePipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
@ -99,6 +95,8 @@ namespace MoonWorks.Test
{ {
cmdbuf.BeginRenderPass(new ColorAttachmentInfo(backbuffer, Color.Black)); cmdbuf.BeginRenderPass(new ColorAttachmentInfo(backbuffer, Color.Black));
// Need to bind a pipeline before binding vertex buffers
cmdbuf.BindGraphicsPipeline(CW_CullNonePipeline);
if (useClockwiseWinding) if (useClockwiseWinding)
{ {
cmdbuf.BindVertexBuffers(cwVertexBuffer); cmdbuf.BindVertexBuffers(cwVertexBuffer);
@ -109,7 +107,6 @@ namespace MoonWorks.Test
} }
cmdbuf.SetViewport(new Viewport(0, 0, 213, 240)); cmdbuf.SetViewport(new Viewport(0, 0, 213, 240));
cmdbuf.BindGraphicsPipeline(CW_CullNonePipeline);
cmdbuf.DrawPrimitives(0, 1, 0, 0); cmdbuf.DrawPrimitives(0, 1, 0, 0);
cmdbuf.SetViewport(new Viewport(213, 0, 213, 240)); cmdbuf.SetViewport(new Viewport(213, 0, 213, 240));

View File

@ -7,7 +7,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
</PropertyGroup> </PropertyGroup>

View File

@ -23,11 +23,7 @@ namespace MoonWorks.Test
vertShaderModule, vertShaderModule,
fragShaderModule fragShaderModule
); );
pipelineCreateInfo.VertexInputState = new VertexInputState( pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionColorVertex>();
VertexBinding.Create<PositionColorVertex>(),
VertexAttribute.Create<PositionColorVertex>("Position", 0),
VertexAttribute.Create<PositionColorVertex>("Color", 1)
);
graphicsPipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); graphicsPipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
// Create and populate the vertex buffer // Create and populate the vertex buffer

View File

@ -7,7 +7,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
</PropertyGroup> </PropertyGroup>

View File

@ -7,7 +7,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
</PropertyGroup> </PropertyGroup>

View File

@ -45,11 +45,7 @@ namespace MoonWorks.Test
blitVertShaderModule, blitVertShaderModule,
blitFragShaderModule blitFragShaderModule
); );
pipelineCreateInfo.VertexInputState = new VertexInputState( pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>();
VertexBinding.Create<PositionTextureVertex>(),
VertexAttribute.Create<PositionTextureVertex>("Position", 0),
VertexAttribute.Create<PositionTextureVertex>("TexCoord", 1)
);
pipelineCreateInfo.FragmentShaderInfo.SamplerBindingCount = 1; pipelineCreateInfo.FragmentShaderInfo.SamplerBindingCount = 1;
blitPipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); blitPipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
@ -128,7 +124,7 @@ namespace MoonWorks.Test
rt, rt,
Color.Black, Color.Black,
currentSampleCount, currentSampleCount,
StoreOp.DontCare StoreOp.Store
) )
); );
cmdbuf.BindGraphicsPipeline(msaaPipelines[(int) currentSampleCount]); cmdbuf.BindGraphicsPipeline(msaaPipelines[(int) currentSampleCount]);

View File

@ -6,7 +6,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>library</OutputType> <OutputType>library</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
</PropertyGroup> </PropertyGroup>

View File

@ -5,7 +5,7 @@ using MoonWorks.Math.Float;
namespace MoonWorks.Test namespace MoonWorks.Test
{ {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct PositionVertex public struct PositionVertex : IVertexType
{ {
public Vector3 Position; public Vector3 Position;
@ -14,6 +14,11 @@ namespace MoonWorks.Test
Position = position; Position = position;
} }
public static VertexElementFormat[] Formats { get; } = new VertexElementFormat[1]
{
VertexElementFormat.Vector3
};
public override string ToString() public override string ToString()
{ {
return Position.ToString(); return Position.ToString();
@ -21,7 +26,7 @@ namespace MoonWorks.Test
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct PositionColorVertex public struct PositionColorVertex : IVertexType
{ {
public Vector3 Position; public Vector3 Position;
public Color Color; public Color Color;
@ -32,6 +37,12 @@ namespace MoonWorks.Test
Color = color; Color = color;
} }
public static VertexElementFormat[] Formats { get; } = new VertexElementFormat[2]
{
VertexElementFormat.Vector3,
VertexElementFormat.Color
};
public override string ToString() public override string ToString()
{ {
return Position + " | " + Color; return Position + " | " + Color;
@ -39,7 +50,7 @@ namespace MoonWorks.Test
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct PositionTextureVertex public struct PositionTextureVertex : IVertexType
{ {
public Vector3 Position; public Vector3 Position;
public Vector2 TexCoord; public Vector2 TexCoord;
@ -50,6 +61,12 @@ namespace MoonWorks.Test
TexCoord = texCoord; TexCoord = texCoord;
} }
public static VertexElementFormat[] Formats { get; } = new VertexElementFormat[2]
{
VertexElementFormat.Vector3,
VertexElementFormat.Vector2
};
public override string ToString() public override string ToString()
{ {
return Position + " | " + TexCoord; return Position + " | " + TexCoord;

View File

@ -7,7 +7,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
</PropertyGroup> </PropertyGroup>

View File

@ -50,11 +50,7 @@ namespace MoonWorks.Test
fragShaderModule fragShaderModule
); );
pipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions[0].BlendState = ColorAttachmentBlendState.AlphaBlend; pipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions[0].BlendState = ColorAttachmentBlendState.AlphaBlend;
pipelineCreateInfo.VertexInputState = new VertexInputState( pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>();
VertexBinding.Create<PositionTextureVertex>(),
VertexAttribute.Create<PositionTextureVertex>("Position", 0),
VertexAttribute.Create<PositionTextureVertex>("TexCoord", 1)
);
pipelineCreateInfo.VertexShaderInfo = GraphicsShaderInfo.Create<VertexUniforms>(vertShaderModule, "main", 0); pipelineCreateInfo.VertexShaderInfo = GraphicsShaderInfo.Create<VertexUniforms>(vertShaderModule, "main", 0);
pipelineCreateInfo.FragmentShaderInfo = GraphicsShaderInfo.Create<FragmentUniforms>(fragShaderModule, "main", 1); pipelineCreateInfo.FragmentShaderInfo = GraphicsShaderInfo.Create<FragmentUniforms>(fragShaderModule, "main", 1);
pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);

View File

@ -7,7 +7,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
</PropertyGroup> </PropertyGroup>

View File

@ -38,11 +38,7 @@ namespace MoonWorks.Test
vertShaderModule, vertShaderModule,
fragShaderModule fragShaderModule
); );
pipelineCreateInfo.VertexInputState = new VertexInputState( pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>();
VertexBinding.Create<PositionTextureVertex>(),
VertexAttribute.Create<PositionTextureVertex>("Position", 0),
VertexAttribute.Create<PositionTextureVertex>("TexCoord", 1)
);
pipelineCreateInfo.FragmentShaderInfo.SamplerBindingCount = 1; pipelineCreateInfo.FragmentShaderInfo.SamplerBindingCount = 1;
pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);

View File

@ -7,7 +7,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
</PropertyGroup> </PropertyGroup>

View File

@ -21,11 +21,7 @@ namespace MoonWorks.Test
vertShaderModule, vertShaderModule,
fragShaderModule fragShaderModule
); );
pipelineCreateInfo.VertexInputState = new VertexInputState( pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionColorVertex>();
VertexBinding.Create<PositionColorVertex>(),
VertexAttribute.Create<PositionColorVertex>("Position", 0),
VertexAttribute.Create<PositionColorVertex>("Color", 1)
);
pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
// Create and populate the vertex buffer // Create and populate the vertex buffer