KhronosGroup / KhronosGroup/SPIRV-Tools

spirv-val layout bug

Open
#3,763 7 comments 0 reactions 0 assignees View on GitHub
component:validation
Dominant language
C++
Stars
1.4k
Forks
709
Avg merge
1d 22h
Merged PRs (30d)
28

Description

spirv-val flat out doesn't support GL_EXT_scalar_block_layout.

```cpp
#version 450
#extension GL_EXT_scalar_block_layout : enable

struct inner_t {
float x, y;
};

layout(binding=0, scalar)
uniform Uniform {
inner_t a, b;
} uniforms;

layout(location=0)
out vec4 color;

void main() {
color.x = uniforms.a.x;
}
```
error: line 34: Structure id 11 decorated as Block for variable in Uniform storage class must follow standard uniform buffer layout rules: member 1 at offset 8 is not aligned to 16
%Uniform = OpTypeStruct %inner_t %inner_t

spirv-val is insisting on 16 byte alignment for all struct members. glslc is emitting struct members aligned to their largest aligned type, which layout(scalar) is used.

Contributor guide

Open the contributing guide

Research direction

Use the provided GLSL example as the reproducer and inspect spirv-val's handling of Uniform block layout rules. Compare its result with glslc's scalar-layout output; done means the example no longer reports the 16-byte alignment error while standard layout validation remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.