2013-06-12 06:13:17 +00:00
|
|
|
#version 300 es
|
|
|
|
|
|
|
|
int f(int a, int b, int c)
|
|
|
|
{
|
|
|
|
int a = b; // ERROR, redefinition
|
|
|
|
|
|
|
|
{
|
|
|
|
float a = float(a) + 1.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
|
|
|
int f(int a, int b, int c); // okay to redeclare
|
|
|
|
|
|
|
|
bool b;
|
|
|
|
float b(int a); // ERROR: redefinition
|
|
|
|
|
2013-12-11 22:38:19 +00:00
|
|
|
float c(int a);
|
|
|
|
bool c; // ERROR: redefinition
|
|
|
|
|
2013-06-12 06:13:17 +00:00
|
|
|
float f; // ERROR: redefinition
|
|
|
|
float tan; // ERROR: redefines built-in function
|
2013-11-11 04:21:31 +00:00
|
|
|
float sin(float x); // ERROR: can't redefine built-in functions
|
|
|
|
float cos(float x) // ERROR: can't redefine built-in functions
|
2013-06-12 06:13:17 +00:00
|
|
|
{
|
|
|
|
return 1.0;
|
|
|
|
}
|
2013-11-11 04:21:31 +00:00
|
|
|
bool radians(bool x) // ERROR: can't overload built-in functions
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2013-06-12 06:13:17 +00:00
|
|
|
|
|
|
|
invariant gl_Position;
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
int g(); // ERROR: no local function declarations
|
|
|
|
g();
|
|
|
|
|
|
|
|
float sin; // okay
|
|
|
|
sin;
|
2013-12-11 22:38:19 +00:00
|
|
|
sin(0.7); // ERROR, use of hidden function
|
2013-06-12 06:13:17 +00:00
|
|
|
f(1,2,3);
|
|
|
|
|
|
|
|
float f; // hides f()
|
|
|
|
f = 3.0;
|
|
|
|
|
|
|
|
gl_Position = vec4(f);
|
|
|
|
|
|
|
|
for (int f = 0; f < 10; ++f)
|
|
|
|
++f;
|
|
|
|
|
|
|
|
int x = 1;
|
|
|
|
{
|
|
|
|
float x = 2.0, /* 2nd x visible here */ y = x; // y is initialized to 2
|
|
|
|
int z = z; // ERROR: z not previously defined.
|
|
|
|
}
|
|
|
|
{
|
|
|
|
int x = x; // x is initialized to '1'
|
|
|
|
}
|
|
|
|
|
|
|
|
struct S
|
|
|
|
{
|
|
|
|
int x;
|
|
|
|
};
|
|
|
|
{
|
|
|
|
S S = S(0); // 'S' is only visible as a struct and constructor
|
|
|
|
S.x; // 'S' is now visible as a variable
|
|
|
|
}
|
2013-12-11 22:38:19 +00:00
|
|
|
|
|
|
|
int degrees;
|
|
|
|
degrees(3.2); // ERROR, use of hidden built-in function
|
2013-06-12 06:13:17 +00:00
|
|
|
}
|