[Piglit] [PATCH 1/3] util/gl: Add config field 'supports_gl_es_version'

Chad Versace chad.versace at linux.intel.com
Thu Nov 15 11:11:00 PST 2012


This field allows a test to declare support for any GLES version.  It
replaces fields 'supports_gl_es1' and 'supports_gl_es2'.

The valid range for the field is currently [1.0, 3.0), though it will soon
get bumped to [1.0,4.0).

One advantage of this field is that it introduces symmetry among the
'supports_gl' fields. Before this patch, two fields were integers
(supports_gl_core_version, supports_gl_compat_version) and two were
booleans (supports_gl_es1, supports_gl_es2). Now they're all integers and
behave similarly.

This patch also updates, with the subistition below, the tests that used
the old config fields.
    supports_gl_es2 = true --> supports_gl_es_version = 20
    supports_gl_es1 = true --> supports_gl_es_version = 10

Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 tests/gles2/gles2_shader_runner.c                  |  2 +-
 tests/glslparsertest/glslparsertest.c              |  2 +-
 .../spec/ext_unpack_subimage/ext_unpack_subimage.c |  2 +-
 .../oes_compressed_etc1_rgb8_texture-basic.c       |  2 +-
 .../oes_compressed_etc1_rgb8_texture-miptree.c     |  2 +-
 .../oes_compressed_paletted_texture-api.c          |  2 +-
 tests/spec/oes_draw_texture/oes_draw_texture.c     |  2 +-
 tests/util/piglit-framework-gl.h                   | 28 ++++++++----
 .../util/piglit-framework-gl/piglit_gl_framework.c | 11 ++---
 .../piglit-framework-gl/piglit_wfl_framework.c     | 53 +++++++++++-----------
 10 files changed, 55 insertions(+), 51 deletions(-)

diff --git a/tests/gles2/gles2_shader_runner.c b/tests/gles2/gles2_shader_runner.c
index 94907e7..cdfe089 100644
--- a/tests/gles2/gles2_shader_runner.c
+++ b/tests/gles2/gles2_shader_runner.c
@@ -36,7 +36,7 @@
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
-	config.supports_gl_es2 = true;
+	config.supports_gl_es_version = 20;
 
 	config.window_width = 250;
 	config.window_height = 250;
diff --git a/tests/glslparsertest/glslparsertest.c b/tests/glslparsertest/glslparsertest.c
index d2e4708..c2855c1 100644
--- a/tests/glslparsertest/glslparsertest.c
+++ b/tests/glslparsertest/glslparsertest.c
@@ -38,7 +38,7 @@
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
 	config.supports_gl_compat_version = 10;
-	config.supports_gl_es2 = true;
+	config.supports_gl_es_version = 20;
 
 	config.window_width = 200;
 	config.window_height = 100;
diff --git a/tests/spec/ext_unpack_subimage/ext_unpack_subimage.c b/tests/spec/ext_unpack_subimage/ext_unpack_subimage.c
index c442ccd..6ac8788 100644
--- a/tests/spec/ext_unpack_subimage/ext_unpack_subimage.c
+++ b/tests/spec/ext_unpack_subimage/ext_unpack_subimage.c
@@ -34,7 +34,7 @@
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
-	config.supports_gl_es2 = true;
+	config.supports_gl_es_version = 20;
 
 	config.window_width = 100;
 	config.window_height = 100;
diff --git a/tests/spec/oes_compressed_etc1_rgb8_texture/oes_compressed_etc1_rgb8_texture-basic.c b/tests/spec/oes_compressed_etc1_rgb8_texture/oes_compressed_etc1_rgb8_texture-basic.c
index d52d6fb..70e1a8c 100644
--- a/tests/spec/oes_compressed_etc1_rgb8_texture/oes_compressed_etc1_rgb8_texture-basic.c
+++ b/tests/spec/oes_compressed_etc1_rgb8_texture/oes_compressed_etc1_rgb8_texture-basic.c
@@ -29,7 +29,7 @@
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
-	config.supports_gl_es1 = true;
+	config.supports_gl_es_version = 10;
 
 	config.window_width = 100;
 	config.window_height = 100;
