Repository: shader-slang/slang
File: source/slang/slang-emit-spirv.cpp (C++)

Code before:
            break;
        case kIROp_Swizzle:
            result = emitSwizzle(parent, as<IRSwizzle>(inst));
            break;
        case kIROp_IntCast:
            result = emitIntCast(parent, as<IRIntCast>(inst));
            break;
        case kIROp_FloatCast:
            result = emitFloatCast(parent, as<IRFloatCast>(inst));
            break;
        case kIROp_CastIntToFloat:
            result = emitIntToFloatCast(parent, as<IRCastIntToFloat>(inst));
            break;
        case kIROp_CastFloatToInt:
            result = emitFloatToIntCast(parent, as<IRCastFloatToInt>(inst));
            break;
        case kIROp_CastPtrToInt:
            result = emitCastPtrToInt(parent, inst);
            break;
        case kIROp_CastPtrToBool:
            result = emitCastPtrToBool(parent, inst);
            break;
        case kIROp_CastIntToPtr:
            result = emitCastIntToPtr(parent, inst);
            break;
        case kIROp_BuiltinCast:
            result = emitBuiltinCast(parent, inst);
            break;
        case kIROp_PtrCast:
        case kIROp_BitCast:
            result = emitOpBitcast(parent, inst, inst->getDataType(), inst->getOperand(0));
            break;
        case kIROp_CopyLogical:
            result = emitCopyLogical(parent, as<IRCopyLogical>(inst));
            break;
        case kIROp_BitfieldExtract:
            result = emitBitfieldExtract(parent, inst);
            break;
        case kIROp_BitfieldInsert:
            result = emitBitfieldInsert(parent, inst);
            break;
        case kIROp_MakeUInt64:
            result = emitMakeUInt64(parent, inst);
            break;
        case kIROp_Add:
        case kIROp_Sub:
        case kIROp_Mul:
        case kIROp_Div:
        case kIROp_IRem:
        case kIROp_FRem:
        case kIROp_Neg:

Review comment (suggestion):
I think we need to handle this at IR level instead of spirv.
If we compile the original shader to hlsl, the error will be still there.

Code after:
            break;
        case kIROp_MakeMatrix:
            result = emitMakeMatrix(parent, inst);
            break;
        case kIROp_Load:
            result = emitLoad(parent, as<IRLoad>(inst));
            break;
        case kIROp_Store:
            result = emitStore(parent, as<IRStore>(inst));
            break;
        case kIROp_SwizzledStore:
            result = emitSwizzledStore(parent, as<IRSwizzledStore>(inst));
            break;
        case kIROp_SwizzleSet:
            result = emitSwizzleSet(parent, as<IRSwizzleSet>(inst));
            break;
        case kIROp_RWStructuredBufferGetElementPtr:
            result = emitStructuredBufferGetElementPtr(parent, inst);
            break;
        case kIROp_StructuredBufferGetDimensions:
            result = emitStructuredBufferGetDimensions(parent, inst);
            break;
        case kIROp_GetStructuredBufferPtr:
        case kIROp_GetUntypedBufferPtr:
            result = emitGetBufferPtr(parent, inst);
            break;
        case kIROp_Swizzle:
            result = emitSwizzle(parent, as<IRSwizzle>(inst));
            break;
        case kIROp_IntCast:
            result = emitIntCast(parent, as<IRIntCast>(inst));
            break;
        case kIROp_FloatCast:
            result = emitFloatCast(parent, as<IRFloatCast>(inst));
            break;
        case kIROp_CastIntToFloat:
            result = emitIntToFloatCast(parent, as<IRCastIntToFloat>(inst));
            break;
        case kIROp_CastFloatToInt:
            result = emitFloatToIntCast(parent, as<IRCastFloatToInt>(inst));
            break;
        case kIROp_CastPtrToInt:
            result = emitCastPtrToInt(parent, inst);
            break;
        case kIROp_CastPtrToBool:
            result = emitCastPtrToBool(parent, inst);
            break;
        case kIROp_CastIntToPtr:
            result = emitCastIntToPtr(parent, inst);
            break;
        case kIROp_PtrCast: