From 903e962096cc846d99cec6991fb58d2a9d39f747 Mon Sep 17 00:00:00 2001 From: Morten Kristiansen Date: Tue, 30 Dec 2025 15:48:38 +0100 Subject: [PATCH 1/2] Removed unnecessary declarations of rasterizer. They just disturbed the meaning and didn't compile anyway. --- .../02_Fixed_functions.adoc | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/en/03_Drawing_a_triangle/02_Graphics_pipeline_basics/02_Fixed_functions.adoc b/en/03_Drawing_a_triangle/02_Graphics_pipeline_basics/02_Fixed_functions.adoc index 360e0e5c..149f0217 100644 --- a/en/03_Drawing_a_triangle/02_Graphics_pipeline_basics/02_Fixed_functions.adoc +++ b/en/03_Drawing_a_triangle/02_Graphics_pipeline_basics/02_Fixed_functions.adoc @@ -148,30 +148,20 @@ All this is configured using the `VkPipelineRasterizationStateCreateInfo` struct [,c++] ---- -vk::PipelineRasterizationStateCreateInfo rasterizer({}, vk::False); +vk::PipelineRasterizationStateCreateInfo rasterizer{ .depthClampEnable = vk::False, .rasterizerDiscardEnable = vk::False, + .polygonMode = vk::PolygonMode::eFill, .cullMode = vk::CullModeFlagBits::eBack, + .frontFace = vk::FrontFace::eClockwise, .depthBiasEnable = vk::False, + .depthBiasSlopeFactor = 1.0f, .lineWidth = 1.0f }; ---- If `depthClampEnable` is set to `VK_TRUE`, then fragments that are beyond the near and far planes are clamped to them as opposed to discarding them. This is useful in some special cases like shadow maps. -Using this requires enabling a GPU feature. - -[,c++] ----- -vk::PipelineRasterizationStateCreateInfo rasterizer({}, vk::False, vk::False); ----- +Using this requires enabling a GPU feature. If `rasterizerDiscardEnable` is set to `VK_TRUE`, then geometry never passes through the rasterizer stage. This basically disables any output to the framebuffer. -[,c++] ----- -vk::PipelineRasterizationStateCreateInfo rasterizer{ .depthClampEnable = vk::False, .rasterizerDiscardEnable = vk::False, - .polygonMode = vk::PolygonMode::eFill, .cullMode = vk::CullModeFlagBits::eBack, - .frontFace = vk::FrontFace::eClockwise, .depthBiasEnable = vk::False, - .depthBiasSlopeFactor = 1.0f, .lineWidth = 1.0f }; ----- - The `polygonMode` determines how fragments are generated for geometry. The following modes are available: From d94a049e0d650700af61bb7a714a111ccb8083c8 Mon Sep 17 00:00:00 2001 From: Morten Kristiansen Date: Tue, 30 Dec 2025 15:56:23 +0100 Subject: [PATCH 2/2] Removed even more repeated code. --- .../02_Fixed_functions.adoc | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/en/03_Drawing_a_triangle/02_Graphics_pipeline_basics/02_Fixed_functions.adoc b/en/03_Drawing_a_triangle/02_Graphics_pipeline_basics/02_Fixed_functions.adoc index 149f0217..0c5b1987 100644 --- a/en/03_Drawing_a_triangle/02_Graphics_pipeline_basics/02_Fixed_functions.adoc +++ b/en/03_Drawing_a_triangle/02_Graphics_pipeline_basics/02_Fixed_functions.adoc @@ -171,30 +171,13 @@ The following modes are available: Using any mode other than fill requires enabling a GPU feature. -[,c++] ----- -rasterizer.lineWidth = 1.0f; ----- - The `lineWidth` member is straightforward, it describes the thickness of lines in terms of number of fragments. 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. -[,c++] ----- -vk::PipelineRasterizationStateCreateInfo rasterizer({}, vk::False, vk::False, vk::PolygonMode::eFill, - vk::CullModeFlagBits::eBack, vk::FrontFace::eClockwise); ----- - The `cullMode` variable determines the type of face culling to use. You can disable culling, cull the front faces, cull the back faces or both. The `frontFace` variable specifies the vertex order for the faces to be considered front-facing and can be clockwise or counterclockwise. -[,c++] ----- -vk::PipelineRasterizationStateCreateInfo rasterizer({}, vk::False, vk::False, vk::PolygonMode::eFill, - vk::CullModeFlagBits::eBack, vk::FrontFace::eClockwise, vk::False); ----- - The rasterizer can alter the depth values by adding a constant value or biasing them based on a fragment's slope. This is sometimes used for shadow mapping, but we won't be using it. Just set `depthBiasEnable` to `VK_FALSE`.