diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/emit.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index f8d90bc2e..bb9a6ad8b 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -3596,17 +3596,25 @@ struct EmitVisitor // Simple constructor call if( getTarget(ctx) == CodeGenTarget::HLSL ) { + auto prec = kEOp_Prefix; + needClose = maybeEmitParens(outerPrec, prec); + emit("("); emitIRType(ctx, inst->getDataType()); emit(")"); + + emitIROperand(ctx, inst->getOperand(0), mode, rightSide(outerPrec,prec)); } else { + auto prec = kEOp_Postfix; + needClose = maybeEmitParens(outerPrec, prec); + emitIRType(ctx, inst->getDataType()); + emit("("); + emitIROperand(ctx, inst->getOperand(0), mode, kEOp_General); + emit(")"); } - emit("("); - emitIROperand(ctx, inst->getOperand(0), mode, kEOp_General); - emit(")"); break; case kIROp_FieldExtract: |
