aboutsummaryrefslogtreecommitdiff
path: root/tests/shaders
diff options
context:
space:
mode:
authorChad Versace <chad.versace@linux.intel.com>2012-12-03 15:35:00 -0800
committerChad Versace <chad.versace@linux.intel.com>2012-12-11 12:44:50 -0600
commit6ec59a9c9d86351374aadfcb2c1bc795495cc4af (patch)
tree1af57f8b46487153440b621a59cb174802ca2167 /tests/shaders
parent99f6e8e285e86c8cded4d741319b3a60d69dd411 (diff)
shader_runner: Parse ES versions
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@linux.intel.com>
Diffstat (limited to 'tests/shaders')
-rw-r--r--tests/shaders/shader_runner.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 4ca80cb1..ac816e16 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;
}