diff options
| author | Yong He <yonghe@outlook.com> | 2025-02-27 22:22:46 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-27 22:22:46 -0800 |
| commit | a09d554721ecf0c6d967d5f55b3416e3284e71f2 (patch) | |
| tree | bd42082eb500c7ef67bb13782bdf87362a35336a /source | |
| parent | 4872eebaa26dad7809fb6c58f5569ec64099e0c1 (diff) | |
Fix regression in float to bool conversion. (#6497)
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-ir.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index 3a7ace37d..1b0f99cd3 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -4047,7 +4047,7 @@ IRInst* IRBuilder::emitCast(IRType* type, IRInst* value, bool fallbackToBuiltinC /* From Float */ {kIROp_CastFloatToInt, kIROp_FloatCast, - {kIROp_CastFloatToInt, kIROp_IntCast}, + {kIROp_Neq}, {kIROp_CastFloatToInt, kIROp_CastIntToPtr}, kIROp_CastToVoid}, /* From Bool */ @@ -4079,6 +4079,13 @@ IRInst* IRBuilder::emitCast(IRType* type, IRInst* value, bool fallbackToBuiltinC matType->getColumnCount(), matType->getLayout()); } + + if (op.op0 == kIROp_Neq) + { + IRInst* args[2] = {value, emitDefaultConstruct(value->getDataType())}; + return emitIntrinsicInst(type, op.op0, 2, args); + } + auto result = emitIntrinsicInst(t, op.op0, 1, &value); if (op.op1 != kIROp_Nop) { |
