]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/arithmetic_assignment.glsl
Check the flat qualifier from the correct member
[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 // Target API: OpenGL
29
30 /* Expected output: vertex
31 layout(location=0) uniform mat4 mvp;
32 layout(location=0) in vec4 position;
33 layout(location=1) in vec3 normal;
34 layout(location=2) in vec2 texcoord;
35 layout(location=0) out float light;
36 layout(location=1) out vec2 _vs_out_texcoord;
37 void main()
38 {
39   light = normal.z;
40   _vs_out_texcoord = texcoord;
41   gl_Position = mvp*position;
42   gl_Position.z = gl_Position.z*2.0-gl_Position.w;
43 }
44 */
45
46 /* Expected output: fragment
47 layout(location=4, binding=71) uniform sampler2D tex;
48 layout(location=5) uniform vec3 tint;
49 layout(location=6) uniform vec3 ambient;
50 layout(location=0) out vec4 frag_color;
51 layout(location=1) in vec2 _vs_out_texcoord;
52 layout(location=0) in float light;
53 void main()
54 {
55   vec3 color = texture(tex, _vs_out_texcoord).rgb;
56   color *= tint;
57   color *= light;
58   color += ambient;
59   frag_color = vec4(color, 1.0);
60 }
61 */