Skip to content

[SPIR-V] ByteAddressBuffer can not get row-major matrix #7953

Open

Description

Compile this example with "-Zpr" which enable row-major matrix:

ByteAddressBuffer byte_buffer;
void foo() {
float4x4 matrix = byte_buffer.Load<float4x4>(id);
}

variable "matrix" is not treated as row-major matrix.

Activity

  1. added
    bug
    spirv
    needs-triage
    on Nov 27, 2025
  2. s-perron commented on Nov 28, 2025

    @s-perron
    Collaborator

    To make this more concrete: https://godbolt.org/z/1Pn3Kf1jM.

    ByteAddressBuffer byte_buffer;
    
    RWBuffer<float> b;
    
    void main() {
      float4x4 matrix = byte_buffer.Load<float4x4>(2);
      b[0] = matrix[2][3];
    }
    

    The access to the matrix could come from the byte_buffer as offset 11, that is (2 * 4 + 3). However, we generate:

             %18 = OpAccessChain %_ptr_Uniform_uint %byte_buffer %uint_0 %uint_14
             %19 = OpLoad %uint %18
             %20 = OpBitcast %float %19
    

    We are getting 14, which is (3*4+2).

  3. s-perron commented on Jan 19, 2026

    @s-perron
    Collaborator

    Nathan Gauër (@Keenuts) Do you think this is related to the matrix issue you found?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugspirv

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions