diff options
| author | 16-Bit-Dog <67922228+16-Bit-Dog@users.noreply.github.com> | 2025-04-28 23:06:16 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-29 03:06:16 +0000 |
| commit | b02771f235909fb9399bd3969dbea0d4115ae016 (patch) | |
| tree | 05ce0c3e7de1a7bfc6d7e8e3e75602c50a816bce /source | |
| parent | c39c29bf4c52a85d7c83cc8b66ae45e265f9e078 (diff) | |
Support use of `this` with Mesh Shader Outputs (`IRMeshOutputRef`) (#6920)
* Support `this` use of `IRMeshOutputRef`
* Fix SPIR-V val error
There was a type mismatch causing a spir-v failiure: `store(var, var)` instead of `store(var, load(var))`
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-ir-glsl-legalize.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/slang/slang-ir-glsl-legalize.cpp b/source/slang/slang-ir-glsl-legalize.cpp index 729802f4e..1223ea91c 100644 --- a/source/slang/slang-ir-glsl-legalize.cpp +++ b/source/slang/slang-ir-glsl-legalize.cpp @@ -2810,6 +2810,16 @@ static void legalizeMeshOutputParam( builder->setInsertAfter(c); assign(builder, d, ScalarizedVal::value(builder->emitLoad(tmp))); } + else if (const auto load = as<IRLoad>(s)) + { + // Handles the case where a `this` points to a IRMeshOutputRef. + auto t = as<IRPtrType>(load->getPtr()->getDataType())->getValueType(); + auto tmp = builder->emitVar(t); + assign(builder, ScalarizedVal::address(tmp), d); + + s->replaceUsesWith(builder->emitLoad(tmp)); + s->removeAndDeallocate(); + } else if (const auto swiz = as<IRSwizzledStore>(s)) { SLANG_UNEXPECTED("Swizzled store to a non-address ScalarizedVal"); |
