-
Notifications
You must be signed in to change notification settings - Fork 840
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
glslang produces SPIR-V that the Vulkan validation layer doesn't like (DepthReplacing related) #1418
Comments
But, you declared that depth does not change, so the SPIR-V does not declare that it does. From your shader:
|
Ah, I see. That means it is a validator bug, as the validator cannot know whether or not depth is changed, so it cannot say that this should have been declared. |
I suspect this sentence in the Vulkan spec. slightly over states things:
It should probably say something more like:
|
I've taken this inside Khronos. There is an alternative that both DepthReplacing and DepthUnchanged should have been declared. https://gitlab.khronos.org/vulkan/vulkan/merge_requests/2741 |
That was my original impression from reading the spec - that it should have both. Note the GL extension:
And this related issue: Which implies that there was some use case that motivated more strictly defining behavior here. Not sure what it was. I can only think of code reuse and influencing early z as use cases for depth_unchanged. The bug being worked around is documented here, in case useful: -[Unknown] |
glslang + validation layer seems to cooperate better now, not getting bad validation errors anymore at least. |
Closing this as resolved, per the last comment. |
When creating a shader module using some SPIR-V produced by glslang, I get the following error:
ERROR: [Validation] Code 5 : Object: VK_NULL_HANDLE (Type = 0) | SPIR-V module not valid: Vulkan spec requires DepthReplacing execution mode to be declared when using BuiltIn FragDepth. ID <0> (OpStore) is referencing ID <8> (OpVariable) which is decorated with BuiltIn FragDepth in function <4>.
The SPIR-V was produced from the following GLSL:
Note that we update the depth with itself to prod some buggy mobile drivers that ignore OpKill (discard) unless the shader writes to depth, for whatever reason.
For the curious, this is used to write an image to stencil, a bitplane at a time.
The text was updated successfully, but these errors were encountered: