yum-mirror/glslang

git clone https://git.yummers.dev/yum-mirror/glslang

PratapFix xfb size computation losing 32-bit-ness through arrays516724d9

main
865 B20 linesraw
1#version 450
2#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require
3
4// No xfb_stride is stated, so the compiler computes it and emits it as the
5// XfbStride decoration. The buffer holds a 32-bit type reached through an
6// array, so the stride must round up to a multiple of 4.
7//
8// arr[0] occupies bytes 0..3, h occupies bytes 4..5, so the natural size is 6
9// and the correct emitted stride is 8. Before the fix the array hid the
10// 32-bit-ness of its element, the rounding used the 16-bit rule instead, and
11// the compiler emitted a stride of 6. That is a valid shader compiled to a
12// layout the application reads back wrong, with no diagnostic.
13layout(location = 0, xfb_buffer = 0, xfb_offset = 0) out float arr[1];
14layout(location = 1, xfb_buffer = 0, xfb_offset = 4) out float16_t h;
15
16void main()
17{
18    arr[0] = 1.0;
19    h = float16_t(2.0);
20}