diff mbox

[1/2] shader_runner regression with gles

Message ID 1358464170-10234-1-git-send-email-tom.gall@linaro.org
State Superseded
Headers show

Commit Message

Tom Gall Jan. 17, 2013, 11:09 p.m. UTC
Augment the parser that examines the shader_test file passed in
with the test to determine which brand of shader_running to
execute, shader_runner, shader_runner_gles2, etc.

This fixes a bug where GLSL ES if first in the [required] section
could match against GL after which the wrong shader_runner command
would be used due to the wrong gl api being used.

Last if plain GLSL is found, GL is presumed as the api. If GLSL ES
is found, GL ES is presumed as the api.

When dispatch is implemented for GLES all this can go away.

Signed-off-by: Tom Gall <tom.gall@linaro.org>
---
 framework/shader_test.py |   26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/framework/shader_test.py b/framework/shader_test.py
index 335a6c1..4db291b 100755
--- a/framework/shader_test.py
+++ b/framework/shader_test.py
@@ -107,16 +107,18 @@  class ShaderTest(PlainExecTest):
         common = {
             'cmp' : r'(<|<=|=|>=|>)',
             'gl_version' : r'(\d.\d)',
-            'gles2_version' : r'(2.\d\s+es)',
-            'gles3_version' : r'(3.\d\s+es)',
+            'gles2_version' : r'(2.\d\s)',
+            'gles3_version' : r'(3.\d\s)',
             'comment' : r'(#.*)',
         }
 
         cls.__re_require_header = re.compile(r'^\s*\[require\]\s*{comment}?$'.format(**common))
         cls.__re_end_require_block = re.compile(r'^\s*\['.format(*common))
         cls.__re_gl = re.compile(r'^\s*GL\s*{cmp}\s*{gl_version}\s*{comment}?$'.format(**common))
-        cls.__re_gles2 = re.compile(r'^\s*GL\s*{cmp}\s*{gles2_version}\s*{comment}?$'.format(**common))
-        cls.__re_gles3 = re.compile(r'^\s*GL\s*{cmp}\s*{gles3_version}\s*{comment}?$'.format(**common))
+        cls.__re_gles2 = re.compile(r'^\s*GL ES\s*{cmp}\s*{gles2_version}\s*{comment}?$'.format(**common))
+        cls.__re_gles3 = re.compile(r'^\s*GL ES\s*{cmp}\s*{gles3_version}\s*{comment}?$'.format(**common))
+        cls.__re_glsl = re.compile(r'^\s*GLSL\s*{cmp}\s*{gl_version}\s*{comment}?$'.format(**common))
+        cls.__re_glsles = re.compile(r'^\s*GLSL ES\s*{cmp}\s*{gl_version}\s*{comment}?$'.format(**common))
         cls.__re_gl_unknown = re.compile(r'^\s*GL\s*{cmp}'.format(**common))
 
     def __init__(self, shader_runner_args, run_standalone=False):
@@ -174,15 +176,23 @@  class ShaderTest(PlainExecTest):
                         else:
                             continue
                     elif parse_state == PARSE_FIND_GL_REQUIREMENT:
-                        if cls.__re_gl.match(line) is not None:
-                            self.__gl_api = ShaderTest.API_GL
-                            return
-                        elif cls.__re_gles2.match(line) is not None:
+                        if cls.__re_gles2.match(line) is not None:
                             self.__gl_api = ShaderTest.API_GLES2
                             return
                         elif cls.__re_gles3.match(line) is not None:
                             self.__gl_api = ShaderTest.API_GLES3
                             return
+                        elif cls.__re_glsles.match(line) is not None:
+							if self.__gl_api is None:
+								self.__gl_api = ShaderTest.API_GLES2
+							return
+                        elif cls.__re_glsl.match(line) is not None:
+							if self.__gl_api is None:
+								self.__gl_api = ShaderTest.API_GL
+							return
+                        elif cls.__re_gl.match(line) is not None:
+                            self.__gl_api = ShaderTest.API_GL
+                            return
                         elif cls.__re_gl_unknown.match(line) is not None:
                             self.__report_failure("Failed to parse GL requirement: " + line)
                             self.__gl_api = ShaderTest.API_ERROR