diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2024-02-03 10:14:04 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-02 18:14:04 -0800 |
| commit | a67cb0609587c230746b52567ff5775cab215220 (patch) | |
| tree | af943e2926c7279fb825ead81d74e4fe0f55795d /source/slang/slang-ir-layout.cpp | |
| parent | 6c8626c171a0bc40e8f2d3a15b0563d4085431c1 (diff) | |
GLSL Passthrough support for SSBO types (#3446)
* GLSL Passthrough support for SSBO types
* GLSL Passthrough support for SSBO types
* Correctly apply glsl local size layout to entry points during lowering
* Test for glsl layout correctness
* typo
* Reflect GLSL SSBO as raw buffers
* Functional test for glsl ssbo
* Allow allow glsl for render tests
* Functional test for ssbo passthrough
* Functional test for ssbo passthrough with spirv-direct
* fix windows build error
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-ir-layout.cpp')
| -rw-r--r-- | source/slang/slang-ir-layout.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/slang/slang-ir-layout.cpp b/source/slang/slang-ir-layout.cpp index a6684c7b1..9bbdb1aef 100644 --- a/source/slang/slang-ir-layout.cpp +++ b/source/slang/slang-ir-layout.cpp @@ -152,10 +152,18 @@ case kIROp_##TYPE##Type: \ auto structType = cast<IRStructType>(type); IRSizeAndAlignment structLayout; IRIntegerValue offset = 0; + bool seenFinalUnsizedArrayField = false; for (auto field : structType->getFields()) { + // If we failed to catch an unsized array earlier in the pipeline, + // this will pick it up before generating nonsense results for + // subsequent offsets + SLANG_ASSERT(!seenFinalUnsizedArrayField); + IRSizeAndAlignment fieldTypeLayout; SLANG_RETURN_ON_FAIL(getSizeAndAlignment(target, rules, field->getFieldType(), &fieldTypeLayout)); + seenFinalUnsizedArrayField = fieldTypeLayout.size == IRSizeAndAlignment::kIndeterminateSize; + structLayout.size = align(offset, fieldTypeLayout.alignment); structLayout.alignment = std::max(structLayout.alignment, fieldTypeLayout.alignment); @@ -202,6 +210,15 @@ case kIROp_##TYPE##Type: \ } break; + case kIROp_UnsizedArrayType: + { + auto unsizedArrayType = cast<IRUnsizedArrayType>(type); + getSizeAndAlignment(target, rules, unsizedArrayType->getElementType(), outSizeAndAlignment); + outSizeAndAlignment->size = IRSizeAndAlignment::kIndeterminateSize; + return SLANG_OK; + } + break; + case kIROp_VectorType: { auto vecType = cast<IRVectorType>(type); |
