update pipeline construction
parent
49b22ad9cc
commit
1bc3b2f7ce
|
@ -1 +1 @@
|
||||||
Subproject commit 278db7d55b572cf7fc0090b101f02a49770521ec
|
Subproject commit 7d3a7901b25d9544e47e2f0ea5baf9089d4ccb08
|
|
@ -44,8 +44,8 @@ namespace MoonWorksComputeSpriteBatch
|
||||||
ShaderModule = computeShaderModule,
|
ShaderModule = computeShaderModule,
|
||||||
EntryPointName = "main",
|
EntryPointName = "main",
|
||||||
UniformBufferSize = (uint)Marshal.SizeOf<SpriteBatchUniforms>(),
|
UniformBufferSize = (uint)Marshal.SizeOf<SpriteBatchUniforms>(),
|
||||||
bufferBindingCount = 2,
|
BufferBindingCount = 2,
|
||||||
imageBindingCount = 0
|
ImageBindingCount = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
ComputePipeline = new ComputePipeline(graphicsDevice, computeShaderInfo);
|
ComputePipeline = new ComputePipeline(graphicsDevice, computeShaderInfo);
|
||||||
|
|
118
src/TestGame.cs
118
src/TestGame.cs
|
@ -35,103 +35,31 @@ namespace MoonWorksComputeSpriteBatch
|
||||||
|
|
||||||
/* Pipeline */
|
/* Pipeline */
|
||||||
|
|
||||||
DepthStencilState depthStencilState = DepthStencilState.Disable;
|
spritePipeline = new GraphicsPipeline(
|
||||||
|
GraphicsDevice,
|
||||||
GraphicsShaderInfo vertexShaderInfo = new GraphicsShaderInfo
|
new GraphicsPipelineCreateInfo
|
||||||
{
|
{
|
||||||
ShaderModule = vertexShaderModule,
|
AttachmentInfo = new GraphicsPipelineAttachmentInfo(
|
||||||
EntryPointName = "main",
|
new ColorAttachmentDescription(
|
||||||
UniformBufferSize = (uint)Marshal.SizeOf<CameraUniforms>(),
|
GraphicsDevice.GetSwapchainFormat(Window),
|
||||||
SamplerBindingCount = 0
|
ColorAttachmentBlendState.None
|
||||||
};
|
)
|
||||||
|
),
|
||||||
GraphicsShaderInfo fragmentShaderInfo = new GraphicsShaderInfo
|
DepthStencilState = DepthStencilState.Disable,
|
||||||
{
|
VertexShaderInfo = GraphicsShaderInfo.Create<CameraUniforms>(vertexShaderModule, "main", 0),
|
||||||
ShaderModule = fragmentShaderModule,
|
VertexInputState = new VertexInputState(
|
||||||
EntryPointName = "main",
|
VertexBinding.Create<VertexPositionTexcoord>(),
|
||||||
UniformBufferSize = 0,
|
VertexAttribute.Create<VertexPositionTexcoord>("position", 0),
|
||||||
SamplerBindingCount = 1
|
VertexAttribute.Create<VertexPositionTexcoord>("texcoord", 1),
|
||||||
};
|
VertexAttribute.Create<VertexPositionTexcoord>("color", 2)
|
||||||
|
),
|
||||||
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,
|
|
||||||
PrimitiveType = PrimitiveType.TriangleList,
|
PrimitiveType = PrimitiveType.TriangleList,
|
||||||
VertexInputState = vertexInputState,
|
FragmentShaderInfo = GraphicsShaderInfo.Create(fragmentShaderModule, "main", 1),
|
||||||
ViewportState = viewportState,
|
RasterizerState = RasterizerState.CW_CullBack,
|
||||||
AttachmentInfo = graphicsPipelineAttachmentInfo,
|
ViewportState = new ViewportState((int)Window.Width, (int)Window.Height),
|
||||||
BlendConstants = new BlendConstants()
|
MultisampleState = MultisampleState.None
|
||||||
};
|
}
|
||||||
|
);
|
||||||
spritePipeline = new GraphicsPipeline(GraphicsDevice, graphicsPipelineCreateInfo);
|
|
||||||
|
|
||||||
spriteBatch = new SpriteBatch(GraphicsDevice);
|
spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue