KhronosGroup / KhronosGroup/Vulkan-Tutorial

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
Dominant language
C++
Stars
418
Forks
126
Avg merge
11d 6h
Merged PRs (30d)
31

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);
```

Contributor guide

Open the contributing guide

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.