Implement relaxed rule for opaque struct members

This commit is contained in:
Samuel Bourasseau 2023-11-29 01:19:02 +01:00 committed by GitHub
parent a3069e1df4
commit c59b876ca0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 2787 additions and 2187 deletions

File diff suppressed because it is too large Load diff

View file

@ -7,10 +7,17 @@ uniform vec4 a;
uniform vec2 b = vec2(0, 0); // initializer will be ignored
layout(location = 0) uniform vec2 c; // location qualifier will be ignored
uniform vec4 d[10];
struct SamplerArray{
sampler2D tn[4];
};
uniform struct e {
vec2 x;
float y;
uint z;
sampler2D t0;
SamplerArray samplers;
} structUniform;
// opaque types will not be grouped into uniform block
@ -64,11 +71,15 @@ uint bar() {
vec4 foo() {
float f = j + bufferInstance.j + structUniform.y + structUniform.z;
vec2 v2 = b + c + structUniform.x;
vec4 v4 = a + d[0] + d[1] + d[2] + k + bufferInstance.k + texture(t1, vec2(0, 0));
vec4 v4 = a + d[0] + d[1] + d[2] + k + bufferInstance.k + texture(t1, vec2(0, 0)) + texture(structUniform.t0, vec2(0, 0));
return vec4(f) * vec4(v2, 1, 1) * v4;
}
vec4 baz(SamplerArray samplers) {
return texture(samplers.tn[0], vec2(0, 0)) + texture(samplers.tn[1], vec2(0, 0)) + texture(samplers.tn[2], vec2(0, 0)) + texture(samplers.tn[3], vec2(0, 0));
}
void main() {
float j = float(bar());
o = j * foo();
}
o = j * foo() + baz(structUniform.samplers);
}