KhronosGroup / KhronosGroup/Vulkan-ValidationLayers
Enabling Validation Layers writes to render targets when rasterization pipeline has no color attachment configured
- Dominant language
- C++
- Stars
- 1k
- Forks
- 504
- Avg merge
- 11h 35m
- Merged PRs (30d)
- 224
Description
**Environment:**
- OS: Windows
- GPU and driver version: RTX 5080, Game Ready Driver - 580.97
- SDK or header version if building from repo: 1.4.321.1
- Options enabled (synchronization, best practices, etc.): synchronization, best practices
**Describe the Issue**
When validation layers are enabled, the Vulkan program will write to render targets despite the bound rasterization pipeline not having any color attachments configured.
To be more specific, when `VkPipelineRenderingCreateInfo`'s `.colorAttachmentCount` is `0` and `.pColorAttachmentFormats` is `nullptr` and then you proceed with adding `VkRenderingAttachmentInfo`s into `VkRenderingInfo`'s `.pColorAttachments` and setting `.colorAttachmentCount` appropriately with validation layers enabled, observe that those render targets are written to.
When validation layers are disabled, observe that nothing is written to the color render targets. Looking at a capture in Renderdoc shows that the shader is writing to the pixel some value but the resulting output for the pixel is 0. This issue also persist when enabling validation layers through vkconfig.
**Expected behavior**
Nothing is written to the render target if the rasterization pipeline has no color attachment configured when validation layers are enabled. Preferably have validation layers throw warnings or errors.
**Valid Usage ID**
N/A
**Additional context**
The setup
With validation layers or vkconfig
Without validation layers or vkconfig
Contributor guide
Research direction
The report identifies VkPipelineRenderingCreateInfo, VkRenderingAttachmentInfo, VkRenderingInfo, and RenderDoc captures, but names no source file or test. Start by reproducing the difference with validation layers enabled and disabled, then trace the dynamic-rendering validation path; done means the invalid configuration is rejected or produces the expected no-write behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100