diff options
| author | Yong He <yonghe@outlook.com> | 2018-05-02 20:39:10 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-02 20:39:10 -0400 |
| commit | 235d6aac8a78e9ecc2f1fb1e17d1f61c3f592b76 (patch) | |
| tree | d516c031a4e927aa5444bfa1d1a158f58e957050 /source/slang/emit.cpp | |
| parent | 0399d992e21128a2c4b676e8f5456981ccfa6469 (diff) | |
| parent | 384df864fdd2c518924d32295a13894f16295d43 (diff) | |
Merge branch 'master' into master
Diffstat (limited to 'source/slang/emit.cpp')
| -rw-r--r-- | source/slang/emit.cpp | 25 |
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; } } |
