Skip to content

Commit 29ab167

Browse files
committed
Fix parts of the tutorial that weren't update to match the code (fixes #288)
1 parent 6519906 commit 29ab167

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

en/04_Vertex_buffers/03_Index_buffer.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,16 @@ void cleanup() {
120120
## Using an index buffer
121121

122122
Using an index buffer for drawing involves two changes to
123-
`createCommandBuffers`. We first need to bind the index buffer, just like we did
123+
`recordCommandBuffer`. We first need to bind the index buffer, just like we did
124124
for the vertex buffer. The difference is that you can only have a single index
125125
buffer. It's unfortunately not possible to use different indices for each vertex
126126
attribute, so we do still have to completely duplicate vertex data even if just
127127
one attribute varies.
128128

129129
```c++
130-
vkCmdBindVertexBuffers(commandBuffers[i], 0, 1, vertexBuffers, offsets);
130+
vkCmdBindVertexBuffers(commandBuffer, 0, 1, vertexBuffers, offsets);
131131

132-
vkCmdBindIndexBuffer(commandBuffers[i], indexBuffer, 0, VK_INDEX_TYPE_UINT16);
132+
vkCmdBindIndexBuffer(commandBuffer, indexBuffer, 0, VK_INDEX_TYPE_UINT16);
133133
```
134134
135135
An index buffer is bound with `vkCmdBindIndexBuffer` which has the index buffer,
@@ -142,7 +142,7 @@ the drawing command to tell Vulkan to use the index buffer. Remove the
142142
`vkCmdDraw` line and replace it with `vkCmdDrawIndexed`:
143143
144144
```c++
145-
vkCmdDrawIndexed(commandBuffers[i], static_cast<uint32_t>(indices.size()), 1, 0, 0, 0);
145+
vkCmdDrawIndexed(commandBuffer, static_cast<uint32_t>(indices.size()), 1, 0, 0, 0);
146146
```
147147

148148
A call to this function is very similar to `vkCmdDraw`. The first two parameters

en/05_Uniform_buffers/01_Descriptor_pool_and_sets.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ allocInfo.descriptorSetCount = static_cast<uint32_t>(MAX_FRAMES_IN_FLIGHT);
106106
allocInfo.pSetLayouts = layouts.data();
107107
```
108108
109-
In our case we will create one descriptor set for each frame in flight, all with the same layout.
109+
In our case we will create one descriptor set for each frame in flight, all with the same layout.
110110
Unfortunately we do need all the copies of the layout because the next function expects an array matching the number of sets.
111111
112112
Add a class member to hold the descriptor set handles and allocate them with
@@ -133,7 +133,7 @@ buffer descriptor.
133133
void cleanup() {
134134
...
135135
vkDestroyDescriptorPool(device, descriptorPool, nullptr);
136-
136+
137137
vkDestroyDescriptorSetLayout(device, descriptorSetLayout, nullptr);
138138
...
139139
}
@@ -212,12 +212,12 @@ as its name implies.
212212
213213
## Using descriptor sets
214214
215-
We now need to update the `createCommandBuffers` function to actually bind the
215+
We now need to update the `recordCommandBuffer` function to actually bind the
216216
right descriptor set for each frame to the descriptors in the shader with `vkCmdBindDescriptorSets`. This needs to be done before the `vkCmdDrawIndexed` call:
217217
218218
```c++
219-
vkCmdBindDescriptorSets(commandBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0, 1, &descriptorSets[i], 0, nullptr);
220-
vkCmdDrawIndexed(commandBuffers[i], static_cast<uint32_t>(indices.size()), 1, 0, 0, 0);
219+
vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0, 1, &descriptorSets[currentFrame], 0, nullptr);
220+
vkCmdDrawIndexed(commandBuffer, static_cast<uint32_t>(indices.size()), 1, 0, 0, 0);
221221
```
222222

223223
Unlike vertex and index buffers, descriptor sets are not unique to graphics

en/07_Depth_buffering.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -577,10 +577,6 @@ void recreateSwapChain() {
577577
createGraphicsPipeline();
578578
createDepthResources();
579579
createFramebuffers();
580-
createUniformBuffers();
581-
createDescriptorPool();
582-
createDescriptorSets();
583-
createCommandBuffers();
584580
}
585581
```
586582

en/08_Loading_models.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ there are going to be a lot more vertices than 65535. Remember to also change
9696
the `vkCmdBindIndexBuffer` parameter:
9797

9898
```c++
99-
vkCmdBindIndexBuffer(commandBuffers[i], indexBuffer, 0, VK_INDEX_TYPE_UINT32);
99+
vkCmdBindIndexBuffer(commandBuffer, indexBuffer, 0, VK_INDEX_TYPE_UINT32);
100100
```
101101
102102
The tinyobjloader library is included in the same way as STB libraries. Include

0 commit comments

Comments
 (0)