Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation Layers modify incorrect configurations resulting in a successful render #8947

Open
SimonBorghese opened this issue Dec 1, 2024 · 5 comments

Comments

@SimonBorghese
Copy link

SimonBorghese commented Dec 1, 2024

Environment:

  • OS: Windows 10 & Arch Linux
  • GPU and driver version: NVIDIA RTX 3070, 566.14 (Windows) 565.57.01 (Linux)
  • SDK: 1.3.296.0 (Windows) 1.3.290 (Linux)
  • Options enabled (synchronization, best practices, etc.): Handle Wrapping (Windows) (Options not narrowed down on Linux, using defaults)

Describe the Issue

Consider a Vulkan application using dynamic rendering on Vulkan 1.3.29X

The programmer sets the vkRenderInfo struct as the p_next to their pipeline creation info. Within the vkRenderInfo, colorAttachmentCount is set to zero HOWEVER the actual pointer to the color attachments formats is set to point to the format of the color attachment used in dynamic rendering. This happens the programmer forgot to set the color attachment format count.

When validation layers are completely disabled, this results in the expected behavior (i.e. undefined behavior).

HOWEVER, when validation layers are enabled, the pipeline correctly outputs to color attachments despite to no color attachment formats technically being specified,

Expected behavior

Undefined behavior, specifically on my driver, the fragment shader output is NOT written to the color attachment

A validation error SHOULD be raised in this configuration however none is but that is not the scope of this issue.

@spencer-lunarg
Copy link
Contributor

Can I confirm a few things

  1. You had
VkRenderingInfo render_info;
render_info.colorAttachmentCount = 0;
render_info.pColorAttachments = pointer_to_formats;
  1. Was your VkPipelineRenderingCreateInfo::colorAttachmentCount equal to 0 as well

otherwise you should got en error like

Validation Error: [ VUID-vkCmdDraw-colorAttachmentCount-06179 ] Object 0: handle = 0x629ddb946bb0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0xcfef35000000000a, type = VK_OBJECT_TYPE_PIPELINE; | MessageID = 0x94a972a0 | vkCmdDraw(): Currently bound pipeline VkPipeline 0xcfef35000000000a[] VkPipelineRenderingCreateInfo::colorAttachmentCount (1) must be equal to VkRenderingInfo::colorAttachmentCount (0).

@SimonBorghese
Copy link
Author

Can I confirm a few things

1. You had
VkRenderingInfo render_info;
render_info.colorAttachmentCount = 0;
render_info.pColorAttachments = pointer_to_formats;
2. Was your `VkPipelineRenderingCreateInfo::colorAttachmentCount` equal to `0` as well

otherwise you should got en error like

Validation Error: [ VUID-vkCmdDraw-colorAttachmentCount-06179 ] Object 0: handle = 0x629ddb946bb0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0xcfef35000000000a, type = VK_OBJECT_TYPE_PIPELINE; | MessageID = 0x94a972a0 | vkCmdDraw(): Currently bound pipeline VkPipeline 0xcfef35000000000a[] VkPipelineRenderingCreateInfo::colorAttachmentCount (1) must be equal to VkRenderingInfo::colorAttachmentCount (0).

This was a mistake on my end due to my variable naming scheme, when I said RenderingInfo I meant VkPipelineRenderingCreateInfo. I am using Dynamic Rendering and specify my color attachments there.

VkPipelineRenderingCreateInfo::colorAttachmentCount is zero however the number of attachments to the VkRenderingInfo is NOT zero and has the count correctly set.

VkPipelineRenderingCreateInfo::colorAttachmentCount = 0
VkRenderingInfo::colorAttachmentCount != 0

Enabling certain validation layers and/or settings result in a successful render.

@spencer-lunarg
Copy link
Contributor

So did you get an error message for
image

(You are not using dynamicRenderingUnusedAttachments are you?)

Also to confirm "the issue" is Validation did not report this VU?

@SimonBorghese
Copy link
Author

So did you get an error message for image

(You are not using dynamicRenderingUnusedAttachments are you?)

Also to confirm "the issue" is Validation did not report this VU?

Correct, I received no validation errors. I changed VkPipelineRenderingCreateInfo::colorAttachmentCount from 0 to 1 while debugging and in neither case did I get a validation error.

@spencer-lunarg
Copy link
Contributor

I tried writing a test and I always get a Validation error. Can you provide an API dump or some way for me to reproduce this where it does not throw a validation error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants