diff options
| author | Darren Wihandi <65404740+fairywreath@users.noreply.github.com> | 2025-05-30 01:04:27 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-29 22:04:27 -0700 |
| commit | aa3e6bdbe024355b07f6a61806024b248528fe4b (patch) | |
| tree | 3f11539df4dfd0dfcb7df2b4e7ce877ab9b84179 /source/slang/slang-emit-spirv.cpp | |
| parent | 61f66c116ab10fdfd37492056aab7dfa4276a0b7 (diff) | |
Fix SPIRV `OpSpecConstantOp` emit (#7158)
* Fix SPIRV specialization constant with floating-point operations
* Improve test
* WIP
* Restrict `OpSpecConstantOp` allowed operations based on SPIRV specifications
* Fix typo on floating type check
* Emit error on float to int spec cosnt int val casts
Diffstat (limited to 'source/slang/slang-emit-spirv.cpp')
| -rw-r--r-- | source/slang/slang-emit-spirv.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp index 57ad1a988..0a3dab78a 100644 --- a/source/slang/slang-emit-spirv.cpp +++ b/source/slang/slang-emit-spirv.cpp @@ -784,18 +784,9 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex switch (irOpCode) { case kIROp_IntCast: - { - auto typeStyle = getTypeStyle(basicType->getBaseType()); - if (typeStyle == kIROp_FloatType) - { - return SpvOpConvertFToU; - } - else if (typeStyle == kIROp_IntType) - { - return SpvOpUConvert; - } - break; - } + return SpvOpUConvert; + case kIROp_FloatCast: + return SpvOpFConvert; default: break; } |
