mirror of
https://github.com/RPCS3/glslang.git
synced 2024-12-05 01:37:07 +00:00
a4351c55e8
- 300 doesn't allow built-in overload, while 100 does, while neither allows redefining - block name can't be reused for block name within the same interface (though, the spec. isn't clear about that, it's easier than verifying member matches, will file bug on it) git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23984 e7fa87d3-cd2b-0410-9028-fcbf551c1848
69 lines
1.3 KiB
GLSL
69 lines
1.3 KiB
GLSL
#version 100
|
|
|
|
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
|
|
|
|
float f; // ERROR: redefinition
|
|
float tan; // okay, built-in is in an outer scope
|
|
float sin(float x); // ERROR: can't redefine built-in functions
|
|
float cos(float x) // ERROR: can't redefine built-in functions
|
|
{
|
|
return 1.0;
|
|
}
|
|
bool radians(bool x) // okay, can overload built-in functions
|
|
{
|
|
return true;
|
|
}
|
|
|
|
invariant gl_Position;
|
|
|
|
void main()
|
|
{
|
|
int g(); // ERROR: no local function declarations
|
|
g();
|
|
|
|
float sin; // okay
|
|
sin;
|
|
|
|
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
|
|
}
|
|
}
|