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

Skip to content

Commit 664832d

Browse files
committed
Change naming convention of sub pass related variables to match Vulkan API
1 parent 1770830 commit 664832d

19 files changed

Lines changed: 114 additions & 114 deletions

03_Drawing_a_triangle/02_Graphics_pipeline_basics/03_Render_passes.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,17 @@ us the best performance, as its name implies.
142142
The subpass is described using a `VkSubpassDescription` structure:
143143

144144
```c++
145-
VkSubpassDescription subPass = {};
146-
subPass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
145+
VkSubpassDescription subpass = {};
146+
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
147147
```
148148

149149
Vulkan may also support compute subpasses in the future, so we have to be
150150
explicit about this being a graphics subpass. Next, we specify the reference to
151151
the color attachment:
152152

153153
```c++
154-
subPass.colorAttachmentCount = 1;
155-
subPass.pColorAttachments = &colorAttachmentRef;
154+
subpass.colorAttachmentCount = 1;
155+
subpass.pColorAttachments = &colorAttachmentRef;
156156
```
157157

158158
The index of the attachment in this array is directly referenced from the
@@ -187,7 +187,7 @@ renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
187187
renderPassInfo.attachmentCount = 1;
188188
renderPassInfo.pAttachments = &colorAttachment;
189189
renderPassInfo.subpassCount = 1;
190-
renderPassInfo.pSubpasses = &subPass;
190+
renderPassInfo.pSubpasses = &subpass;
191191
192192
if (vkCreateRenderPass(device, &renderPassInfo, nullptr, renderPass.replace()) != VK_SUCCESS) {
193193
throw std::runtime_error("failed to create render pass!");
@@ -197,4 +197,4 @@ if (vkCreateRenderPass(device, &renderPassInfo, nullptr, renderPass.replace()) !
197197
That was a lot of work, but in the next chapter it all comes together to finally
198198
create the graphics pipeline object!
199199

200-
[Full code listing](/code/render_passes.cpp)
200+
[Full code listing](/code/render_passes.cpp)

07_Depth_buffering.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,11 @@ depthAttachmentRef.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
381381
Add a reference to the attachment for the first (and only) subpass:
382382

383383
```c++
384-
VkSubpassDescription subPass = {};
385-
subPass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
386-
subPass.colorAttachmentCount = 1;
387-
subPass.pColorAttachments = &colorAttachmentRef;
388-
subPass.pDepthStencilAttachment = &depthAttachmentRef;
384+
VkSubpassDescription subpass = {};
385+
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
386+
subpass.colorAttachmentCount = 1;
387+
subpass.pColorAttachments = &colorAttachmentRef;
388+
subpass.pDepthStencilAttachment = &depthAttachmentRef;
389389
```
390390

391391
Unlike color attachments, a subpass can only use a single depth (+stencil)
@@ -399,7 +399,7 @@ renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
399399
renderPassInfo.attachmentCount = attachments.size();
400400
renderPassInfo.pAttachments = attachments.data();
401401
renderPassInfo.subpassCount = 1;
402-
renderPassInfo.pSubpasses = &subPass;
402+
renderPassInfo.pSubpasses = &subpass;
403403
renderPassInfo.dependencyCount = 1;
404404
renderPassInfo.pDependencies = &dependency;
405405
```

code/command_buffers.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,17 +393,17 @@ class HelloTriangleApplication {
393393
colorAttachmentRef.attachment = 0;
394394
colorAttachmentRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
395395

396-
VkSubpassDescription subPass = {};
397-
subPass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
398-
subPass.colorAttachmentCount = 1;
399-
subPass.pColorAttachments = &colorAttachmentRef;
396+
VkSubpassDescription subpass = {};
397+
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
398+
subpass.colorAttachmentCount = 1;
399+
subpass.pColorAttachments = &colorAttachmentRef;
400400

401401
VkRenderPassCreateInfo renderPassInfo = {};
402402
renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
403403
renderPassInfo.attachmentCount = 1;
404404
renderPassInfo.pAttachments = &colorAttachment;
405405
renderPassInfo.subpassCount = 1;
406-
renderPassInfo.pSubpasses = &subPass;
406+
renderPassInfo.pSubpasses = &subpass;
407407

408408
if (vkCreateRenderPass(device, &renderPassInfo, nullptr, renderPass.replace()) != VK_SUCCESS) {
409409
throw std::runtime_error("failed to create render pass!");

code/depth_buffering.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -205,25 +205,25 @@ class HelloTriangleApplication {
205205

206206
VkQueue graphicsQueue;
207207
VkQueue presentQueue;
208-
208+
209209
VDeleter<VkSwapchainKHR> swapChain{device, vkDestroySwapchainKHR};
210210
std::vector<VkImage> swapChainImages;
211211
VkFormat swapChainImageFormat;
212212
VkExtent2D swapChainExtent;
213213
std::vector<VDeleter<VkImageView>> swapChainImageViews;
214214
std::vector<VDeleter<VkFramebuffer>> swapChainFramebuffers;
215-
215+
216216
VDeleter<VkRenderPass> renderPass{device, vkDestroyRenderPass};
217217
VDeleter<VkDescriptorSetLayout> descriptorSetLayout{device, vkDestroyDescriptorSetLayout};
218218
VDeleter<VkPipelineLayout> pipelineLayout{device, vkDestroyPipelineLayout};
219219
VDeleter<VkPipeline> graphicsPipeline{device, vkDestroyPipeline};
220-
220+
221221
VDeleter<VkCommandPool> commandPool{device, vkDestroyCommandPool};
222-
222+
223223
VDeleter<VkImage> depthImage{device, vkDestroyImage};
224224
VDeleter<VkDeviceMemory> depthImageMemory{device, vkFreeMemory};
225225
VDeleter<VkImageView> depthImageView{device, vkDestroyImageView};
226-
226+
227227
VDeleter<VkImage> textureImage{device, vkDestroyImage};
228228
VDeleter<VkDeviceMemory> textureImageMemory{device, vkFreeMemory};
229229
VDeleter<VkImageView> textureImageView{device, vkDestroyImageView};
@@ -297,7 +297,7 @@ class HelloTriangleApplication {
297297

298298
static void onWindowResized(GLFWwindow* window, int width, int height) {
299299
if (width == 0 || height == 0) return;
300-
300+
301301
HelloTriangleApplication* app = reinterpret_cast<HelloTriangleApplication*>(glfwGetWindowUserPointer(window));
302302
app->recreateSwapChain();
303303
}
@@ -527,11 +527,11 @@ class HelloTriangleApplication {
527527
depthAttachmentRef.attachment = 1;
528528
depthAttachmentRef.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
529529

530-
VkSubpassDescription subPass = {};
531-
subPass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
532-
subPass.colorAttachmentCount = 1;
533-
subPass.pColorAttachments = &colorAttachmentRef;
534-
subPass.pDepthStencilAttachment = &depthAttachmentRef;
530+
VkSubpassDescription subpass = {};
531+
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
532+
subpass.colorAttachmentCount = 1;
533+
subpass.pColorAttachments = &colorAttachmentRef;
534+
subpass.pDepthStencilAttachment = &depthAttachmentRef;
535535

536536
VkSubpassDependency dependency = {};
537537
dependency.srcSubpass = VK_SUBPASS_EXTERNAL;
@@ -547,7 +547,7 @@ class HelloTriangleApplication {
547547
renderPassInfo.attachmentCount = attachments.size();
548548
renderPassInfo.pAttachments = attachments.data();
549549
renderPassInfo.subpassCount = 1;
550-
renderPassInfo.pSubpasses = &subPass;
550+
renderPassInfo.pSubpasses = &subpass;
551551
renderPassInfo.dependencyCount = 1;
552552
renderPassInfo.pDependencies = &dependency;
553553

@@ -1509,4 +1509,4 @@ int main() {
15091509
}
15101510

15111511
return EXIT_SUCCESS;
1512-
}
1512+
}

code/descriptor_layout.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -495,10 +495,10 @@ class HelloTriangleApplication {
495495
colorAttachmentRef.attachment = 0;
496496
colorAttachmentRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
497497

498-
VkSubpassDescription subPass = {};
499-
subPass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
500-
subPass.colorAttachmentCount = 1;
501-
subPass.pColorAttachments = &colorAttachmentRef;
498+
VkSubpassDescription subpass = {};
499+
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
500+
subpass.colorAttachmentCount = 1;
501+
subpass.pColorAttachments = &colorAttachmentRef;
502502

503503
VkSubpassDependency dependency = {};
504504
dependency.srcSubpass = VK_SUBPASS_EXTERNAL;
@@ -513,7 +513,7 @@ class HelloTriangleApplication {
513513
renderPassInfo.attachmentCount = 1;
514514
renderPassInfo.pAttachments = &colorAttachment;
515515
renderPassInfo.subpassCount = 1;
516-
renderPassInfo.pSubpasses = &subPass;
516+
renderPassInfo.pSubpasses = &subpass;
517517
renderPassInfo.dependencyCount = 1;
518518
renderPassInfo.pDependencies = &dependency;
519519

code/descriptor_set.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,10 @@ class HelloTriangleApplication {
500500
colorAttachmentRef.attachment = 0;
501501
colorAttachmentRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
502502

503-
VkSubpassDescription subPass = {};
504-
subPass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
505-
subPass.colorAttachmentCount = 1;
506-
subPass.pColorAttachments = &colorAttachmentRef;
503+
VkSubpassDescription subpass = {};
504+
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
505+
subpass.colorAttachmentCount = 1;
506+
subpass.pColorAttachments = &colorAttachmentRef;
507507

508508
VkSubpassDependency dependency = {};
509509
dependency.srcSubpass = VK_SUBPASS_EXTERNAL;
@@ -518,7 +518,7 @@ class HelloTriangleApplication {
518518
renderPassInfo.attachmentCount = 1;
519519
renderPassInfo.pAttachments = &colorAttachment;
520520
renderPassInfo.subpassCount = 1;
521-
renderPassInfo.pSubpasses = &subPass;
521+
renderPassInfo.pSubpasses = &subpass;
522522
renderPassInfo.dependencyCount = 1;
523523
renderPassInfo.pDependencies = &dependency;
524524

code/framebuffers.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,17 +388,17 @@ class HelloTriangleApplication {
388388
colorAttachmentRef.attachment = 0;
389389
colorAttachmentRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
390390

391-
VkSubpassDescription subPass = {};
392-
subPass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
393-
subPass.colorAttachmentCount = 1;
394-
subPass.pColorAttachments = &colorAttachmentRef;
391+
VkSubpassDescription subpass = {};
392+
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
393+
subpass.colorAttachmentCount = 1;
394+
subpass.pColorAttachments = &colorAttachmentRef;
395395

396396
VkRenderPassCreateInfo renderPassInfo = {};
397397
renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
398398
renderPassInfo.attachmentCount = 1;
399399
renderPassInfo.pAttachments = &colorAttachment;
400400
renderPassInfo.subpassCount = 1;
401-
renderPassInfo.pSubpasses = &subPass;
401+
renderPassInfo.pSubpasses = &subpass;
402402

403403
if (vkCreateRenderPass(device, &renderPassInfo, nullptr, renderPass.replace()) != VK_SUCCESS) {
404404
throw std::runtime_error("failed to create render pass!");

code/graphics_pipeline_complete.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,17 +387,17 @@ class HelloTriangleApplication {
387387
colorAttachmentRef.attachment = 0;
388388
colorAttachmentRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
389389

390-
VkSubpassDescription subPass = {};
391-
subPass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
392-
subPass.colorAttachmentCount = 1;
393-
subPass.pColorAttachments = &colorAttachmentRef;
390+
VkSubpassDescription subpass = {};
391+
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
392+
subpass.colorAttachmentCount = 1;
393+
subpass.pColorAttachments = &colorAttachmentRef;
394394

395395
VkRenderPassCreateInfo renderPassInfo = {};
396396
renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
397397
renderPassInfo.attachmentCount = 1;
398398
renderPassInfo.pAttachments = &colorAttachment;
399399
renderPassInfo.subpassCount = 1;
400-
renderPassInfo.pSubpasses = &subPass;
400+
renderPassInfo.pSubpasses = &subpass;
401401

402402
if (vkCreateRenderPass(device, &renderPassInfo, nullptr, renderPass.replace()) != VK_SUCCESS) {
403403
throw std::runtime_error("failed to create render pass!");

code/hello_triangle.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,10 @@ class HelloTriangleApplication {
400400
colorAttachmentRef.attachment = 0;
401401
colorAttachmentRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
402402

403-
VkSubpassDescription subPass = {};
404-
subPass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
405-
subPass.colorAttachmentCount = 1;
406-
subPass.pColorAttachments = &colorAttachmentRef;
403+
VkSubpassDescription subpass = {};
404+
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
405+
subpass.colorAttachmentCount = 1;
406+
subpass.pColorAttachments = &colorAttachmentRef;
407407

408408
VkSubpassDependency dependency = {};
409409
dependency.srcSubpass = VK_SUBPASS_EXTERNAL;
@@ -418,7 +418,7 @@ class HelloTriangleApplication {
418418
renderPassInfo.attachmentCount = 1;
419419
renderPassInfo.pAttachments = &colorAttachment;
420420
renderPassInfo.subpassCount = 1;
421-
renderPassInfo.pSubpasses = &subPass;
421+
renderPassInfo.pSubpasses = &subpass;
422422
renderPassInfo.dependencyCount = 1;
423423
renderPassInfo.pDependencies = &dependency;
424424

code/index_buffer.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,10 @@ class HelloTriangleApplication {
476476
colorAttachmentRef.attachment = 0;
477477
colorAttachmentRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
478478

479-
VkSubpassDescription subPass = {};
480-
subPass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
481-
subPass.colorAttachmentCount = 1;
482-
subPass.pColorAttachments = &colorAttachmentRef;
479+
VkSubpassDescription subpass = {};
480+
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
481+
subpass.colorAttachmentCount = 1;
482+
subpass.pColorAttachments = &colorAttachmentRef;
483483

484484
VkSubpassDependency dependency = {};
485485
dependency.srcSubpass = VK_SUBPASS_EXTERNAL;
@@ -494,7 +494,7 @@ class HelloTriangleApplication {
494494
renderPassInfo.attachmentCount = 1;
495495
renderPassInfo.pAttachments = &colorAttachment;
496496
renderPassInfo.subpassCount = 1;
497-
renderPassInfo.pSubpasses = &subPass;
497+
renderPassInfo.pSubpasses = &subpass;
498498
renderPassInfo.dependencyCount = 1;
499499
renderPassInfo.pDependencies = &dependency;
500500

0 commit comments

Comments
 (0)