Add missing check that a function call is not using the same name as a variable hiding the function's name. Also, support version 110 separate name spaces for functions and variable names.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24480 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
623833fabc
commit
3a4687d782
17 changed files with 576 additions and 285 deletions
74
Test/110scope.vert
Normal file
74
Test/110scope.vert
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
#version 110
|
||||
|
||||
int f(int a, int b, int c)
|
||||
{
|
||||
int a = b; // ERROR, redefinition
|
||||
|
||||
{
|
||||
float a = float(a) + 1.0; // okay
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
int f(int a, int b, int c); // okay to redeclare
|
||||
|
||||
bool b;
|
||||
float b(int a); // okay, b and b() are different
|
||||
|
||||
float c(int a);
|
||||
bool c; // okay, and c() are different
|
||||
|
||||
float f; // okay f and f() are different
|
||||
float tan; // okay, hides built-in function
|
||||
float sin(float x); // okay, can redefine built-in functions
|
||||
float cos(float x) // okay, can redefine built-in functions
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
bool radians(bool x) // okay, can overload built-in functions
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
int g(); // okay
|
||||
g();
|
||||
|
||||
float sin; // okay
|
||||
sin;
|
||||
sin(0.7); // okay
|
||||
f(1,2,3);
|
||||
|
||||
float 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
|
||||
}
|
||||
|
||||
int degrees;
|
||||
degrees(3.2);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue