diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2023-04-13 23:49:00 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-13 08:49:00 -0700 |
| commit | c7e5601bb67d2a5ebadb7f84c6968b5912e7566d (patch) | |
| tree | 311903d485d42617288198ea45f46c50e150f082 /source/slang/slang-ir.cpp | |
| parent | 6fbd892a0e015fd07d1c41983676713aa6f09333 (diff) | |
Matrix swizzle writes (#2713)
* Add a bunch of builder emit wrappers for constant indices
To avoid cluttering any calling code with int instruction construction
* Matrix swizzle stores
Closes https://github.com/shader-slang/slang/issues/2512
* Matrix swizzle store tests
* Squash vs warnings
* Select scalar for singular swizzles
* Test singular swizzle materialization
* Use IRIntegerValue over UInt for IR wrappers
* Correct size of swizzle vector type
* Remove variable shadowing
Diffstat (limited to 'source/slang/slang-ir.cpp')
| -rw-r--r-- | source/slang/slang-ir.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index bd2271953..e624ef1fd 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -2809,6 +2809,13 @@ namespace Slang operands); } + IRVectorType* IRBuilder::getVectorType( + IRType* elementType, + IRIntegerValue elementCount) + { + return getVectorType(elementType, getIntValue(getIntType(), elementCount)); + } + IRMatrixType* IRBuilder::getMatrixType( IRType* elementType, IRInst* rowCount, @@ -4607,6 +4614,13 @@ namespace Slang IRInst* IRBuilder::emitElementExtract( IRInst* base, + IRIntegerValue index) + { + return emitElementExtract(base, getIntValue(getIntType(), index)); + } + + IRInst* IRBuilder::emitElementExtract( + IRInst* base, const ArrayView<IRInst*>& accessChain) { for (auto access : accessChain) @@ -4653,6 +4667,13 @@ namespace Slang IRInst* IRBuilder::emitElementAddress( IRInst* basePtr, + IRIntegerValue index) + { + return emitElementAddress(basePtr, getIntValue(getIntType(), index)); + } + + IRInst* IRBuilder::emitElementAddress( + IRInst* basePtr, IRInst* index) { IRType* type = nullptr; @@ -4726,6 +4747,11 @@ namespace Slang return inst; } + IRInst* IRBuilder::emitUpdateElement(IRInst* base, IRIntegerValue index, IRInst* newElement) + { + return emitUpdateElement(base, getIntValue(getIntType(), index), newElement); + } + IRInst* IRBuilder::emitUpdateElement(IRInst* base, const List<IRInst*>& accessChain, IRInst* newElement) { List<IRInst*> args; |
