[Piglit] [PATCH 2/2] EXT_base_instance: add GL ES version of ARB_base_instance tests

Ilia Mirkin imirkin at alum.mit.edu
Mon Apr 4 00:13:52 UTC 2016


This adapts the ARB_base_instance tests to run on GL ES 3.0. Just a
question of setting different versions; the dispatch code takes care of
everything for us.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
 tests/all.py                                           |  7 +++++++
 tests/spec/arb_base_instance/CMakeLists.gles3.txt      |  4 ++++
 .../baseinstance-doesnt-affect-gl-instance-id.c        | 18 +++++++++++++++++-
 tests/spec/arb_base_instance/drawarrays.c              | 18 ++++++++++++++++++
 4 files changed, 46 insertions(+), 1 deletion(-)
 create mode 100644 tests/spec/arb_base_instance/CMakeLists.gles3.txt

diff --git a/tests/all.py b/tests/all.py
index a36b006..bc886a1 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4120,6 +4120,13 @@ with profile.group_manager(
 
 with profile.group_manager(
         PiglitGLTest,
+        grouptools.join('spec', 'ext_base_instance')) as g:
+    g(['arb_base_instance-baseinstance-doesnt-affect-gl-instance-id_gles3'],
+      run_concurrent=False)
+    g(['arb_base_instance-drawarrays_gles3'])
+
+with profile.group_manager(
+        PiglitGLTest,
         grouptools.join('spec', 'arb_buffer_storage')) as g:
     for mode in ['read', 'draw']:
         g(['bufferstorage-persistent', mode])
diff --git a/tests/spec/arb_base_instance/CMakeLists.gles3.txt b/tests/spec/arb_base_instance/CMakeLists.gles3.txt
new file mode 100644
index 0000000..8d2f919
--- /dev/null
+++ b/tests/spec/arb_base_instance/CMakeLists.gles3.txt
@@ -0,0 +1,4 @@
+link_libraries(piglitutil_${piglit_target_api})
+
+piglit_add_executable (arb_base_instance-baseinstance-doesnt-affect-gl-instance-id_gles3 baseinstance-doesnt-affect-gl-instance-id.c)
+piglit_add_executable (arb_base_instance-drawarrays_gles3 drawarrays.c)
diff --git a/tests/spec/arb_base_instance/baseinstance-doesnt-affect-gl-instance-id.c b/tests/spec/arb_base_instance/baseinstance-doesnt-affect-gl-instance-id.c
index 354a750..8e223cd 100644
--- a/tests/spec/arb_base_instance/baseinstance-doesnt-affect-gl-instance-id.c
+++ b/tests/spec/arb_base_instance/baseinstance-doesnt-affect-gl-instance-id.c
@@ -29,15 +29,22 @@
 #include "piglit-util-gl.h"
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
-
+#ifdef PIGLIT_USE_OPENGL
 	config.supports_gl_core_version = 31;
+#else
+	config.supports_gl_es_version = 30;
+#endif
 
 	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
 
 PIGLIT_GL_TEST_CONFIG_END
 
 static const char *vstext =
+#ifdef PIGLIT_USE_OPENGL
 	"#version 140\n"
+#else
+	"#version 300 es\n"
+#endif
 	"in vec3 vertex;\n"
 	"out vec4 passColor;\n"
 	"void main() {\n"
@@ -47,7 +54,12 @@ static const char *vstext =
 	"}\n";
 
 static const char *fstext =
+#ifdef PIGLIT_USE_OPENGL
 	"#version 140\n"
+#else
+	"#version 300 es\n"
+	"precision highp float;\n"
+#endif
 	"in vec4 passColor;\n"
 	"out vec4 color;\n"
 	"void main() {\n"
@@ -78,7 +90,11 @@ piglit_init(int argc, char **argv)
 {
 	GLuint vertIndex;
 
+#ifdef PIGLIT_USE_OPENGL
 	piglit_require_extension("GL_ARB_base_instance");
+#else
+	piglit_require_extension("GL_EXT_base_instance");
+#endif
 
 	prog = piglit_build_simple_program(vstext, fstext);
 
diff --git a/tests/spec/arb_base_instance/drawarrays.c b/tests/spec/arb_base_instance/drawarrays.c
index 140e3f7..44e63dc 100644
--- a/tests/spec/arb_base_instance/drawarrays.c
+++ b/tests/spec/arb_base_instance/drawarrays.c
@@ -31,7 +31,11 @@
 #include "piglit-matrix.h"
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
+#ifdef PIGLIT_USE_OPENGL
 	config.supports_gl_core_version = 31;
+#else
+	config.supports_gl_es_version = 30;
+#endif
 	config.window_width = 400;
 	config.window_height = 400;
 	config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
@@ -56,8 +60,13 @@ static float modelview[16], projection[16], modelviewproj[16];
  * instanced array.
  */
 static const char *VertShaderText =
+#ifdef PIGLIT_USE_OPENGL
 	"#version 130 \n"
 	"#extension GL_ARB_draw_instanced: enable \n"
+#else
+	"#version 300 es\n"
+	"#define gl_InstanceIDARB gl_InstanceID\n"
+#endif
 	"in vec4 Vertex, Color; \n"
 	"uniform vec2 Pos[8]; \n"
 	"uniform mat4 MVP; \n"
@@ -73,7 +82,12 @@ static const char *VertShaderText =
 
 /* Simple color pass-through */
 static const char *FragShaderText =
+#ifdef PIGLIT_USE_OPENGL
 	"#version 130 \n"
+#else
+	"#version 300 es \n"
+	"precision highp float;\n"
+#endif
 	"in vec4 ColorVarying; \n"
 	"out vec4 FragColor; \n"
 	"void main() \n"
@@ -208,9 +222,13 @@ piglit_init(int argc, char **argv)
 {
 	GLuint vao;
 
+#ifdef PIGLIT_USE_OPENGL
 	piglit_require_extension("GL_ARB_draw_instanced");
 	piglit_require_extension("GL_ARB_instanced_arrays");
 	piglit_require_extension("GL_ARB_base_instance");
+#else
+	piglit_require_extension("GL_EXT_base_instance");
+#endif
 
 	VertShader = piglit_compile_shader_text(GL_VERTEX_SHADER,
 						VertShaderText);
-- 
2.7.3



More information about the Piglit mailing list