glslang/Test/reflection.options.vert
baldurk 1f1e5369ce Dereference any array type before expanding root-level SSBO members
If we don't do this then we get reflection output like so:

ArrayedBind[0].a.a: offset 0, type 1406, size 1, index 4, binding -1, stages 0
ArrayedBind[0].a.b: offset 4, type 1406, size 1, index 4, binding -1, stages 0
ArrayedBind[0].b.a: offset 4, type 1406, size 1, index 4, binding -1, stages 0
ArrayedBind[0].b.b: offset 8, type 1406, size 1, index 4, binding -1, stages 0
ArrayedBind[0].b: offset 4, type 1406, size 1, index 4, binding -1, stages 1

When the outer reflection loop that calls blowUpActiveAggregate incorrectly iterates over the struct members.
2019-08-26 12:59:38 +01:00

65 lines
1.3 KiB
GLSL

#version 440 core
struct VertexInfo {
float position[3];
float normal[3];
};
struct TriangleInfo {
VertexInfo v[3];
};
buffer VertexCollection {
TriangleInfo t[5];
uint padding[10];
};
buffer MultipleArrays {
TriangleInfo tri[5];
VertexInfo vert[5];
float f[5];
} multiarray;
buffer ArrayedBind {
float a;
float b;
} buffers[3];
uniform UBO {
VertexInfo verts[2];
float flt[8];
uvec4 unused;
float uniform_multi[4][3][2];
} ubo;
uniform float uniform_multi[4][3][2];
struct OutputStruct {
float val;
vec3 a;
vec2 b[4];
mat2x2 c;
};
out OutputStruct outval;
out float outarr[3];
void main()
{
float f;
f += t[0].v[0].position[0];
f += t[gl_InstanceID].v[gl_InstanceID].position[gl_InstanceID];
f += t[gl_InstanceID].v[gl_InstanceID].normal[gl_InstanceID];
f += multiarray.tri[gl_InstanceID].v[0].position[0];
f += multiarray.vert[gl_InstanceID].position[0];
f += multiarray.f[gl_InstanceID];
f += ubo.verts[gl_InstanceID].position[0];
f += ubo.flt[gl_InstanceID];
f += ubo.uniform_multi[0][0][0];
f += uniform_multi[gl_InstanceID][gl_InstanceID][gl_InstanceID];
f += buffers[gl_InstanceID].b;
TriangleInfo tlocal[5] = t;
outval.val = f;
outarr[2] = f;
}