diff options
Diffstat (limited to 'source/slang/slang-emit-spirv.cpp')
| -rw-r--r-- | source/slang/slang-emit-spirv.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp index b9627e1ee..2b6f1c821 100644 --- a/source/slang/slang-emit-spirv.cpp +++ b/source/slang/slang-emit-spirv.cpp @@ -7374,6 +7374,12 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex SLANG_ASSERT(isIntegralType(fromType)); SLANG_ASSERT(isIntegralType(toType)); + if (isTypeEqual(fromType, toType)) + { + auto inner = ensureInst(inst->getOperand(0)); + registerInst(inst, inner); + return inner; + } const auto fromInfo = getIntTypeInfo(fromType); const auto toInfo = getIntTypeInfo(toType); @@ -7491,7 +7497,12 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex SLANG_ASSERT(isFloatingType(fromType)); SLANG_ASSERT(isFloatingType(toType)); - SLANG_ASSERT(!isTypeEqual(fromType, toType)); + if (isTypeEqual(fromType, toType)) + { + auto inner = ensureInst(inst->getOperand(0)); + registerInst(inst, inner); + return inner; + } if (isMatrixCast) { |
