From 83c7b7c7716c31596d9e2829d4afa708ce23a182 Mon Sep 17 00:00:00 2001 From: Jerran Schmidt Date: Fri, 27 Jun 2025 02:33:16 +1000 Subject: Fix for OpUConvert producing invalid opcode when to/from signs differ (#7398) * Fix for OpUConvert outputting scalar type for mixed sign vector type conversions * Fix compiler warning * Added regression test for UConvert vector fix * Formatting * getUnsignedType helper * Formatting * Fix for addtional int types * Helper function to convert signed type to unsigned type --- source/slang/slang-emit-spirv.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'source/slang/slang-emit-spirv.cpp') diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp index 7bd20649b..82fb39d7d 100644 --- a/source/slang/slang-emit-spirv.cpp +++ b/source/slang/slang-emit-spirv.cpp @@ -7319,11 +7319,9 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex // Perform unsigned conversion first to an unsigned integer of the same width as the // result then perform bit cast to the signed result type. This is done because SPIRV's // unsigned conversion (`OpUConvert`) requires result type to be unsigned. - auto unsignedV = emitOpUConvert( - parent, - nullptr, - builder.getType(getOppositeSignIntTypeOp(toType->getOp())), - inst->getOperand(0)); + auto builderType = getUnsignedTypeFromSignedType(&builder, toTypeV); + + auto unsignedV = emitOpUConvert(parent, nullptr, builderType, inst->getOperand(0)); return emitOpBitcast(parent, inst, toTypeV, unsignedV); } else if (fromInfo.isSigned) -- cgit v1.2.3