update pipeline construction
parent
49b22ad9cc
commit
1bc3b2f7ce
|
@ -1 +1 @@
|
|||
Subproject commit 278db7d55b572cf7fc0090b101f02a49770521ec
|
||||
Subproject commit 7d3a7901b25d9544e47e2f0ea5baf9089d4ccb08
|
|
@ -44,8 +44,8 @@ namespace MoonWorksComputeSpriteBatch
|
|||
ShaderModule = computeShaderModule,
|
||||
EntryPointName = "main",
|
||||
UniformBufferSize = (uint)Marshal.SizeOf<SpriteBatchUniforms>(),
|
||||
bufferBindingCount = 2,
|
||||
imageBindingCount = 0
|
||||
BufferBindingCount = 2,
|
||||
ImageBindingCount = 0
|
||||
};
|
||||
|
||||
ComputePipeline = new ComputePipeline(graphicsDevice, computeShaderInfo);
|
||||
|
|
118
src/TestGame.cs
118
src/TestGame.cs
|
@ -35,103 +35,31 @@ namespace MoonWorksComputeSpriteBatch
|
|||
|
||||
/* Pipeline */
|
||||
|
||||
DepthStencilState depthStencilState = DepthStencilState.Disable;
|
||||
|
||||
GraphicsShaderInfo vertexShaderInfo = new GraphicsShaderInfo
|
||||
spritePipeline = new GraphicsPipeline(
|
||||
GraphicsDevice,
|
||||
new GraphicsPipelineCreateInfo
|
||||
{
|
||||
ShaderModule = vertexShaderModule,
|
||||
EntryPointName = "main",
|
||||
UniformBufferSize = (uint)Marshal.SizeOf<CameraUniforms>(),
|
||||
SamplerBindingCount = 0
|
||||
};
|
||||
|
||||
GraphicsShaderInfo fragmentShaderInfo = new GraphicsShaderInfo
|
||||
{
|
||||
ShaderModule = fragmentShaderModule,
|
||||
EntryPointName = "main",
|
||||
UniformBufferSize = 0,
|
||||
SamplerBindingCount = 1
|
||||
};
|
||||
|
||||
MultisampleState multisampleState = MultisampleState.None;
|
||||
|
||||
RasterizerState rasterizerState = RasterizerState.CCW_CullNone;
|
||||
|
||||
var vertexBindings = new VertexBinding[1]
|
||||
{
|
||||
new VertexBinding
|
||||
{
|
||||
Binding = 0,
|
||||
InputRate = VertexInputRate.Vertex,
|
||||
Stride = (uint) Marshal.SizeOf<VertexPositionTexcoord>()
|
||||
}
|
||||
};
|
||||
|
||||
var vertexAttributes = new VertexAttribute[3]
|
||||
{
|
||||
new VertexAttribute
|
||||
{
|
||||
Binding = 0,
|
||||
Location = 0,
|
||||
Format = VertexElementFormat.Vector3,
|
||||
Offset = 0
|
||||
},
|
||||
new VertexAttribute
|
||||
{
|
||||
Binding = 0,
|
||||
Location = 1,
|
||||
Format = VertexElementFormat.Vector2,
|
||||
Offset = (uint) Marshal.OffsetOf<VertexPositionTexcoord>("texcoord")
|
||||
},
|
||||
new VertexAttribute
|
||||
{
|
||||
Binding = 0,
|
||||
Location = 2,
|
||||
Format = VertexElementFormat.Vector4,
|
||||
Offset = (uint) Marshal.OffsetOf<VertexPositionTexcoord>("color")
|
||||
}
|
||||
};
|
||||
|
||||
VertexInputState vertexInputState = new VertexInputState
|
||||
{
|
||||
VertexBindings = vertexBindings,
|
||||
VertexAttributes = vertexAttributes
|
||||
};
|
||||
|
||||
ViewportState viewportState = new ViewportState((int)windowWidth, (int)windowHeight);
|
||||
|
||||
var colorAttachmentDescriptions = new ColorAttachmentDescription[1]
|
||||
{
|
||||
new ColorAttachmentDescription
|
||||
{
|
||||
Format = GraphicsDevice.GetSwapchainFormat(Window),
|
||||
SampleCount = SampleCount.One,
|
||||
BlendState = ColorAttachmentBlendState.None
|
||||
}
|
||||
};
|
||||
|
||||
GraphicsPipelineAttachmentInfo graphicsPipelineAttachmentInfo = new GraphicsPipelineAttachmentInfo
|
||||
{
|
||||
ColorAttachmentDescriptions = colorAttachmentDescriptions,
|
||||
HasDepthStencilAttachment = false,
|
||||
DepthStencilFormat = 0
|
||||
};
|
||||
|
||||
var graphicsPipelineCreateInfo = new GraphicsPipelineCreateInfo
|
||||
{
|
||||
DepthStencilState = depthStencilState,
|
||||
VertexShaderInfo = vertexShaderInfo,
|
||||
FragmentShaderInfo = fragmentShaderInfo,
|
||||
MultisampleState = multisampleState,
|
||||
RasterizerState = rasterizerState,
|
||||
AttachmentInfo = new GraphicsPipelineAttachmentInfo(
|
||||
new ColorAttachmentDescription(
|
||||
GraphicsDevice.GetSwapchainFormat(Window),
|
||||
ColorAttachmentBlendState.None
|
||||
)
|
||||
),
|
||||
DepthStencilState = DepthStencilState.Disable,
|
||||
VertexShaderInfo = GraphicsShaderInfo.Create<CameraUniforms>(vertexShaderModule, "main", 0),
|
||||
VertexInputState = new VertexInputState(
|
||||
VertexBinding.Create<VertexPositionTexcoord>(),
|
||||
VertexAttribute.Create<VertexPositionTexcoord>("position", 0),
|
||||
VertexAttribute.Create<VertexPositionTexcoord>("texcoord", 1),
|
||||
VertexAttribute.Create<VertexPositionTexcoord>("color", 2)
|
||||
),
|
||||
PrimitiveType = PrimitiveType.TriangleList,
|
||||
VertexInputState = vertexInputState,
|
||||
ViewportState = viewportState,
|
||||
AttachmentInfo = graphicsPipelineAttachmentInfo,
|
||||
BlendConstants = new BlendConstants()
|
||||
};
|
||||
|
||||
spritePipeline = new GraphicsPipeline(GraphicsDevice, graphicsPipelineCreateInfo);
|
||||
FragmentShaderInfo = GraphicsShaderInfo.Create(fragmentShaderModule, "main", 1),
|
||||
RasterizerState = RasterizerState.CW_CullBack,
|
||||
ViewportState = new ViewportState((int)Window.Width, (int)Window.Height),
|
||||
MultisampleState = MultisampleState.None
|
||||
}
|
||||
);
|
||||
|
||||
spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||
|
||||
|
|
Loading…
Reference in New Issue