@@ -148,30 +148,20 @@ All this is configured using the `VkPipelineRasterizationStateCreateInfo` struct
148148
149149[,c++]
150150----
151- vk::PipelineRasterizationStateCreateInfo rasterizer({}, vk::False);
151+ vk::PipelineRasterizationStateCreateInfo rasterizer{ .depthClampEnable = vk::False, .rasterizerDiscardEnable = vk::False,
152+ .polygonMode = vk::PolygonMode::eFill, .cullMode = vk::CullModeFlagBits::eBack,
153+ .frontFace = vk::FrontFace::eClockwise, .depthBiasEnable = vk::False,
154+ .depthBiasSlopeFactor = 1.0f, .lineWidth = 1.0f };
152155----
153156
154157If `depthClampEnable` is set to `VK_TRUE`, then fragments that are beyond
155158the near and far planes are clamped to them as opposed to discarding them.
156159This is useful in some special cases like shadow maps.
157- Using this requires enabling a GPU feature.
158-
159- [,c++]
160- ----
161- vk::PipelineRasterizationStateCreateInfo rasterizer({}, vk::False, vk::False);
162- ----
160+ Using this requires enabling a GPU feature.
163161
164162If `rasterizerDiscardEnable` is set to `VK_TRUE`, then geometry never passes through the rasterizer stage.
165163This basically disables any output to the framebuffer.
166164
167- [,c++]
168- ----
169- vk::PipelineRasterizationStateCreateInfo rasterizer{ .depthClampEnable = vk::False, .rasterizerDiscardEnable = vk::False,
170- .polygonMode = vk::PolygonMode::eFill, .cullMode = vk::CullModeFlagBits::eBack,
171- .frontFace = vk::FrontFace::eClockwise, .depthBiasEnable = vk::False,
172- .depthBiasSlopeFactor = 1.0f, .lineWidth = 1.0f };
173- ----
174-
175165The `polygonMode` determines how fragments are generated for geometry.
176166The following modes are available:
177167
@@ -181,30 +171,13 @@ The following modes are available:
181171
182172Using any mode other than fill requires enabling a GPU feature.
183173
184- [,c++]
185- ----
186- rasterizer.lineWidth = 1.0f;
187- ----
188-
189174The `lineWidth` member is straightforward, it describes the thickness of lines in terms of number of fragments.
190175The maximum line width that is supported depends on the hardware and any line thicker than `1.0f` requires you to enable the `wideLines` GPU feature.
191176
192- [,c++]
193- ----
194- vk::PipelineRasterizationStateCreateInfo rasterizer({}, vk::False, vk::False, vk::PolygonMode::eFill,
195- vk::CullModeFlagBits::eBack, vk::FrontFace::eClockwise);
196- ----
197-
198177The `cullMode` variable determines the type of face culling to use.
199178You can disable culling, cull the front faces, cull the back faces or both.
200179The `frontFace` variable specifies the vertex order for the faces to be considered front-facing and can be clockwise or counterclockwise.
201180
202- [,c++]
203- ----
204- vk::PipelineRasterizationStateCreateInfo rasterizer({}, vk::False, vk::False, vk::PolygonMode::eFill,
205- vk::CullModeFlagBits::eBack, vk::FrontFace::eClockwise, vk::False);
206- ----
207-
208181The rasterizer can alter the depth values by adding a constant value or biasing them based on a fragment's slope.
209182This is sometimes used for shadow mapping, but we won't be using it.
210183Just set `depthBiasEnable` to `VK_FALSE`.
0 commit comments