summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2025-02-25 16:32:01 +0800
committerGitHub <noreply@github.com>2025-02-25 16:32:01 +0800
commit19083925690f6180cb081ce2be4fbbdb64010b37 (patch)
tree821487487177f55b2b1002407e54a11b63346f3d /source
parentf90a7631a10d7dcc1427bfda85f66c539c50af5d (diff)
Fix loading empty structs from structured buffers (#6439)
Closes https://github.com/shader-slang/slang/issues/5751
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-ir-legalize-types.cpp6
1 files changed, 6 insertions, 0 deletions
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)!");