From c701ec00ccce6dfa8094d6550ce2db929fc8cefe Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 1 Jul 2025 19:09:29 -0700 Subject: Defer immutable buffer loads when emitting spirv. (#7579) * Defer immutable buffer loads when emitting spirv. * Fix. * Fix. * Fix. * Fix tests. * Fix test. --- source/slang/slang-ir.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/slang/slang-ir.cpp') diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index dc25b1489..7c687f4f1 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -5107,6 +5107,20 @@ IRInst* IRBuilder::emitLoad(IRType* type, IRInst* ptr, IRInst* align) return inst; } +IRInst* IRBuilder::emitLoad(IRType* type, IRInst* ptr, IRAlignedAttr* align) +{ + if (align) + { + auto inst = createInst(this, kIROp_Load, type, ptr, align); + addInst(inst); + return inst; + } + else + { + return emitLoad(type, ptr); + } +} + IRInst* IRBuilder::emitLoad(IRInst* ptr) { // Note: a `load` operation does not consider the rate -- cgit v1.2.3