Repository navigation
Fix SPIRV struct reconstruction with bitfields - #5390
Merged
Merged
Conversation
HLSL/SPIR-V structs have some layout differences due to bitfields being squashed. The reconstruction logic was using the AST layout, and not the new SPIR-V layout, meaning we could generate invalid indices during extraction/construction. This PR a potential bug with bitfields, while making the code reusable. Signed-off-by: Nathan Gauër <[email protected]>
Nathan Gauër (Keenuts)
requested review from
Cassandra Beckley (cassiebeckley) and
Steven Perron (s-perron)
July 5, 2023 15:16
Collaborator
Author
|
This PR is a split from #5388. |
Steven Perron (s-perron)
approved these changes
Jul 5, 2023
Nathan Gauër (Keenuts)
enabled auto-merge (squash)
July 5, 2023 16:42
Steven Perron (s-perron)
approved these changes
Jul 5, 2023
Diego Novillo (dnovillo)
approved these changes
Jul 7, 2023
Diego Novillo (dnovillo)
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. Just a couple of nits and a question.
| return output; | ||
| } | ||
|
|
||
| // Calls `operation` on for each field in the base and derives class defined by |
Collaborator
There was a problem hiding this comment.
nit: s/on for/on/
Collaborator
There was a problem hiding this comment.
nit: s/derives/derived/
| // Calls `operation` on for each field in the base and derives class defined by | ||
| // `recordType`. The `operation` will receive the AST type linked to the field, | ||
| // the SPIRV type linked to the field, and the index of the field in the final | ||
| // SPIR-V representation. This index of the field can vary from the AST |
Collaborator
There was a problem hiding this comment.
The AST type is used to determine derived types exclusively, right?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HLSL/SPIR-V structs have some layout differences due to bitfields being squashed.
The reconstruction logic was using the AST layout, and not the new SPIR-V layout, meaning we could generate invalid indices during extraction/construction.
This PR fixes a potential bug with bitfields, while making the code reusable.