KhronosGroup / KhronosGroup/glslang

Validate buffer_reference_align is multiple of largest block scalar

Open
#4,021 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
3.6k
Forks
989
Avg merge
1d 2h
Merged PRs (30d)
31

Description

inside https://github.com/KhronosGroup/GLSL/blob/main/extensions/ext/GLSL_EXT_buffer_reference.txt it says

> Each buffer reference type has an alignment that can be specified via
the "buffer_reference_align" layout qualifier. This must be a power of
two and be greater than or equal to the largest scalar/component type
in the block.

But the following is valid and should be throwing an error (https://godbolt.org/z/sxs8KP8MG)

```glsl
layout(buffer_reference, buffer_reference_align = 2) buffer Ptr {
uint x;
};
```

(Note - This is currently VU `06314` in Vulkan and I plan to add to `spirv-val` now, but would be nice to have GLSL catch it sooner)

Contributor guide

Open the contributing guide

Research direction

Read the buffer_reference_align rules in extensions/ext/GLSL_EXT_buffer_reference.txt and reproduce the issue with the linked GLSL example. Trace how glslang validates this layout qualifier and compare the result with Vulkan VU 06314 and spirv-val. Done means the invalid alignment is rejected by GLSL validation, with coverage for the reproducer.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.