|
@@ -5968,12 +5968,15 @@ SpirvEmitter::tryToGenFloatVectorScale(const BinaryOperator *expr) {
|
|
|
if (const auto *cast = dyn_cast<ImplicitCastExpr>(rhs)) {
|
|
|
if (cast->getCastKind() == CK_HLSLVectorSplat) {
|
|
|
const QualType vecType = expr->getType();
|
|
|
- if (isa<CompoundAssignOperator>(expr)) {
|
|
|
+ if (const auto *compoundAssignExpr =
|
|
|
+ dyn_cast<CompoundAssignOperator>(expr)) {
|
|
|
+ const auto computationType =
|
|
|
+ compoundAssignExpr->getComputationLHSType();
|
|
|
SpirvInstruction *lhsPtr = nullptr;
|
|
|
- auto *result =
|
|
|
- processBinaryOp(lhs, cast->getSubExpr(), expr->getOpcode(),
|
|
|
- vecType, vecType, range, expr->getOperatorLoc(),
|
|
|
- &lhsPtr, spv::Op::OpVectorTimesScalar);
|
|
|
+ auto *result = processBinaryOp(lhs, cast->getSubExpr(),
|
|
|
+ expr->getOpcode(), computationType,
|
|
|
+ vecType, range, expr->getOperatorLoc(),
|
|
|
+ &lhsPtr, spv::Op::OpVectorTimesScalar);
|
|
|
return processAssignment(lhs, result, true, lhsPtr);
|
|
|
} else {
|
|
|
return processBinaryOp(lhs, cast->getSubExpr(), expr->getOpcode(),
|
|
@@ -6036,11 +6039,14 @@ SpirvEmitter::tryToGenFloatMatrixScale(const BinaryOperator *expr) {
|
|
|
if (cast->getCastKind() == CK_HLSLMatrixSplat) {
|
|
|
const QualType matType = expr->getType();
|
|
|
const spv::Op opcode = selectOpcode(lhsType);
|
|
|
- if (isa<CompoundAssignOperator>(expr)) {
|
|
|
+ if (const auto *compoundAssignExpr =
|
|
|
+ dyn_cast<CompoundAssignOperator>(expr)) {
|
|
|
+ const auto computationType =
|
|
|
+ compoundAssignExpr->getComputationLHSType();
|
|
|
SpirvInstruction *lhsPtr = nullptr;
|
|
|
auto *result = processBinaryOp(
|
|
|
- lhs, cast->getSubExpr(), expr->getOpcode(), matType, matType,
|
|
|
- range, expr->getOperatorLoc(), &lhsPtr, opcode);
|
|
|
+ lhs, cast->getSubExpr(), expr->getOpcode(), computationType,
|
|
|
+ matType, range, expr->getOperatorLoc(), &lhsPtr, opcode);
|
|
|
return processAssignment(lhs, result, true, lhsPtr);
|
|
|
} else {
|
|
|
return processBinaryOp(lhs, cast->getSubExpr(), expr->getOpcode(),
|