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

Fix WGSL varying input attributes #5937

Closed

Conversation

fairywreath
Copy link
Contributor

@fairywreath fairywreath commented Dec 24, 2024

Closes #5933.

This is a quick fix that copies code from Metal legalization (function packStageInParameters) to WGSL legalization, where individual varying inputs are placed into a global struct. Currently, WGSL does not properly add location qualifiers to the individual varying inputs.

This is not a permanent solution and will need to be refactored later. Issue #4657 tracks the refactoring effort of applying metal's legalization to the common entry point legalization context This change is also related to PR #5498, where code duplication already exists, further highlighting the need for refactoring and share the metal specific legalization logic to other backends.

[Draft because explicit vk locations are broken]

@fairywreath fairywreath requested a review from a team as a code owner December 24, 2024 06:48
@fairywreath fairywreath marked this pull request as draft December 24, 2024 06:48
@fairywreath fairywreath changed the title add direct varying input hoisting with code from metal Fix WGSL varying input attributes Dec 24, 2024
@@ -1348,6 +1356,195 @@ struct LegalizeWGSLEntryPointContext
}
}

void hoistEntryPointParameterFromStruct(EntryPointInfo entryPoint)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these exactly the same as metal? if so we can move it to a shared file and call the function from both backends.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I initially copied them but I am getting crashes and test regressions, I will need more time to fix this. Another option is to just add new code to add semantic attributes to the parameters, but reusing code from Metal and refactoring(including refactoring of the existing) wgsl legalization code that is duplicated from Metal is still worth it IMO.

@fairywreath
Copy link
Contributor Author

fairywreath commented Jan 16, 2025

I will create a separate PR for this, changes from this PR are not valid anymore after the refactor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wgsl @location attribute not emitted for entry-point varyings
2 participants