summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-spirv.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-07-11 16:54:43 -0700
committerGitHub <noreply@github.com>2025-07-11 23:54:43 +0000
commit1e1a49ccf595dcc99bd9792a47199ec89d5b4370 (patch)
tree199dca9cc2c5f27466ebd8b6e9e6fcd8328db9fa /source/slang/slang-emit-spirv.cpp
parentd8d0b8969f731990820f25812f3d90ee4dd1ee75 (diff)
Fixup address spaces after inlining. (#7731)
* Fixup address spaces after inlining. * add -O0
Diffstat (limited to 'source/slang/slang-emit-spirv.cpp')
-rw-r--r--source/slang/slang-emit-spirv.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp
index 376a828cd..b9627e1ee 100644
--- a/source/slang/slang-emit-spirv.cpp
+++ b/source/slang/slang-emit-spirv.cpp
@@ -6848,15 +6848,14 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex
{
baseStructType = as<IRStructType>(ptrType->getValueType());
baseId = getID(ensureInst(base));
+ SLANG_ASSERT(
+ as<IRPtrTypeBase>(fieldAddress->getFullType())->getAddressSpace() ==
+ ptrType->getAddressSpace() &&
+ "field_address requires base and result to have same address space.");
}
else
{
- baseStructType = as<IRStructType>(base->getDataType());
-
- auto structPtrType = builder.getPtrType(baseStructType);
- auto varInst = emitOpVariable(parent, nullptr, structPtrType, SpvStorageClassFunction);
- emitOpStore(parent, nullptr, varInst, base);
- baseId = getID(varInst);
+ SLANG_UNEXPECTED("field_address requires base to be an address.");
}
SLANG_ASSERT(baseStructType && "field_address requires base to be a struct.");
auto fieldId = emitIntConstant(