diff --git a/tests/spec/oes_compressed_etc1_rgb8_texture/oes_compressed_etc1_rgb8_texture-miptree.c b/tests/spec/oes_compressed_etc1_rgb8_texture/oes_compressed_etc1_rgb8_texture-miptree.c
index d038de4..717793c 100644
--- a/tests/spec/oes_compressed_etc1_rgb8_texture/oes_compressed_etc1_rgb8_texture-miptree.c
+++ b/tests/spec/oes_compressed_etc1_rgb8_texture/oes_compressed_etc1_rgb8_texture-miptree.c
@@ -55,7 +55,7 @@ static const int window_height = 2 * level0_height;
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
-	config.supports_gl_es2 = true;
+	config.supports_gl_es_version = 20;
 
 	config.window_width = window_width;
 	config.window_height = window_height;
diff --git a/tests/spec/oes_compressed_paletted_texture/oes_compressed_paletted_texture-api.c b/tests/spec/oes_compressed_paletted_texture/oes_compressed_paletted_texture-api.c
index cc044c6..4e6c75d 100644
--- a/tests/spec/oes_compressed_paletted_texture/oes_compressed_paletted_texture-api.c
+++ b/tests/spec/oes_compressed_paletted_texture/oes_compressed_paletted_texture-api.c
@@ -25,7 +25,7 @@
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
-	config.supports_gl_es1 = true;
+	config.supports_gl_es_version = 10;
 
 	config.window_width = 100;
 	config.window_height = 100;
diff --git a/tests/spec/oes_draw_texture/oes_draw_texture.c b/tests/spec/oes_draw_texture/oes_draw_texture.c
index 5af7bb9..3542656 100644
--- a/tests/spec/oes_draw_texture/oes_draw_texture.c
+++ b/tests/spec/oes_draw_texture/oes_draw_texture.c
@@ -36,7 +36,7 @@
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
-	config.supports_gl_es1 = true;
+	config.supports_gl_es_version = 10;
 
 	config.window_width = 100;
 	config.window_height = 100;
