Possible validation error in https://docs.vulkan.org/tutorial/latest/07_Depth_buffering.html

Open Beginner friendly
#439 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
cpp

Research direction

Start at the depth-buffering tutorial page and reproduce the issue by selecting only vk::Format::eD32SfloatS8Uint and vk::Format::eD24UnormS8Uint in the supported-format list. Inspect the depth image layout transition and verify that the aspect mask includes the required depth and stencil aspects, then rerun the tutorial with validation enabled to confirm the reported error is gone.

Written by the indexing model from the issue text.

Description

The aspect mask for the depth image layout transition is hardcoded to vk::ImageAspectFlagBits::eDepth

If, while choosing the depth image format, vk::Format::eD32Sfloat, is not selected, the program will cause this validation error:

Validation Error: [ VUID-VkImageMemoryBarrier2-image-03320 ] | MessageID = 0xb7ab59da
vkCmdPipelineBarrier2(): pDependencyInfo->pImageMemoryBarriers[0].image (VkImage 0xf000000000f) has depth/stencil format VK_FORMAT_D32_SFLOAT_S8_UINT, but its aspectMask is VK_IMAGE_ASPECT_DEPTH_BIT.
The Vulkan spec states: If image has a depth/stencil format with both depth and stencil and the separateDepthStencilLayouts feature is not enabled, then the aspectMask member of subresourceRange must include both VK_IMAGE_ASPECT_DEPTH_BIT and VK_IMAGE_ASPECT_STENCIL_BIT (https://docs.vulkan.org/spec/latest/chapters/synchronization.html#VUID-VkImageMemoryBarrier2-image-03320)
Objects: 2
    [0] VkCommandBuffer 0x25a64390990
    [1] VkImage 0xf000000000f
Steps to reproduce

Change

return findSupportedFormat({vk::Format::eD32Sfloat, vk::Format::eD32SfloatS8Uint, vk::Format::eD24UnormS8Uint},
		                           vk::ImageTiling::eOptimal,
		                           vk::FormatFeatureFlagBits::eDepthStencilAttachment);

To this

return findSupportedFormat({vk::Format::eD32SfloatS8Uint, vk::Format::eD24UnormS8Uint},
		                           vk::ImageTiling::eOptimal,
		                           vk::FormatFeatureFlagBits::eDepthStencilAttachment);
Dominant language
C++
Stars
424
Forks
127
Avg merge
2d 21h
Merged PRs (30d)
5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from KhronosGroup/Vulkan-Tutorial

All issues in KhronosGroup/Vulkan-Tutorial

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.