glslang/Test/reflection.vert
John Kessenich 11f9fc7247 Add and partially implement an interface for doing uniform reflection. It includes an AST traversal to identify live accesses.
It does not yet correctly compute block offsets, give correct GL-API-style type values, or handle arrays.

This is tied to the new -q flag.


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23938 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-11-07 01:06:34 +00:00

74 lines
1.0 KiB
GLSL

#version 440 core
uniform nameless {
vec3 anonMember1;
vec4 anonDeadMember2;
vec4 anonMember3;
};
uniform named {
vec3 deadMember1;
vec4 member2;
vec4 member3;
} ablock;
uniform namelessdead {
int a;
};
uniform namedDead {
int b;
} bblock;
struct TS {
int a;
int dead;
};
uniform TS s;
uniform float uf1;
uniform float uf2;
uniform float ufDead3;
uniform float ufDead4;
const bool control = true;
void deadFunction()
{
vec3 v3 = ablock.deadMember1;
vec4 v = anonDeadMember2;
float f = ufDead4;
}
void liveFunction2()
{
vec3 v = anonMember1;
float f = uf1;
}
void liveFunction1()
{
liveFunction2();
float f = uf2;
vec4 v = ablock.member3;
}
void main()
{
liveFunction1();
liveFunction2();
if (! control)
deadFunction();
float f;
if (control) {
liveFunction2();
f = anonMember3.z;
f = s.a;
} else
f = ufDead3;
}