Skip to content
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

Map SV_InstanceID to gl_InstanceIndex-gl_BaseInstance #6468

Merged
merged 7 commits into from
Feb 28, 2025

Conversation

csyonghe
Copy link
Collaborator

@csyonghe csyonghe commented Feb 26, 2025

Closes #6457.

This PR adds a new mechanism to represent builtin GLSL/SPIRV variables in Slang IR, by decorating a global variable with the IRTargetBuiltinVarDecoration. This new mechanism is used to represent SV_Instance, gl_InstanceIndex and gl_BaseInstance.

In a follow up PR, we will refactor the existing builtin variable implementation in GLSL/SPIRV legalization to use IRTargetBuiltinVarDecoration instead of relying on the SystemSemanticAttr. The refactor is not done in thie PR to keep the change small and focused.

@csyonghe csyonghe added the pr: non-breaking PRs without breaking changes label Feb 26, 2025
@csyonghe csyonghe requested a review from a team as a code owner February 26, 2025 20:44
@csyonghe csyonghe requested a review from jkwak-work February 27, 2025 23:54
@csyonghe csyonghe merged commit 6f2ce72 into shader-slang:master Feb 28, 2025
16 checks passed
Copy link
Collaborator

@jkwak-work jkwak-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Comment on lines +9 to +10
#include <chrono>

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is needed to silence another related error in latest vs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: non-breaking PRs without breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SV_InstanceID should translate consistently to SPIRV.
2 participants