summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2013-10-16 07:04:30 -0700
committerPaul Berry <stereotype441@gmail.com>2013-11-11 15:09:31 -0800
commit4eccdc95d6b9c4a130e3ae67deb3a8d295288bb5 (patch)
treee03da9842edcd069c75d797088b9d9d92f513367 /tests
parent486270c426a2378b3138bc7ac71201d97b5097d4 (diff)
gs: Test that gl_MaxGeometryInputComponents can actually be achieved.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/spec/glsl-1.50/execution/geometry/max-input-components.shader_test66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/spec/glsl-1.50/execution/geometry/max-input-components.shader_test b/tests/spec/glsl-1.50/execution/geometry/max-input-components.shader_test
new file mode 100644
index 000000000..fcd1e7a47
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/geometry/max-input-components.shader_test
@@ -0,0 +1,66 @@
+# Verify that gl_MaxGeometryInputComponents (or
+# gl_MaxVertexOutputComponents, if smaller) floats can be exchanged
+# between the vertex and geometry shader. Use a geometry shader input
+# type of triangles_adjacency so that the total number of inputs
+# received by the geometry shader is as large as possible.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+out blk {
+ float f[min(gl_MaxGeometryInputComponents, gl_MaxVertexOutputComponents)];
+} outs;
+
+void main()
+{
+ for (int i = 0; i < outs.f.length(); i++)
+ outs.f[i] = float(gl_VertexID * 1000 + i + 1);
+}
+
+[geometry shader]
+layout(triangles_adjacency) in;
+layout(triangle_strip, max_vertices = 4) out;
+
+in blk {
+ float f[min(gl_MaxGeometryInputComponents, gl_MaxVertexOutputComponents)];
+} ins[];
+out vec4 color;
+
+void main()
+{
+ const vec4 vertices[4] = vec4[4](
+ vec4(-1.0, -1.0, 0.0, 1.0),
+ vec4(-1.0, 1.0, 0.0, 1.0),
+ vec4( 1.0, -1.0, 0.0, 1.0),
+ vec4( 1.0, 1.0, 0.0, 1.0)
+ );
+
+ bool ok = true;
+ for (int i = 0; i < 6; i++) {
+ for (int j = 0; j < ins[i].f.length(); j++) {
+ if (ins[i].f[j] != float(i * 1000 + j + 1))
+ ok = false;
+ }
+ }
+
+ for (int i = 0; i < 4; i++) {
+ gl_Position = vertices[i];
+ color = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+ EmitVertex();
+ }
+}
+
+[fragment shader]
+in vec4 color;
+
+void main()
+{
+ gl_FragColor = color;
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw arrays GL_TRIANGLES_ADJACENCY 0 6
+probe all rgba 0.0 1.0 0.0 1.0