-
Notifications
You must be signed in to change notification settings - Fork 255
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
Legalize the Entry-point for WGSL #5498
Legalize the Entry-point for WGSL #5498
Conversation
The return type of the entry-point needs to be legalized when targeting WGSL. This commit flattens the nested-structs of the return type and the input parameters of the entry-point. Most of code is copied from the legalization code for Metal. The following functions are exactly same to the implementation for Metal or almost same. - flattenInputParameters() : 136 lines - reportUnsupportedSystemAttribute() : 7 lines - ensureResultStructHasUserSemantic() : 46 lines - struct MapStructToFlatStruct : 176 lines - flattenNestedStructs() : 95 lines - maybeFlattenNestedStructs() : 42 lines - _replaceAllReturnInst() : 19 lines - _returnNonOverlappingAttributeIndex() : 16 lines - _replaceAttributeOfLayout() : 23 lines - tryConvertValue() : 41 lines - legalizeSystemValueParameters() : 11 lines They need to be refactored to reduce the duplication later.
/format |
🌈 Formatted, please merge the changes from this PR |
For the review, |
…_basic_varying_input Format code for PR shader-slang#5498
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.
Looks good. We definitely need to refactor this to reuse as much code as possible between the two backends.
It seems like |
Can we also turn on all the relevant tests we have for metal to also cover wgsl? |
The test case, `tests/compute/assoctype-lookup.slang`, had a bug that the compute shader was trying to use the varying input/output with the user defined semantics. This commit removes the user defined semantics, because the compute shaders cannot use the user defined semantics.
I see. That's a good idea. |
I appears that this PR is missing a few use cases.
I will make another separate PR for resolving the problem and enabling them. |
Closes #5486
The return type of the entry-point needs to be legalized when targeting WGSL.
This commit flattens the nested-structs of the return type and the input parameters of the entry-point.
Most of code is copied from the legalization code for Metal. The following functions are exactly same to the implementation for Metal or almost same.
They need to be refactored to reduce the duplication later.