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

Lower varying parameters as pointers instead of SSA values. #5919

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

csyonghe
Copy link
Collaborator

@csyonghe csyonghe commented Dec 19, 2024

This PR changes the way we lower entry point varying parameters so that they are emitted as a ConstRef<T> typed pointer value instead of a SSA value.

This is required to properly implement things like GetAttributeAtVertex or EvaluateAttributeAtCentroid, where the argument is expected to be a reference to a vertex attribute declaration.

Previously this is implemented as a hack assuming the x in GetAttributeAtVertex(x) is a load(attribute_var), which isn't safe or correct.

By lowering all varying parameters as pointers, we can properly implement GetAttributeAtVertex(x) assuming x is a pointer in the Input address space.

This also allowed us to support using types that needs storage lowering for vertex attributes, such as column_major matrix types or bool types, by reusing the existing lowerBufferElementTypeToStorageType pass, which requires any such type to be used via a buffer or a pointer. This lowering is required to support Optional<T> in vertex attributes.

@csyonghe csyonghe requested a review from a team as a code owner December 19, 2024 22:41
@csyonghe csyonghe added the pr: non-breaking PRs without breaking changes label Dec 19, 2024
@csyonghe csyonghe changed the title Add executable test on matrix-typed vertex input. Lower varying parameters as pointers instead of SSA values. Dec 26, 2024
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.

1 participant