Skip to content

Setting the wrong alignment value when loading a Buffer Reference through a Buffer Reference #4084

@spencer-lunarg

Description

@spencer-lunarg

https://godbolt.org/z/j8jGvsnMh

layout(buffer_reference) buffer S4;

layout(buffer_reference, buffer_reference_align = 8, std430) readonly buffer S3 {
    S4 e;
};

// Set buffer_reference_align to 8 and it generates valid code
layout(buffer_reference, buffer_reference_align = 4, std430) readonly buffer S4 {
    uint f;
};

void main() {    
    S3 x;
    S4 y = x.e;
}

Seems currently glslang sets the x.e as an OpLoad with a result type of OpTypePointer but the Aligned 4 is wrong and should be 8 and produces a spirv-val error (https://godbolt.org/z/sxT1asEdv)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions