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
Make gl_HitT proper aliases of gl_RayTmax #2910
Make gl_HitT proper aliases of gl_RayTmax #2910
Conversation
By my reading, gl_HitTNV and gl_RayTmaxNV are not aliases in GL_NV_ray_tracing. Likewise HitTNV and RayTmaxNV are different things in SPV_NV_ray_tracing. So this should not cause changes for GL_NV_ray_tracing shaders targeting SPV_NV_ray_tracing. Right? Yet I am seeing, for example, changes for spv.AnyHitShader.rahit test which is a GL_NV_ray_tracing shader targeting SPV_NV_ray_tracing. Should this be changing? Or am I misunderstanding something here? |
I see, indeed the SPIR-V has two distinct decorations for the two in NV, unlike the EXT versions which only has RayTmaxKHR. I'll revert the changes to the NV variables, thanks for pointing it out! |
@Max-Andersson do you plan to pick this back up at some point? |
@greg-lunarg Looking at the GLSL_NV_ray_tracing spec, it does say "gl_HitTNV is available only in the any-hit and closest-hit shaders. This is an alias of gl_RayTmaxNV added to closest-hit and any-hit shaders for convenience." (line 657 here: https://github.com/KhronosGroup/GLSL/blob/master/extensions/nv/GLSL_NV_ray_tracing.txt). Seems like the specs are somewhat ambivalent on the issue. |
Update - from https://gitlab.khronos.org/vulkan/vulkan/-/issues/3885 that these should be alias (for KHR version as well) There is a upcoming |
Changes the gl_HitT builtins properly alias their gl_RayTmax. Previously they ended up as duplicate variables, rather than aliased.
de92639
to
a145a12
Compare
I've rebased the PR on top of main. |
In #2759, a mechanism to better handle the aliased builtin variables gl_VertexID and gl_VertexIndex (and their Instance counterparts) was committed. There is a similar problem for gl_HitTEXT and gl_RayTmaxEXT (and their NV counterparts), where they end up handled as duplicated variables and SPIR-V generation ends up creating two OpVariables with the same builtin decoration.
This PR simply makes use of the RetargetVariable code from #2759, as well as remove some then redundant code for handling gl_HitT.