diff --git a/tests/util/piglit-framework-gl.h b/tests/util/piglit-framework-gl.h
index 4dd60de..6ab791a 100644
--- a/tests/util/piglit-framework-gl.h
+++ b/tests/util/piglit-framework-gl.h
@@ -73,6 +73,24 @@ enum piglit_gl_visual {
  */
 struct piglit_gl_test_config {
 	/**
+	 * If this field is non-zero, then the test is able to run under any
+	 * OpenGL ES context whose version is backwards-compatible with the
+	 * given version.
+	 *
+	 * For example, if this field's value is '10', then Piglit will
+	 * attempt to run the test under an OpenGL ES 1.0 context. Likewise
+	 * for '20' and OpenGL ES 2.0.
+	 *
+	 * If Piglit fails to acquire the waffle_config or to create the
+	 * waffle_context, then it skips its attempt to run the test under
+	 * an OpenGL ES context.
+	 *
+	 * If this field is 0, then the test is not able to run under an
+	 * OpenGL ES context of any version.
+	 */
+	int supports_gl_es_version;
+
+	/**
 	 * If this field is non-zero, then the test is able to run under a GL
 	 * core context having at least the given version.
 	 *
@@ -141,16 +159,6 @@ struct piglit_gl_test_config {
 	 */
 	int supports_gl_compat_version;
 
-	/**
-	 * The test is able to run under an OpenGL ES1 context.
-	 */
-	bool supports_gl_es1;
-
-	/**
-	 * The test is able to run under an OpenGL ES2 context.
-	 */
-	bool supports_gl_es2;
-
 	int window_width;
 	int window_height;
 
diff --git a/tests/util/piglit-framework-gl/piglit_gl_framework.c b/tests/util/piglit-framework-gl/piglit_gl_framework.c
index aa6884b..aa24dd7 100644
--- a/tests/util/piglit-framework-gl/piglit_gl_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_gl_framework.c
@@ -61,8 +61,7 @@ validate_supported_apis(const struct piglit_gl_test_config *test_config)
 {
 	if (!test_config->supports_gl_core_version &&
 	    !test_config->supports_gl_compat_version &&
-	    !test_config->supports_gl_es1 &&
-	    !test_config->supports_gl_es2) {
+	    !test_config->supports_gl_es_version) {
 		printf("The test config supports no GL API's.\n");
 		piglit_report_result(PIGLIT_FAIL);
 	}
@@ -80,12 +79,8 @@ validate_supported_apis(const struct piglit_gl_test_config *test_config)
 	    && !test_config->supports_gl_compat_version) {
 		piglit_report_result(PIGLIT_SKIP);
 	}
-#elif defined(PIGLIT_USE_OPENGL_ES1)
-	if (!test_config->supports_gl_es1) {
-		piglit_report_result(PIGLIT_SKIP);
-	}
-#elif defined(PIGLIT_USE_OPENGL_ES2)
-	if (!test_config->supports_gl_es2) {
+#elif defined(PIGLIT_USE_OPENGL_ES1) || defined(PIGLIT_USE_OPENGL_ES2)
+	if (!test_config->supports_gl_es_version) {
 		piglit_report_result(PIGLIT_SKIP);
 	}
 #else
diff --git a/tests/util/piglit-framework-gl/piglit_wfl_framework.c b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
index eb117b5..9f07f7e 100644
--- a/tests/util/piglit-framework-gl/piglit_wfl_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
@@ -31,8 +31,7 @@
 enum context_flavor {
 	CONTEXT_GL_CORE,
 	CONTEXT_GL_COMPAT,
-	CONTEXT_GL_ES1,
-	CONTEXT_GL_ES2,
+	CONTEXT_GL_ES,
 };
 
 struct piglit_wfl_framework*
@@ -197,23 +196,34 @@ choose_config(struct piglit_wfl_framework *wfl_fw,
 			head_attrib_list[i++] = 0;
 			break;
 
-		case CONTEXT_GL_ES1:
-			assert(test_config->supports_gl_es1);
-
-			i = 0;
-			head_attrib_list[i++] = WAFFLE_CONTEXT_API;
-			head_attrib_list[i++] = WAFFLE_CONTEXT_OPENGL_ES1;
-			head_attrib_list[i++] = 0;
-			break;
-
-		case CONTEXT_GL_ES2:
-			assert(test_config->supports_gl_es2);
+		case CONTEXT_GL_ES: {
+			int32_t waffle_context_api;
+			assert(test_config->supports_gl_es_version);
+
+			if (test_config->supports_gl_es_version >= 30) {
+				printf("piglit: info: piglit does not yet "
+				       "support OpenGL ES %d.%d\n",
+				       test_config->supports_gl_es_version / 10,
+				       test_config->supports_gl_es_version % 10);
+				piglit_report_result(PIGLIT_SKIP);
+			} else if (test_config->supports_gl_es_version >= 20) {
+				waffle_context_api = WAFFLE_CONTEXT_OPENGL_ES2;
+			} else if (test_config->supports_gl_es_version >= 10) {
+				waffle_context_api = WAFFLE_CONTEXT_OPENGL_ES1;
+			} else {
+				printf("piglit: error: config attribute "
+				       "'supports_gl_es_version' has "
+				       "bad value %d\n",
+				       test_config->supports_gl_es_version);
+				piglit_report_result(PIGLIT_FAIL);
+			}
 
 			i = 0;
 			head_attrib_list[i++] = WAFFLE_CONTEXT_API;
-			head_attrib_list[i++] = WAFFLE_CONTEXT_OPENGL_ES2;
+			head_attrib_list[i++] = waffle_context_api;
 			head_attrib_list[i++] = 0;
 			break;
+			}
 
 		default:
 			assert(0);
@@ -360,25 +370,16 @@ make_context_current(struct piglit_wfl_framework *wfl_fw,
 		}
 	}
 
-#elif defined(PIGLIT_USE_OPENGL_ES1)
+#elif defined(PIGLIT_USE_OPENGL_ES1) || defined(PIGLIT_USE_OPENGL_ES2)
 	ok = make_context_current_singlepass(wfl_fw, test_config,
-	                                     CONTEXT_GL_ES1,
+	                                     CONTEXT_GL_ES,
 	                                     partial_config_attrib_list);
 
 	if (ok)
 		return;
 	else
-		printf("piglit: info: Failed to create GL ES1 context\n");
-
-#elif defined(PIGLIT_USE_OPENGL_ES2)
-	ok = make_context_current_singlepass(wfl_fw, test_config,
-	                                     CONTEXT_GL_ES2,
-	                                     partial_config_attrib_list);
+		printf("piglit: info: Failed to create GL ES context\n");
 
-	if (ok)
-		return;
-	else
-		printf("piglit: info: Failed to create GL ES2 context\n");
 #else
 #	error
 #endif
-- 
1.7.11.7



More information about the Piglit mailing list