]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/arithmetic_assignment.glsl
Allocate locations to interface variables
[libs/gl.git] / tests / glsl / arithmetic_assignment.glsl
1 uniform mat4 mvp;
2 uniform sampler2D tex;
3 uniform vec3 tint;
4 uniform vec3 ambient;
5
6 #pragma MSP stage(vertex)
7 layout(location=0) in vec4 position;
8 layout(location=1) in vec3 normal;
9 layout(location=2) in vec2 texcoord;
10 void main()
11 {
12         out float light = normal.z;
13         passthrough;
14         gl_Position = mvp*position;
15 }
16
17 #pragma MSP stage(fragment)
18 out vec4 frag_color;
19 void main()
20 {
21         vec3 color = texture(tex, texcoord).rgb;
22         color *= tint;
23         color *= light;
24         color += ambient;
25         frag_color = vec4(color, 1.0);
26 }
27
28 /* Expected output: vertex
29 layout(location=0) uniform mat4 mvp;
30 layout(location=0) in vec4 position;
31 layout(location=1) in vec3 normal;
32 layout(location=2) in vec2 texcoord;
33 layout(location=0) out float light;
34 layout(location=1) out vec2 _vs_out_texcoord;
35 void main()
36 {
37   light = normal.z;
38   _vs_out_texcoord = texcoord;
39   gl_Position = mvp*position;
40 }
41 */
42
43 /* Expected output: fragment
44 layout(location=4) uniform sampler2D tex;
45 layout(location=5) uniform vec3 tint;
46 layout(location=6) uniform vec3 ambient;
47 layout(location=0) out vec4 frag_color;
48 layout(location=1) in vec2 _vs_out_texcoord;
49 layout(location=0) in float light;
50 void main()
51 {
52   vec3 color = texture(tex, _vs_out_texcoord).rgb;
53   color *= tint;
54   color *= light;
55   color += ambient;
56   frag_color = vec4(color, 1.0);
57 }
58 */