MoonWorks-docs/content/Graphics/Resources/GraphicsPipeline/GraphicsPipeline.md

31 lines
1.1 KiB
Markdown
Raw Normal View History

2021-01-28 21:43:21 +00:00
---
title: "Graphics Pipeline"
date: 2021-01-28T13:30:11-08:00
weight: 10
---
Finally, we have everything we need to build the graphics pipeline. We just need to pass our various structures into a `GraphicsPipelineCreateInfo` object.
```cs
var myGraphicsPipelineCreateInfo = new GraphicsPipelineCreateInfo
{
2022-03-04 18:34:23 +00:00
AttachmentInfo = myAttachmentInfo,
2021-01-28 21:43:21 +00:00
DepthStencilState = myDepthStencilState,
2022-03-04 18:34:23 +00:00
VertexShaderInfo = myVertexShaderInfo,
FragmentShaderInfo = myFragmentShaderInfo,
2021-01-28 21:43:21 +00:00
MultisampleState = myMultisampleState,
RasterizerState = myRasterizerState,
PrimitiveType = PrimitiveType.TriangleList,
VertexInputState = myVertexInputState,
ViewportState = myViewportState,
2022-03-04 18:34:23 +00:00
BlendConstants = myBlendConstants
2021-01-28 21:43:21 +00:00
};
var myGraphicsPipeline = new GraphicsPipeline(
GraphicsDevice,
myGraphicsPipelineCreateInfo
);
```
Finally! That's it! You might have noticed that a lot of this structure can be reused across pipelines. I strongly recommend creating individual container objects for the various states your renderer uses so you don't have to repeat yourself a whole bunch.