-
Notifications
You must be signed in to change notification settings - Fork 860
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
Add support for EXT_ray_flags_primitive_culling. #2173
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are semantics actually changed by declaring the extension, or is there some feature that must get used to truly need the capability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, we are triggering capability need by use of the ability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See for example
TGlslangToSpvTraverser::TranslateBuiltInDecoration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RayFlag values 256 and 512 become valid when this capability is enabled, but there are more ways that you could get the values 256 and 512 than by just using the gl_RayFlagsSkipAABBEXT and gl_RayFlagsSkipTrianglesEXT constants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, on the one hand it sounds like we should be testing for emitting 256 and 512 as the reason to require the capability, but on the other hand I'm not clear if that's your position.
Speculating: If this can't be detected 100% by a feature use on translation, we also have
Builder::postProcessFeatures()
to detect what was needed after translation completed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ultimately, there is no guaranteed way to know at compile time if this capability is needed.
The "Ray Flags" argument to OpTraceRayKHR is any Id. No requirement for it to be a constant. It could be loaded from memory, or passed in from another stage (as is done with the IncomingRayFlagsKHR builtin). This ultimately needs run-time validation, so we believe we need a separate extension to enable the shader author to specifically opt-in to using the capability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. It's a feature that the compiler cannot tell is being used, so the extension does nothing except signal a run-time value might appear. Have we done this much?
The way to semantically guard such a feature would be, for example, to have the #extension declare a keyword/type/declaration/etc. that syntactically declares what is in use. These could turn into modes in SPIR-V rather than capabilities. There are choices in all those steps, but the point is that it is quite possible and common to still have a syntactic or semantically statically visible sign of what feature is in use.
Saying it more shortly, the #extension line by itself should not be what changes value semantics, it should be what enables a language feature that says what happens to semantics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On re-reading the GLSL extension, the dynamic part really does not come through. It is focused on providing the two built-ins, not on adding a new mode that becomes present whether or not the new built-ins are consumed.
I think this deserves better documentation, if not actual language semantics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can improve the documentation in the GLSL extension. I don't know that we have precedent for anything like this, and I'm not sure how any modes or other declarations would really be an improvement, but can you add further suggestions in https://gitlab.khronos.org/vulkan/vulkan/issues/2073 and we can consider changing that for final?
Right now we are blocked on actually being able to test these features until something is done here.