Skip to content

[SPIR-V] Fix crash in GetAttributeAtVertex impl.#6459

Merged
Keenuts merged 1 commit into
microsoft:mainfrom
Keenuts:fix-2955
Mar 29, 2024
Merged

[SPIR-V] Fix crash in GetAttributeAtVertex impl.#6459
Keenuts merged 1 commit into
microsoft:mainfrom
Keenuts:fix-2955

Conversation

@Keenuts
Copy link
Copy Markdown
Collaborator

@Keenuts Keenuts commented Mar 26, 2024

Some SPIR-V types are not direct translations of an AST type, hence they don't have an AST type attached to it.
The code didn't checked for this possibility when visiting all variables.

Fixes #2955

Some SPIR-V types are not direct translations of an AST type, hence
they don't have an AST type attached to it.
The code didn't checked for this possibility when visiting all
variables.

Fixes microsoft#2955

Signed-off-by: Nathan Gauër <brioche@google.com>
Copy link
Copy Markdown
Collaborator

@sudonatalie sudonatalie left a comment

Choose a reason for hiding this comment

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

TBH I don't know for sure if the "If it required expansion, it should be done already." is true, but since it only affects shaders that would otherwise crash and this bug is super hairy, LGTM. Thanks for investigating this!

@Keenuts
Copy link
Copy Markdown
Collaborator Author

Keenuts commented Mar 27, 2024

The reason is:
For constants, the AST has multiple variables with their own type.
But what we do is create a struct which contains all those constants.

Because we created this struct from scratch to contain the multiple constants we have, there is no AST type to match against.
Each field has an AST type, but the struct itself has none.

Hence why this condition: if there is no AST type, it means it's a "synthetic" type we created in the backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[SPIR-V] Silent compiler crash when using GetAttributeAtVertex

3 participants