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.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp
index be6112abe..9f9a089c8 100644
--- a/source/slang/emit.cpp
+++ b/source/slang/emit.cpp
@@ -3317,6 +3317,31 @@ struct EmitVisitor
emit(";\n");
}
break;
+
+ case kIROp_SwizzledStore:
+ {
+ auto ii = cast<IRSwizzledStore>(inst);
+ emit("(");
+ emitIROperand(ctx, ii->getDest(), mode);
+ emit(").");
+ UInt elementCount = ii->getElementCount();
+ for (UInt ee = 0; ee < elementCount; ++ee)
+ {
+ IRInst* irElementIndex = ii->getElementIndex(ee);
+ assert(irElementIndex->op == kIROp_IntLit);
+ IRConstant* irConst = (IRConstant*)irElementIndex;
+
+ UInt elementIndex = (UInt)irConst->u.intVal;
+ assert(elementIndex < 4);
+
+ char const* kComponents[] = { "x", "y", "z", "w" };
+ emit(kComponents[elementIndex]);
+ }
+ emit(" = ");
+ emitIROperand(ctx, ii->getSource(), mode);
+ emit(";\n");
+ }
+ break;
}
}