Skip to content

Commit 2241267

Browse files
Removed unnecessary declarations of rasterizer. They just disturbed t… (#267)
* Removed unnecessary declarations of rasterizer. They just disturbed the meaning and didn't compile anyway. * Removed even more repeated code.
1 parent 8c56580 commit 2241267

1 file changed

Lines changed: 5 additions & 32 deletions

File tree

en/03_Drawing_a_triangle/02_Graphics_pipeline_basics/02_Fixed_functions.adoc

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -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

154157
If `depthClampEnable` is set to `VK_TRUE`, then fragments that are beyond
155158
the near and far planes are clamped to them as opposed to discarding them.
156159
This 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

164162
If `rasterizerDiscardEnable` is set to `VK_TRUE`, then geometry never passes through the rasterizer stage.
165163
This 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-
175165
The `polygonMode` determines how fragments are generated for geometry.
176166
The following modes are available:
177167

@@ -181,30 +171,13 @@ The following modes are available:
181171

182172
Using any mode other than fill requires enabling a GPU feature.
183173

184-
[,c++]
185-
----
186-
rasterizer.lineWidth = 1.0f;
187-
----
188-
189174
The `lineWidth` member is straightforward, it describes the thickness of lines in terms of number of fragments.
190175
The 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-
198177
The `cullMode` variable determines the type of face culling to use.
199178
You can disable culling, cull the front faces, cull the back faces or both.
200179
The `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-
208181
The rasterizer can alter the depth values by adding a constant value or biasing them based on a fragment's slope.
209182
This is sometimes used for shadow mapping, but we won't be using it.
210183
Just set `depthBiasEnable` to `VK_FALSE`.

0 commit comments

Comments
 (0)