diff options
| author | Yong He <yonghe@outlook.com> | 2023-09-18 20:46:57 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-18 20:46:57 -0700 |
| commit | d1efc69a20d941116d1398e4471689658cd6b888 (patch) | |
| tree | 22d7e56c02cea2d125ba483089a85205bbf45c15 /source/slang/slang-emit-spirv.cpp | |
| parent | 95fcf65c38d52ed458a3b11622ea8b55a3864c24 (diff) | |
Use target-dependent pointer size in natural layout. (#3210)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-emit-spirv.cpp')
| -rw-r--r-- | source/slang/slang-emit-spirv.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp index 88fb8b0fe..b373383aa 100644 --- a/source/slang/slang-emit-spirv.cpp +++ b/source/slang/slang-emit-spirv.cpp @@ -1282,7 +1282,7 @@ struct SPIRVEmitContext else { IRSizeAndAlignment sizeAndAlignment; - getNaturalSizeAndAlignment(elementType, &sizeAndAlignment); + getNaturalSizeAndAlignment(m_targetRequest, elementType, &sizeAndAlignment); stride = (int)sizeAndAlignment.getStride(); } emitOpDecorateArrayStride( @@ -2127,9 +2127,23 @@ struct SPIRVEmitContext return emitOpUndef(parent, inst, inst->getDataType()); case kIROp_SPIRVAsm: return emitSPIRVAsm(parent, as<IRSPIRVAsm>(inst)); + case kIROp_ImageLoad: + return emitImageLoad(parent, as<IRImageLoad>(inst)); + case kIROp_ImageStore: + return emitImageStore(parent, as<IRImageStore>(inst)); } } + SpvInst* emitImageLoad(SpvInstParent* parent, IRImageLoad* load) + { + return emitInst(parent, load, SpvOpImageRead, load->getDataType(), kResultID, load->getImage(), load->getCoord()); + } + + SpvInst* emitImageStore(SpvInstParent* parent, IRImageStore* store) + { + return emitInst(parent, store, SpvOpImageWrite, store->getImage(), store->getCoord(), store->getValue()); + } + SpvInst* emitGetStringHash(IRInst* inst) { auto getStringHashInst = as<IRGetStringHash>(inst); @@ -2415,7 +2429,7 @@ struct SPIRVEmitContext } else { - getOffset(IRTypeLayoutRules::get(layoutRuleName), field, &offset); + getOffset(m_targetRequest, IRTypeLayoutRules::get(layoutRuleName), field, &offset); } emitOpMemberDecorateOffset( getSection(SpvLogicalSectionID::Annotations), @@ -2440,7 +2454,7 @@ struct SPIRVEmitContext IRIntegerValue matrixStride = 0; auto rule = IRTypeLayoutRules::get(layoutRuleName); IRSizeAndAlignment elementSizeAlignment; - getSizeAndAlignment(rule, matrixType->getElementType(), &elementSizeAlignment); + getSizeAndAlignment(m_targetRequest, rule, matrixType->getElementType(), &elementSizeAlignment); // Reminder: the meaning of row/column major layout // in our semantics is the *opposite* of what GLSL/SPIRV |
