]> git.tdb.fi Git - libs/gl.git/blobdiff - tests/glsl/arithmetic_assignment.glsl
Properly resolve arithmetic assignment operators
[libs/gl.git] / tests / glsl / arithmetic_assignment.glsl
diff --git a/tests/glsl/arithmetic_assignment.glsl b/tests/glsl/arithmetic_assignment.glsl
new file mode 100644 (file)
index 0000000..adb2a0c
--- /dev/null
@@ -0,0 +1,58 @@
+uniform mat4 mvp;
+uniform sampler2D tex;
+uniform vec3 tint;
+uniform vec3 ambient;
+
+#pragma MSP stage(vertex)
+layout(location=0) in vec4 position;
+layout(location=1) in vec3 normal;
+layout(location=2) in vec2 texcoord;
+void main()
+{
+       out float light = normal.z;
+       passthrough;
+       gl_Position = mvp*position;
+}
+
+#pragma MSP stage(fragment)
+out vec4 frag_color;
+void main()
+{
+       vec3 color = texture(tex, texcoord);
+       color *= tint;
+       color *= light;
+       color += ambient;
+       frag_color = vec4(color, 1.0);
+}
+
+/* Expected output: vertex
+uniform mat4 mvp;
+layout(location=0) in vec4 position;
+layout(location=1) in vec3 normal;
+layout(location=2) in vec2 texcoord;
+out float light;
+out vec2 _vs_out_texcoord;
+void main()
+{
+  light = normal.z;
+  _vs_out_texcoord = texcoord;
+  gl_Position = mvp*position;
+}
+*/
+
+/* Expected output: fragment
+uniform sampler2D tex;
+uniform vec3 tint;
+uniform vec3 ambient;
+out vec4 frag_color;
+in vec2 _vs_out_texcoord;
+in float light;
+void main()
+{
+  vec3 color = texture(tex, _vs_out_texcoord);
+  color *= tint;
+  color *= light;
+  color += ambient;
+  frag_color = vec4(color, 1.0);
+}
+*/