PacktPublishing / Mastering-Graphics-Programming-with-Vulkan

MIT License
539 stars 73 forks source link

Wrong depth image transition (VK_IMAGE_LAYOUT_UNDEFINED -> VK_IMAGE_LAYOUT_PRESENT_SRC_KHR) #22

Closed dorian-apanel-intel closed 1 year ago

dorian-apanel-intel commented 1 year ago

There is a wrong transition of depth image to VK_IMAGE_LAYOUT_PRESENT_SRC_KHR layout.

In following line: https://github.com/PacktPublishing/Mastering-Graphics-Programming-with-Vulkan/blob/b5f3092c77a331b99f800b3355cba35854047a2a/source/chapter1/graphics/gpu_device.cpp#L1786

Vk Spec states: VK_IMAGE_LAYOUT_PRESENT_SRC_KHR must only be used for presenting a presentable image for display

Validation layers are currently silent about this, but there is already an issue created for it https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/4309

dorian-apanel-intel commented 1 year ago

This transition is not needed in my opinion. It is done only in initial command buffer, and following render passes do Discard+Clear anyway. image

image

theWatchmen commented 1 year ago

Thanks, I agree this is likely not needed. I merged your changes and then ported the fix to the other chapters.

dorian-apanel-intel commented 1 year ago

Thanks :)