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

[SPIR-V] Invalid generated SPIR-V when nesting HLSL 2021 and intrinsic. #6995

Open
Mr-Wiseguy opened this issue Nov 1, 2024 · 1 comment
Assignees
Labels
bug Bug, regression, crash spirv Work related to SPIR-V
Milestone

Comments

@Mr-Wiseguy
Copy link

Description
In an attempt to minimize branching in our HLSL 2021 shader code, we have been converting boolean operators to use the and intrinsic from HLSL 2021 that doesn't short circuit. However, when nesting two calls to and, we get the following error:
fatal error: generated SPIR-V is invalid: Expected both operands to be of Result Type: LogicalAnd

Steps to Reproduce
https://shader-playground.timjones.io/a2afd625eb79aac130756befae206296
https://godbolt.org/z/vfn3Kxc7W

Environment

  • Tested latest July 2024 release and latest trunk on godbolt (5704c47)
@Mr-Wiseguy Mr-Wiseguy added bug Bug, regression, crash needs-triage Awaiting triage spirv Work related to SPIR-V labels Nov 1, 2024
@damyanp damyanp moved this to For Google in HLSL Triage Nov 5, 2024
@s-perron
Copy link
Collaborator

This is incorrect even with just a single and (https://godbolt.org/z/Te48c9zzz). The AST for the call to and is:

  |         |-ImplicitCastExpr 0x56546c5b52c8 <col:12> 'bool (*)(int, int)' <FunctionToPointerDecay>
  |         | `-DeclRefExpr 0x56546c5b5260 <col:12> 'bool (int, int)' lvalue Function 0x56546c5b5048 'and' 'bool (int, int)'

It treats the parameters as integers. However, the spir-v instruction takes bools. Should be an easy fix.

@s-perron s-perron added this to the Next Release milestone Nov 18, 2024
@s-perron s-perron self-assigned this Nov 18, 2024
@s-perron s-perron removed the needs-triage Awaiting triage label Nov 18, 2024
@s-perron s-perron moved this from For Google to Triaged in HLSL Triage Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, regression, crash spirv Work related to SPIR-V
Projects
Status: New
Status: Triaged
Development

No branches or pull requests

2 participants