Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1398eaa

Browse files
committed
Clarify value of basePipelineIndex and why setting it to -1 is optional
1 parent 18f0f8c commit 1398eaa

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

03_Drawing_a_triangle/02_Graphics_pipeline_basics/04_Conclusion.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ And finally we have the reference to the render pass and the index of the sub
5353
pass where this graphics pipeline will be used.
5454

5555
```c++
56-
pipelineInfo.basePipelineHandle = VK_NULL_HANDLE;
56+
pipelineInfo.basePipelineHandle = VK_NULL_HANDLE; // Optional
5757
pipelineInfo.basePipelineIndex = -1; // Optional
5858
```
5959

@@ -62,8 +62,12 @@ There are actually two more parameters: `basePipelineHandle` and
6262
deriving from an existing pipeline. The idea of pipeline derivatives is that it
6363
is less expensive to set up pipelines when they have much functionality in
6464
common with an existing pipeline and switching between pipelines from the same
65-
parent can also be done quicker. Right now there is only a single pipeline, so
66-
we'll simply specify a null handle.
65+
parent can also be done quicker. You can either specify the handle of an
66+
existing pipeline with `basePipelineHandle` or reference another pipeline that
67+
is about to be created by index with `basePipelineIndex`. Right now there is
68+
only a single pipeline, so we'll simply specify a null handle and an invalid
69+
index. These values are only used if the `VK_PIPELINE_CREATE_DERIVATIVE_BIT`
70+
flag is also specified in the `flags` field of `VkGraphicsPipelineCreateInfo`.
6771

6872
Now prepare for the final step by creating a class member to hold the
6973
`VkPipeline` object:
@@ -99,4 +103,4 @@ actual framebuffers from the swap chain images and prepare the drawing commands.
99103

100104
[C++ code](/code/graphics_pipeline_complete.cpp) /
101105
[Vertex shader](/code/shader_base.vert) /
102-
[Fragment shader](/code/shader_base.frag)
106+
[Fragment shader](/code/shader_base.frag)

0 commit comments

Comments
 (0)