From 1e1a49ccf595dcc99bd9792a47199ec89d5b4370 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 11 Jul 2025 16:54:43 -0700 Subject: Fixup address spaces after inlining. (#7731) * Fixup address spaces after inlining. * add -O0 --- source/slang/slang-emit-spirv.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'source/slang/slang-emit-spirv.cpp') 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(ptrType->getValueType()); baseId = getID(ensureInst(base)); + SLANG_ASSERT( + as(fieldAddress->getFullType())->getAddressSpace() == + ptrType->getAddressSpace() && + "field_address requires base and result to have same address space."); } else { - baseStructType = as(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( -- cgit v1.2.3