From 19083925690f6180cb081ce2be4fbbdb64010b37 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Tue, 25 Feb 2025 16:32:01 +0800 Subject: Fix loading empty structs from structured buffers (#6439) Closes https://github.com/shader-slang/slang/issues/5751 --- source/slang/slang-ir-legalize-types.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source') diff --git a/source/slang/slang-ir-legalize-types.cpp b/source/slang/slang-ir-legalize-types.cpp index 172171912..9b857f899 100644 --- a/source/slang/slang-ir-legalize-types.cpp +++ b/source/slang/slang-ir-legalize-types.cpp @@ -2149,6 +2149,12 @@ static LegalVal legalizeInst( // This case should only happen when compiling for a target that does not support // GpuForeach return LegalVal(); + case kIROp_StructuredBufferLoad: + // empty types are removed, so we need to make sure that we're still + // loading a none type when we try and load from a to-be-optimized + // out structured buffer + SLANG_ASSERT(type.flavor == LegalType::Flavor::none); + return LegalVal(); default: // TODO: produce a user-visible diagnostic here SLANG_UNEXPECTED("non-simple operand(s)!"); -- cgit v1.2.3