Skip to content

spirv-opt: Add LegalizeMultidimArrayPass - #6535

Merged
s-perron merged 3 commits into
KhronosGroup:mainfrom
s-perron:legalize_multidim_arrays
Feb 11, 2026
Merged

s-perron merged 3 commits into
KhronosGroup:mainfrom
s-perron:legalize_multidim_arrays

Conversation

@s-perron

@s-perron s-perron commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

This pass transforms multidimensional arrays of resources (e.g.,
Texture2D g_Textures[2][3]) into single-dimensional arrays (e.g.,
Texture2D g_Textures[6]) and updates all access chains that reference
them.

This transformation is required for Vulkan compatibility, as multidimensional
resource arrays are not allowed in some storage classes.

Specifically, it helps avoid:

  • VUID-StandaloneSpirv-Uniform-06807
  • VUID-StandaloneSpirv-UniformConstant-04655

Fixes microsoft/DirectXShaderCompiler#7922

This pass transforms multidimensional arrays of resources (e.g.,
Texture2D g_Textures[2][3]) into single-dimensional arrays (e.g.,
Texture2D g_Textures[6]) and updates all access chains that reference
them.

This transformation is required for Vulkan compatibility, as multidimensional
resource arrays are not allowed in some storage classes.

Specifically, it helps avoid:
- VUID-StandaloneSpirv-Uniform-06807
- VUID-StandaloneSpirv-UniformConstant-04655

Fixes microsoft/DirectXShaderCompiler#7922
@s-perron
s-perron requested review from Keenuts and luciechoi February 4, 2026 20:46
Comment thread include/spirv-tools/optimizer.hpp Resolved
- Corrected spelling of 'multidimensional' and 'rejected'.
- Updated documentation and help text to recommend running
  combine-access-chains before this pass.
- Added assertion to ensure dimensions are not empty.
@s-perron
s-perron requested a review from Keenuts February 6, 2026 16:36
@s-perron
s-perron enabled auto-merge (squash) February 11, 2026 14:17
@s-perron

Copy link
Copy Markdown
Collaborator Author

The failing macos test are an infrastructure issue not related to this change. Still fails even if I rerun. The smoke test failure is related to this change. DXC tests will have to be updated now that we run the combine access chain pass.

@s-perron
s-perron disabled auto-merge February 11, 2026 14:44
@s-perron
s-perron merged commit cb38b23 into KhronosGroup:main Feb 11, 2026
8 checks passed
@s-perron
s-perron deleted the legalize_multidim_arrays branch July 13, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SPIR-V] Arrays of arrays of resources are unsupported

3 participants