Skip to content

Depth write dynamic state required even when depth test is disabled #2522

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

Open
squidbus opened this issue Apr 9, 2025 · 3 comments
Open

Comments

@squidbus
Copy link

squidbus commented Apr 9, 2025

Depth write dynamic state seems to currently be required for any draw if marked as dynamic in the pipeline, regardless of the depth test enable value. This is contrary to how it works for other state that would go unused, for example depth compare op, which is not required when depth test is disabled. According to the spec, if depth test enable is false, depth write enable has no effect and is also treated as false, so it should not be required here.

The VUID for depth compare op, which indicates it is not needed with depth test disabled:


VUID-vkCmdDraw-None-07845

If a shader object is bound to any graphics stage or a graphics pipeline is bound which was created with the VK_DYNAMIC_STATE_DEPTH_COMPARE_OP dynamic state enabled, the current value of rasterizerDiscardEnable is VK_FALSE, and the current value of depthTestEnable is VK_TRUE, then vkCmdSetDepthCompareOp must have been called and not subsequently invalidated in the current command buffer prior to this drawing command


The VUID for depth write enable, which does not (and which the validation layer will complain about):


VUID-vkCmdDraw-None-07844

If a shader object is bound to any graphics stage or a graphics pipeline is bound which was created with the VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE dynamic state enabled, and the current value of rasterizerDiscardEnable is VK_FALSE, then vkCmdSetDepthWriteEnable must have been called and not subsequently invalidated in the current command buffer prior to this drawing command


@spencer-lunarg
Copy link

@pdaniell-nv tl;dr question - If you turn off depthTestEnable, can we ignore calling vkCmdSetDepthWriteEnable

If yes, then this is just an oversight and will get a fix in the spec and VVL

if no (because of some non-obvious reason) I would update the VVL message to explain that

@pdaniell-nv
Copy link

@pdaniell-nv tl;dr question - If you turn off depthTestEnable, can we ignore calling vkCmdSetDepthWriteEnable

Yes, I think this is an oversight. vkCmdSetDepthWriteEnable should not be required if depthTestEnable is not enabled.

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

3 participants