diff options
| author | Darren Wihandi <65404740+fairywreath@users.noreply.github.com> | 2025-05-16 15:01:24 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-16 12:01:24 -0700 |
| commit | da951e06e7eb8ad1b9c91d6176be8165ea4f2b45 (patch) | |
| tree | 84df8551021ad8806531fc2ed59058f65fbfa256 /source/slang/slang-ir-lower-buffer-element-type.cpp | |
| parent | 0244c96d637f47fa264d441a82d3dca78889373b (diff) | |
Address structured buffer `GetDimensions` issues for WGSL, GLSL and SPIRV (#7010)
* Fix structured buffer get dimensions
* Further fixes and added tests
* Remove unnecessary include
* Fix test issues
* attempt to fix wgpu crash
* test remove half usage in test
* attempt to fix WGPU test issue
* Another attempt to fix WGSL test - make test similar to the existing GetDimensions test
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-ir-lower-buffer-element-type.cpp')
| -rw-r--r-- | source/slang/slang-ir-lower-buffer-element-type.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/slang/slang-ir-lower-buffer-element-type.cpp b/source/slang/slang-ir-lower-buffer-element-type.cpp index 1294b400d..ed0a3b309 100644 --- a/source/slang/slang-ir-lower-buffer-element-type.cpp +++ b/source/slang/slang-ir-lower-buffer-element-type.cpp @@ -939,11 +939,25 @@ struct LoweredElementTypeContext } } if (auto structBuffer = as<IRHLSLStructuredBufferTypeBase>(globalInst)) + { elementType = structBuffer->getElementType(); + auto config = getTypeLoweringConfigForBuffer(target, structBuffer); + + // Create size and alignment decoration for potential use + // in`StructuredBufferGetDimensions`. + IRSizeAndAlignment sizeAlignment; + getSizeAndAlignment( + target->getOptionSet(), + config.layoutRule, + elementType, + &sizeAlignment); + SLANG_UNUSED(sizeAlignment); + } else if (auto constBuffer = as<IRUniformParameterGroupType>(globalInst)) elementType = constBuffer->getElementType(); else if (auto storageBuffer = as<IRGLSLShaderStorageBufferType>(globalInst)) elementType = storageBuffer->getElementType(); + if (as<IRTextureBufferType>(globalInst)) continue; if (!as<IRStructType>(elementType) && !as<IRMatrixType>(elementType) && |
