Skip to content

Layers incorrectly assume a dynamic state has been invalidated #12859

Description

@rg3igalia

Environment:

  • OS: Fedora 44
  • GPU and driver version: RADV from Mesa main
  • SDK or header version if building from repo: 74115d6
  • Options enabled (synchronization, best practices, etc.): defaults+synchronization

Describe the Issue

There is an upcoming set of CTS tests that are failing validation due to what I think is a layers bug. The situation is a bit tricky. The tests try to verify that drivers are not invalidating dynamic state by mistake when doing something like:

  1. Set a dynamic state.
  2. Bind pipeline that does not have that state (not static nor dynamic).
  3. Draw.
  4. Bind pipeline with the dynamic state from step 1.
  5. Draw.

And the goal is verifying that the dynamic state from step 1 is correctly used at step 5. Most of the tests work alright, but some of them fail unexpectedly. In particular, there are some cases that try to check this with, e.g., VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT. In those cases, the pipeline bound at step 2 disables rasterization and sets pViewportState to nullptr at pipeline creation time, arguably creating a pipeline that does not have viewport state, but the layers complain:

ERROR|VALIDATION: [VUID-vkCmdDraw-scissorCount-03418] vkCmdDraw(): VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT state is dynamic, but the command buffer never called vkCmdSetScissorWithCount.
(There was a call to vkCmdBindPipeline with VkPipeline 0x1240000000124 that didn't have VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT and invalidated the prior vkCmdSetScissorWithCount call).
The Vulkan spec states: If a shader object is bound to any graphics stage or a graphics pipeline is bound which was created with the VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT dynamic state enabled, and the state is not inherited, then vkCmdSetScissorWithCount must have been called and not subsequently invalidated in the current command buffer prior to this drawing (https://docs.vulkan.org/spec/latest/chapters/drawing.html#VUID-vkCmdDraw-scissorCount-03418)

With the problem being that I think the state has not been invalidated because the pipeline bound at step 2 did not have that state.

Expected behavior

No validation errors.

Valid Usage ID

VUID-vkCmdDraw-scissorCount-03418 and VUID-vkCmdDraw-viewportCount-03417.

Additional context

N/A

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions