[Piglit] [PATCH 2/2] framework/glsl_parser_test.py: Use glslparsertest_gles2.
Fabian Bieler
fabianbieler at fastmail.fm
Wed Feb 26 13:10:09 PST 2014
When parsing a gles2 or gles3 shader try to use a proper GL ES context rather
than GL_ARB_ES*_compatibility, but fall back to that if GL ES is not available.
This is usefull because some gles-specific extensions are not advertised in
desktop GL contexts, thus piglit would skip tests for such extensions.
Note: This patch effectively determines GL ES availability at compile time.
Signed-off-by: Fabian Bieler <fabianbieler at fastmail.fm>
---
framework/glsl_parser_test.py | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/framework/glsl_parser_test.py b/framework/glsl_parser_test.py
index 9b6ff24..1607f0a 100755
--- a/framework/glsl_parser_test.py
+++ b/framework/glsl_parser_test.py
@@ -373,6 +373,38 @@ class GLSLParserTest(PlainExecTest):
return self.__config
@property
+ def binary(self):
+ """Binary to execute
+
+ Select desktop GL or GLES binary according to shader version.
+ Fall back to GL_ES*_compatibility via desktop GL if GLES binary
+ was not built.
+
+ :return: str
+ """
+ glsl_version_string = self.config.get('config', 'glsl_version')
+ #the version string should be of the form <major>[.<minor>][ es]
+ try:
+ version, es = glsl_version_string.split()
+ except ValueError:
+ version = glsl_version_string
+ es = ''
+ try:
+ major, minor = [int(x) for x in version.split('.')]
+ except ValueError:
+ major = int(version)
+ minor = 0
+ glsl_version = major * 100 + minor
+
+ gles_binary = path.join(testBinDir, 'glslparsertest_gles2')
+ gl_binary = path.join(testBinDir, 'glslparsertest')
+
+ if es or glsl_version == 100 or glsl_version == 300:
+ if path.exists(gles_binary):
+ return gles_binary
+ return gl_binary
+
+ @property
def command(self):
"""Command line arguments for 'glslparsertest'.
@@ -388,7 +420,7 @@ class GLSLParserTest(PlainExecTest):
return None
assert(self.config is not None)
- command = [path.join(testBinDir, 'glslparsertest'),
+ command = [self.binary,
self.__filepath,
self.config.get('config', 'expect_result'),
self.config.get('config', 'glsl_version')
--
1.8.3.2
More information about the Piglit
mailing list