I've been thinking about this a lot since the arb_compat stuff started happening. I'm thinking in the framework I might want to differentiate ES, Core, and Compat as 3 different types, but for now I think this is a sensible, easy solution:
Reviewed-by: Dylan Baker <dy...@pnwbakers.com> Quoting Marek Olšák (2018-05-22 18:29:01) > From: Marek Olšák <marek.ol...@amd.com> > > --- > framework/test/glsl_parser_test.py | 5 +++++ > tests/glslparsertest/glslparsertest.c | 18 +++++++++++++----- > 2 files changed, 18 insertions(+), 5 deletions(-) > > diff --git a/framework/test/glsl_parser_test.py > b/framework/test/glsl_parser_test.py > index 46344a8ab..8f2904eb1 100644 > --- a/framework/test/glsl_parser_test.py > +++ b/framework/test/glsl_parser_test.py > @@ -58,20 +58,23 @@ def _is_gles_version(version): > assert not isinstance(version, six.binary_type), \ > '{}({})'.format(version, type(version)) > > if isinstance(version, six.text_type): > # GLES 3+ versions should have "es" appended, even though > # glslparsertest doesn't require them. If the version ends in "es" > then > # it is a GLES test for sure. > if version.endswith('es'): > return True > > + if version.endswith('compatibility'): > + return False > + > version = float(version) > > return version in [1.0, 3.0, 3.1, 3.2] > > > class GLSLParserNoConfigError(exceptions.PiglitInternalError): > pass > > > class GLSLParserInternalError(exceptions.PiglitInternalError): > @@ -105,20 +108,22 @@ class Parser(object): > raise exceptions.PiglitFatalError( > 'In file "{}":\n{}'.format(filepath, six.text_type(e))) > > self.set_skip_conditions() > > def set_skip_conditions(self): > """Set OpenGL and OpenGL ES fast skipping conditions.""" > glsl = self.config['glsl_version'] > if _is_gles_version(glsl): > self.glsl_es_version = float(glsl[:3]) > + elif glsl.endswith('compatibility'): > + self.glsl_version = float(glsl[:3]) > else: > self.glsl_version = float(glsl) > > req = self.config['require_extensions'] > self.gl_required = set(r for r in req.split() if not > r.startswith('!')) > > # If GLES is requested, but piglit was not built with a gles version, > # then ARB_ES3<ver>_compatibility is required. Add it to > # self.gl_required > if self.glsl_es_version and not _HAS_GLES_BIN: > diff --git a/tests/glslparsertest/glslparsertest.c > b/tests/glslparsertest/glslparsertest.c > index 3ad0906b1..61ea46ce2 100644 > --- a/tests/glslparsertest/glslparsertest.c > +++ b/tests/glslparsertest/glslparsertest.c > @@ -28,29 +28,33 @@ > /** @file glslparsertest.c > * > * Tests that compiling (but not linking or drawing with) a given > * shader either succeeds or fails as expected. > */ > > #include <errno.h> > > #include "piglit-util-gl.h" > > +#define COMPAT_FLAG (1u << 31) > + > static unsigned parse_glsl_version_number(const char *str); > static int process_options(int argc, char **argv); > > PIGLIT_GL_TEST_CONFIG_BEGIN > > argc = process_options(argc, argv); > if (argc > 3) { > - const unsigned int int_version > + const unsigned int version > = parse_glsl_version_number(argv[3]); > + const bool compat = !!(version & COMPAT_FLAG); > + const unsigned int int_version = version & ~COMPAT_FLAG; > switch (int_version) { > /* This is a hack to support es > * > * This works because version 1.00, 3.00, 3.10, 3.20 (even > * though 3.x should include "es") are unique to GLES, there > is > * no desktop OpenGL shader language 1.00, 3.00, 3.10, or 3.20 > */ > case 100: > config.supports_gl_compat_version = 10; > config.supports_gl_es_version = 20; > @@ -64,21 +68,21 @@ PIGLIT_GL_TEST_CONFIG_BEGIN > config.supports_gl_es_version = 31; > break; > case 320: > config.supports_gl_compat_version = 10; > config.supports_gl_es_version = 32; > break; > default: { > const unsigned int gl_version > = > required_gl_version_from_glsl_version(int_version); > config.supports_gl_compat_version = gl_version; > - if (gl_version < 31) > + if (gl_version < 31 || compat) > config.supports_gl_core_version = 0; > else > config.supports_gl_core_version = gl_version; > } > break; > } > } else { > config.supports_gl_compat_version = 10; > config.supports_gl_es_version = 20; > } > @@ -398,51 +402,55 @@ static void usage(char *name) > /** > * Process any options and remove them from the argv array. Return > * the new argc. > */ > static int > process_options(int argc, char **argv) > { > int i = 1; > int new_argc = 1; > while (i < argc) { > - if (argv[i][0] == '-') { > + if (argv[i][0] == '-' && strcmp(argv[i], "-compat") != 0) { > if (strcmp(argv[i], "--check-link") == 0) > check_link = 1; > else > usage(argv[0]); > /* do not retain the option; we've processed it */ > i++; > } else { > /* retain the option in the argv array */ > argv[new_argc++] = argv[i++]; > } > } > return new_argc; > } > > static unsigned > parse_glsl_version_number(const char *str) > { > unsigned major = 0; > unsigned minor = 0; > + unsigned flags = 0; > > /* Accept a return value of either 1 or 2 from sscanf(), so > * that the version number may be supplied as either "<int>" > * or "<int>.<int>". > */ > if (sscanf(str, "%u.%u", &major, &minor) == 0) { > printf("Ill-formed GLSL version number: %s\n", str); > piglit_report_result(PIGLIT_FAIL); > } > > - return (major * 100) + minor; > + if (strstr(str, "compatibility")) > + flags |= COMPAT_FLAG; > + > + return ((major * 100) + minor) | flags; > } > > > static unsigned > parse_glsl_version_string(const char *str) > { > if (piglit_is_gles()) { > /* In GLSL ES, the string returned by > * glGetString(GL_SHADING_LANGUAGE_VERSION) is > * prefixed by some text. Verify that the expected > @@ -505,21 +513,21 @@ piglit_init(int argc, char**argv) > filename = argv[1]; > > if (strcmp(argv[2], "pass") == 0) > expected_pass = 1; > else if (strcmp(argv[2], "fail") == 0) > expected_pass = 0; > else > usage(argv[0]); > > if (argc > 3) > - requested_version = parse_glsl_version_number(argv[3]); > + requested_version = parse_glsl_version_number(argv[3]) & > ~COMPAT_FLAG; > > gl_version_times_10 = piglit_get_gl_version(); > > if (gl_version_times_10 < 20 > && !piglit_is_extension_supported("GL_ARB_shader_objects")) { > printf("Requires OpenGL 2.0\n"); > piglit_report_result(PIGLIT_SKIP); > } > > glsl_version_string = (char *) > -- > 2.17.0 > > _______________________________________________ > Piglit mailing list > Piglit@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/piglit
signature.asc
Description: signature
_______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit