[Piglit] [PATCH 06/15] shader_runner: Parse ES versions

Chad Versace chad.versace at linux.intel.com
Fri Dec 7 12:53:52 PST 2012


Now shader_runner accepts an ES qualifier in version requirements. For
example, the following are now allowed:
    GL >= 3.0 es
    GLSL >= 3.00 es

shader_runner is not yet capable of creating an ES context. That requires
additional massaging in follow-on patches.  Therefore, if a test requests
an ES version, shader_runner raises an assertion failure in
get_required_versions().

Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 tests/shaders/shader_runner.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 4ca80cb..ac816e1 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -459,6 +459,17 @@ process_comparison(const char *src, enum comparison *cmp)
 }
 
 
+/**
+ * To specify an ES version, append "es" to the version. For example:
+ * 	GL >= 3.0 es
+ * 	GLSL >= 3.00 es
+ *
+ * GLSL ES 1.00 is a special case. Despite being an ES shading language,
+ * the #version directive lacks "es"; that is, the directive is
+ * `#version 100` rather than `#version 100 es`. Therefore be lenient in
+ * parsing that version. Interpret `GLSL >= 100` and `GLSL >= 100 es`
+ * identically.
+ */
 void
 parse_version_comparison(const char *line, enum comparison *cmp,
 			 struct version *v, enum version_tag tag)
@@ -466,12 +477,17 @@ parse_version_comparison(const char *line, enum comparison *cmp,
 	unsigned major;
 	unsigned minor;
 	unsigned full_num;
-	bool es = false;
+	bool es;
 
 	line = eat_whitespace(line);
 	line = process_comparison(line, cmp);
 
+	line = eat_whitespace(line);
 	sscanf(line, "%u.%u", &major, &minor);
+	line = eat_text(line);
+
+	line = eat_whitespace(line);
+	es = string_match("es", line);
 
 	/* This hack is so that we can tell the difference between GL versions
 	 * and GLSL versions.  All GL versions look like 3.2, and we want the
@@ -480,6 +496,8 @@ parse_version_comparison(const char *line, enum comparison *cmp,
 	 */
 	if (tag == VERSION_GLSL) {
 		full_num = (major * 100) + minor;
+		if (full_num == 100)
+			es = true;
 	} else {
 		full_num = (major * 10) + minor;
 	}
-- 
1.7.11.7



More information about the Piglit mailing list