KhronosGroup / KhronosGroup/glslang

[XFB] Fail to validate XfbOffset, XfbStride for array of interface blocks

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

Description

With an array of interface blocks, each interface block is captured by a separate xfb_buffer.

```
#version 450

precision mediump int;
precision mediump float;

// write to buffer 0, buffer 1
layout(location = 0, xfb_buffer = 0, xfb_stride = 8, xfb_offset = 0) out B
{
int i0;
uint u0;
} b[2];

// collide b[1].i0
layout(location = 4, xfb_buffer = 1, xfb_stride = 4, xfb_offset = 0) out float var;

void main()
{
b[0].i0 = 1;
b[0].u0 = 1;
b[1].i0 = 2;
b[1].u0 = 2;
var = 0.5;
}
```
In the above example, I think buffer 0 and buffer 1 should have the same XFB stride.
Another issue is that xfb_offset of "var" also overlapped "b[1].i0".
In GLSL spec 4.6, no clear description for the 1st issue in the section for transform feedback layout qualifiers. The 2nd issue can be reported at compile-time or link-time (aliasing).

Could glslang report the 1st issue at compile-time?

Contributor guide

Open the contributing guide

Research direction

Reproduce the shader in the issue with glslang and inspect the transform-feedback layout qualifier validation path. Check how arrays of interface blocks account for XFB buffers, strides, offsets, and aliasing. Done means the validator consistently detects the reported stride and offset problems, with behavior aligned to the applicable GLSL specification.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
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.