]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/uniform_location_allocation.glsl
Allocate locations to interface variables
[libs/gl.git] / tests / glsl / uniform_location_allocation.glsl
1 #pragma MSP stage(vertex)
2 uniform mat4 mvp;
3 uniform sampler2D heightmap;
4 layout(location=0) in vec2 position;
5 layout(location=1) in vec2 texcoord;
6 void main()
7 {
8         gl_Position = mvp*vec4(position, texture(heightmap, texcoord).r, 1.0);
9         passthrough;
10 }
11
12 #pragma MSP stage(fragment)
13 layout(location=0) uniform sampler2D heightmap;
14 uniform vec4 color;
15 out vec4 frag_color;
16 void main()
17 {
18         frag_color = color*vec4(texture(heightmap, texcoord).rrr, 1.0);
19 }
20
21 /* Expected output: vertex
22 layout(location=1) uniform mat4 mvp;
23 layout(location=0) uniform sampler2D heightmap;
24 layout(location=0) in vec2 position;
25 layout(location=1) in vec2 texcoord;
26 layout(location=0) out vec2 _vs_out_texcoord;
27 void main()
28 {
29   gl_Position = mvp*vec4(position, texture(heightmap, texcoord).r, 1.0);
30   _vs_out_texcoord = texcoord;
31 }
32 */
33
34 /* Expected output: fragment
35 layout(location=0) uniform sampler2D heightmap;
36 layout(location=5) uniform vec4 color;
37 layout(location=0) out vec4 frag_color;
38 layout(location=0) in vec2 _vs_out_texcoord;
39 void main()
40 {
41   frag_color = color*vec4(texture(heightmap, _vs_out_texcoord).rrr, 1.0);
42 }
43 */