diff options
| author | Yong He <yonghe@outlook.com> | 2023-09-26 23:56:06 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-27 14:56:06 +0800 |
| commit | ebe8ddefc48478307d5f206cd3e40c41d28a36e3 (patch) | |
| tree | 8e13977979909a26394eea532d8b95cd5ad0f6d1 /source/slang/slang-ir.cpp | |
| parent | c5c8cfbb360d9a763f549df48636effde839eacd (diff) | |
Various SPIRV fixes. (#3231)
* Various SPIRV fixes.
- Geometry shader support (WIP).
- Fix texture get dimension and load.
- Fold global GetElement(MakeArray/MakeVector) insts.
- Call spvopt to inline all functions.
- Translate OpImageSubscript.
- Emit struct member names and global variable names.
- Fix lowering of OpBitNot -> OpNot, instead of OpBitReverse.
* Fix test.
* Fix geometry shader.
* Fix geometry shader emit.
* Add atomic Image access test.
* Fix tests.
* don't fail if spirv-opt fails.
* Update comments.
* Fix test.
* Cleanups.
* indentation
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir.cpp')
| -rw-r--r-- | source/slang/slang-ir.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index ff6c8c39e..5fa558e15 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -4708,7 +4708,12 @@ namespace Slang IRInst* base, IRInst* index) { - auto inst = createInst<IRFieldAddress>( + if (auto vectorFromScalar = as<IRMakeVectorFromScalar>(base)) + return vectorFromScalar->getOperand(0); + if (base->getOp() == kIROp_MakeArrayFromElement) + return base->getOperand(0); + + auto inst = createInst<IRGetElement>( this, kIROp_GetElement, type, @@ -4737,15 +4742,8 @@ namespace Slang type = getVectorType(matrixType->getElementType(), matrixType->getColumnCount()); } SLANG_RELEASE_ASSERT(type); - auto inst = createInst<IRGetElement>( - this, - kIROp_GetElement, - type, - base, - index); - addInst(inst); - return inst; + return emitElementExtract(type, base, index); } IRInst* IRBuilder::emitElementExtract( |
