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>
46 lines
882 B
Plaintext
46 lines
882 B
Plaintext
uniform half4 colorGreen, colorRed;
|
|
int glob;
|
|
|
|
bool block_variable_hides_local_variable() {
|
|
bool var = true;
|
|
{
|
|
bool var = false;
|
|
}
|
|
return var;
|
|
}
|
|
|
|
bool block_variable_hides_global_variable() {
|
|
{
|
|
int glob = 1;
|
|
}
|
|
return glob == 2;
|
|
}
|
|
|
|
struct S {
|
|
int i;
|
|
};
|
|
|
|
bool local_variable_hides_struct() {
|
|
bool S = true;
|
|
return S;
|
|
}
|
|
|
|
bool local_struct_variable_hides_struct_type() {
|
|
S S = S(1);
|
|
return S.i == 1;
|
|
}
|
|
|
|
bool local_variable_hides_global_variable() {
|
|
int glob = 1;
|
|
return glob == 1;
|
|
}
|
|
|
|
half4 main(float2 coords) {
|
|
glob = 2;
|
|
return (block_variable_hides_local_variable() &&
|
|
block_variable_hides_global_variable() &&
|
|
local_variable_hides_struct() &&
|
|
local_struct_variable_hides_struct_type() &&
|
|
local_variable_hides_global_variable()) ? colorGreen : colorRed;
|
|
}
|