aboutsummaryrefslogtreecommitdiff
path: root/Test/100scope.vert
blob: 6643730c916eb8d5d21ecb814adfa9e1f4be110c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#version 100

int f(int a, int b, int c)
{
	int a = b;

    {
		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 c(int a);
bool c;              // 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;
    sin(0.7);  // ERROR, use of hidden function
    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
    }

    int degrees;
    degrees(3.2);  // ERROR, use of hidden built-in function
}

varying struct SSS { float f; } s; // ERROR