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

Skip to content

Commit d40b02a

Browse files
committed
Fix inconsistency in depth chapter vs code
1 parent ace0630 commit d40b02a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

07_Depth_buffering.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,15 +362,15 @@ depthAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
362362
depthAttachment.storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
363363
depthAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
364364
depthAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
365-
depthAttachment.initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
365+
depthAttachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
366366
depthAttachment.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
367367
```
368368

369369
The `format` should be the same as the depth image itself. This time we don't
370370
care about storing the depth data (`storeOp`), because it will not be used after
371371
drawing has finished. This may allow the hardware to perform additional
372-
optimizations. The layout of the image will not change during rendering, so the
373-
`initialLayout` and `finalLayout` are the same.
372+
optimizations. Just like the color buffer, we don't care about the previous
373+
depth contents, so we can use `VK_IMAGE_LAYOUT_UNDEFINED` as `initialLayout`.
374374

375375
```c++
376376
VkAttachmentReference depthAttachmentRef = {};
@@ -554,4 +554,4 @@ by drawing a textured model!
554554

555555
[C++ code](/code/depth_buffering.cpp) /
556556
[Vertex shader](/code/shader_depth.vert) /
557-
[Fragment shader](/code/shader_depth.frag)
557+
[Fragment shader](/code/shader_depth.frag)

0 commit comments

Comments
 (0)