[Piglit] [PATCH 1/2] shader_runner: Allow tests to require an OpenGL CORE profile

Jordan Justen jordan.l.justen at intel.com
Wed May 14 11:01:55 PDT 2014


Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 tests/shaders/shader_runner.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index a288afa..bd7fe6f 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -74,6 +74,7 @@ struct component_version {
 		VERSION_GLSL,
 	} _tag;
 
+	bool core;
 	bool es;
 	unsigned num;
 	char _string[100];
@@ -174,11 +175,12 @@ bool
 compare(float ref, float value, enum comparison cmp);
 
 static void
-version_init(struct component_version *v, enum version_tag tag, bool es, unsigned num)
+version_init(struct component_version *v, enum version_tag tag, bool core, bool es, unsigned num)
 {
 	assert(tag == VERSION_GL || tag == VERSION_GLSL);
 
 	v->_tag = tag;
+	v->core = core;
 	v->es = es;
 	v->num = num;
 	v->_string[0] = 0;
@@ -510,7 +512,12 @@ parse_version_comparison(const char *line, enum comparison *cmp,
 	unsigned minor;
 	unsigned full_num;
 	bool es = false;
+	bool core = false;
 
+	if (string_match(" CORE", line)) {
+		core = true;
+		line += 5;
+	}
 	if (string_match(" ES", line)) {
 		es = true;
 		line += 3;
@@ -539,7 +546,7 @@ parse_version_comparison(const char *line, enum comparison *cmp,
 		full_num = (major * 10) + minor;
 	}
 
-	version_init(v, tag, es, full_num);
+	version_init(v, tag, core, es, full_num);
 }
 
 /**
@@ -1077,7 +1084,7 @@ choose_required_gl_version(struct requirement_parse_results *parse_results,
 		version_copy(gl_version, &parse_results->gl_version);
 	} else {
 		assert(!parse_results->found_glsl || !parse_results->glsl_version.es);
-		version_init(gl_version, VERSION_GL, false, 10);
+		version_init(gl_version, VERSION_GL, false, false, 10);
 	}
 
 	if (gl_version->es)
@@ -1124,7 +1131,8 @@ get_required_config(const char *script_name,
 		config->supports_gl_es_version = required_gl_version.num;
 	} else if (required_gl_version.num >= 31) {
 		config->supports_gl_core_version = required_gl_version.num;
-		config->supports_gl_compat_version = required_gl_version.num;
+		if (!required_gl_version.core)
+			config->supports_gl_compat_version = required_gl_version.num;
 	} else {
 		config->supports_gl_compat_version = 10;
 	}
@@ -2144,16 +2152,17 @@ piglit_init(int argc, char **argv)
 {
 	int major;
 	int minor;
+	bool core = piglit_is_core_profile;
 	bool es;
 
 	piglit_require_GLSL();
 
 	version_init(&gl_version, VERSION_GL,
+		     core,
 	             piglit_is_gles(),
 	             piglit_get_gl_version());
-
 	piglit_get_glsl_version(&es, &major, &minor);
-	version_init(&glsl_version, VERSION_GLSL, es,
+	version_init(&glsl_version, VERSION_GLSL, core, es,
 	             (major * 100) + minor);
 
 #ifdef PIGLIT_USE_OPENGL
-- 
2.0.0.rc2



More information about the Piglit mailing list