summaryrefslogtreecommitdiffstats
path: root/source/slang/emit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/emit.cpp')
-rw-r--r--source/slang/emit.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp
index 22b503b59..15f295740 100644
--- a/source/slang/emit.cpp
+++ b/source/slang/emit.cpp
@@ -3073,9 +3073,10 @@ struct EmitVisitor
// because GLSL uses infix `*` to express inner product
// when working with matrices.
case kIROp_Mul:
- // Are we targetting GLSL, and is this a matrix product?
+ // Are we targetting GLSL, and are both operands matrices?
if(getTarget(ctx) == CodeGenTarget::GLSL
- && inst->type->As<MatrixExpressionType>())
+ && inst->getOperand(0)->type->As<MatrixExpressionType>()
+ && inst->getOperand(1)->type->As<MatrixExpressionType>())
{
emit("matrixCompMult(");
emitIROperand(ctx, inst->getOperand(0), mode);
@@ -3182,6 +3183,17 @@ struct EmitVisitor
case kIROp_getElement:
case kIROp_getElementPtr:
+ // HACK: deal with translation of GLSL geometry shader input arrays.
+ if(auto decoration = inst->getOperand(0)->findDecoration<IRGLSLOuterArrayDecoration>())
+ {
+ emit(decoration->outerArrayName);
+ emit("[");
+ emitIROperand(ctx, inst->getOperand(1), mode);
+ emit("].");
+ emitIROperand(ctx, inst->getOperand(0), mode);
+ break;
+ }
+
emitIROperand(ctx, inst->getOperand(0), mode);
emit("[");
emitIROperand(ctx, inst->getOperand(1), mode);
@@ -5331,7 +5343,11 @@ struct EmitVisitor
if(fieldType->Equals(getSession()->getVoidType()))
continue;
- emitInterpolationModifiers(ctx, ff.getDecl(), fieldType);
+ // Note: GLSL doesn't support interpolation modifiers on `struct` fields
+ if( ctx->shared->target != CodeGenTarget::GLSL )
+ {
+ emitInterpolationModifiers(ctx, ff.getDecl(), fieldType);
+ }
emitIRType(ctx, fieldType, getIRName(ff));
EmitSemantics(ff.getDecl());