5420cbcf65
GLSL treats builtin types and user-defined types differently; `int` and `float` are keywords and cannot be used to name variables. However, it's fine for a user type like `struct xyz` to be hidden by a variable `int xyz` or even `xyz xyz` (i.e., a variable of type `struct xyz` named `xyz`). We now honor that distinction and include tests for it. This will fix several ES2 conformance tests (local_struct_variable_hides_struct_type, local_int_variable_hides_struct_type, etc.). Change-Id: I7a45c70707087f9f355ce5b06b032fed16683f3e Bug: skia:12527 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458721 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
29 lines
706 B
GLSL
29 lines
706 B
GLSL
|
|
out vec4 sk_FragColor;
|
|
uniform vec4 colorGreen;
|
|
uniform vec4 colorRed;
|
|
int glob;
|
|
struct S {
|
|
int i;
|
|
};
|
|
bool block_variable_hides_global_variable_b() {
|
|
return glob == 2;
|
|
}
|
|
bool local_variable_hides_struct_b() {
|
|
bool S = true;
|
|
return S;
|
|
}
|
|
bool local_struct_variable_hides_struct_type_b() {
|
|
S S = S(1);
|
|
return S.i == 1;
|
|
}
|
|
bool local_variable_hides_global_variable_b() {
|
|
int glob = 1;
|
|
return glob == 1;
|
|
}
|
|
vec4 main() {
|
|
glob = 2;
|
|
bool _0_var = true;
|
|
return (((_0_var && block_variable_hides_global_variable_b()) && local_variable_hides_struct_b()) && local_struct_variable_hides_struct_type_b()) && local_variable_hides_global_variable_b() ? colorGreen : colorRed;
|
|
}
|