Skip to content

Invalid SPIR-V when mixing ParamBlock<Foo> and ParamBlock<Foo[N]> #9575

@h3r2tic

Description

@h3r2tic

Issue Description

When you use the same struct as both ParameterBlock<Foo> and ParameterBlock<Foo[N]> where N is a constexpr integer, the generated SPIR-V is invalid.

Reproducer Code

struct View {
    float foo;
}

ParameterBlock<View> main_view;
ParameterBlock<View[3]> shadow_views;

[shader("fragment")]
float main() {
    return main_view.foo + shadow_views[0].foo;
}

Expected Behavior

The SPIR-V should be valid.

Actual Behavior

slangc a.slang -target spirv -o out.spv && spirv-val out.spv
error: line 33: rules: A Block or BufferBlock cannot be nested within another Block or BufferBlock. 
  %_Array_std140_View3 = OpTypeStruct %_arr_View_std140_int_3

Environment

  • Slang Version: 2025.21.2, 2025.24.3
  • OS: Linux 6.18.2-arch2-1 x86_64

Additional context

Probably closely related to #7431

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions