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/ir.cpp | |
| parent | 0399d992e21128a2c4b676e8f5456981ccfa6469 (diff) | |
| parent | 384df864fdd2c518924d32295a13894f16295d43 (diff) | |
Merge branch 'master' into master
Diffstat (limited to 'source/slang/ir.cpp')
| -rw-r--r-- | source/slang/ir.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/source/slang/ir.cpp b/source/slang/ir.cpp index a4a118250..53050b6b9 100644 --- a/source/slang/ir.cpp +++ b/source/slang/ir.cpp @@ -2033,6 +2033,45 @@ namespace Slang return emitSwizzleSet(type, base, source, elementCount, irElementIndices); } + IRInst* IRBuilder::emitSwizzledStore( + IRInst* dest, + IRInst* source, + UInt elementCount, + IRInst* const* elementIndices) + { + IRInst* fixedArgs[] = { dest, source }; + UInt fixedArgCount = sizeof(fixedArgs) / sizeof(fixedArgs[0]); + + auto inst = createInstImpl<IRSwizzledStore>( + this, + kIROp_SwizzledStore, + nullptr, + fixedArgCount, + fixedArgs, + elementCount, + elementIndices); + + addInst(inst); + return inst; + } + + IRInst* IRBuilder::emitSwizzledStore( + IRInst* dest, + IRInst* source, + UInt elementCount, + UInt const* elementIndices) + { + auto intType = getBasicType(BaseType::Int); + + IRInst* irElementIndices[4]; + for (UInt ii = 0; ii < elementCount; ++ii) + { + irElementIndices[ii] = getIntValue(intType, elementIndices[ii]); + } + + return emitSwizzledStore(dest, source, elementCount, irElementIndices); + } + IRInst* IRBuilder::emitReturn( IRInst* val) { |
