[Piglit] [PATCH 4/4] ARB_draw_instanced: Add trivial instanced drawing tests
Ian Romanick
idr at freedesktop.org
Sun Apr 10 17:04:56 PDT 2011
From: Ian Romanick <ian.d.romanick at intel.com>
---
tests/all.tests | 4 ++
.../execution/draw-non-instanced.shader_test | 41 ++++++++++++++++++
.../instance-array-dereference.shader_test | 44 ++++++++++++++++++++
3 files changed, 89 insertions(+), 0 deletions(-)
create mode 100644 tests/spec/arb_draw_instanced/execution/draw-non-instanced.shader_test
create mode 100644 tests/spec/arb_draw_instanced/execution/instance-array-dereference.shader_test
diff --git a/tests/all.tests b/tests/all.tests
index 42e2eee..97bf697 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -694,6 +694,10 @@ import_glsl_parser_tests(arb_draw_instanced,
os.path.dirname(__file__) + '/spec/arb_draw_instanced',
[''])
+add_shader_test_dir(arb_draw_instanced,
+ os.path.dirname(__file__) + '/spec/arb_draw_instanced/execution',
+ recursive=True)
+
# Group ARB_shader_texture_lod
arb_shader_texture_lod = Group()
diff --git a/tests/spec/arb_draw_instanced/execution/draw-non-instanced.shader_test b/tests/spec/arb_draw_instanced/execution/draw-non-instanced.shader_test
new file mode 100644
index 0000000..1d9d7cc
--- /dev/null
+++ b/tests/spec/arb_draw_instanced/execution/draw-non-instanced.shader_test
@@ -0,0 +1,41 @@
+[require]
+GL_ARB_draw_instanced
+
+[vertex shader]
+/* Verify that InstanceID is zero when drawing primitives using a
+ * non-instanced drawing function.
+ */
+#extension GL_ARB_draw_instanced: require
+
+varying vec4 color;
+
+void main()
+{
+ color = vec4(float(gl_InstanceIDARB),
+ 1.0 - float(gl_InstanceIDARB),
+ 0.0,
+ 1.0);
+ gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+ gl_FragColor = color;
+}
+
+[test]
+ortho
+clear color 0.5 0.5 0.5 0.5
+clear
+
+draw rect 10 10 10 10
+probe rgb 15 15 0 1 0
+
+draw rect 30 10 10 10
+probe rgb 35 15 0 1 0
+
+draw rect 50 10 10 10
+probe rgb 55 15 0 1 0
diff --git a/tests/spec/arb_draw_instanced/execution/instance-array-dereference.shader_test b/tests/spec/arb_draw_instanced/execution/instance-array-dereference.shader_test
new file mode 100644
index 0000000..ae3671d
--- /dev/null
+++ b/tests/spec/arb_draw_instanced/execution/instance-array-dereference.shader_test
@@ -0,0 +1,44 @@
+[require]
+GL_ARB_draw_instanced
+GLSL >= 1.20
+
+[vertex shader]
+/* Verify that InstanceID is zero when drawing primitives using a
+ * non-instanced drawing function.
+ */
+#version 120
+#extension GL_ARB_draw_instanced: require
+
+uniform vec4 instance_colors[] = vec4[](vec4(0.0, 1.0, 0.0, 1.0),
+ vec4(0.0, 0.5, 0.5, 1.0),
+ vec4(0.0, 0.0, 1.0, 1.0));
+
+varying vec4 color;
+
+void main()
+{
+ color = instance_colors[gl_InstanceIDARB];
+
+ vec4 v = gl_Vertex;
+ v.x += 20.0 * float(gl_InstanceIDARB);
+
+ gl_Position = gl_ModelViewProjectionMatrix * v;
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+ gl_FragColor = color;
+}
+
+[test]
+ortho
+clear color 0.5 0.5 0.5 0.5
+clear
+
+draw instanced rect 3 10 10 10 10
+probe rgb 15 15 0.0 1.0 0.0
+probe rgb 35 15 0.0 0.5 0.5
+probe rgb 55 15 0.0 0.0 1.0
--
1.7.4
More information about the Piglit
mailing list