File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -362,15 +362,15 @@ depthAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
362362depthAttachment.storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
363363depthAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
364364depthAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
365- depthAttachment.initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ;
365+ depthAttachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED ;
366366depthAttachment.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
367367```
368368
369369The ` format ` should be the same as the depth image itself. This time we don't
370370care about storing the depth data (` storeOp ` ), because it will not be used after
371371drawing 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++
376376VkAttachmentReference 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 )
You can’t perform that action at this time.
0 commit comments