framework/test/shader_test: Fix MultiShaderRunner handling of directories

Submitted by Dylan Baker on Nov. 8, 2016, 11:51 p.m.

Details

Message ID 20161108235119.27572-1-dylan@pnwbakers.com
State New
Headers show
Series "framework/test/shader_test: Fix MultiShaderRunner handling of directories" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Dylan Baker Nov. 8, 2016, 11:51 p.m.
Currently MultiShaderRunner (used with --process-isolation false)
expects each directory will contain either GL, GLES2, or GLES3 shaders.
The barrier between GLES2 and GLES3 is somewhat artificial, since they
can be promoted to GLES3. This patch allows GLES2 and GLES3 shaders to
be run together but still enforces a separation between GLES and GL
shaders.

cc: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
---
 framework/test/shader_test.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/framework/test/shader_test.py b/framework/test/shader_test.py
index 447e8c0..1966149 100644
--- a/framework/test/shader_test.py
+++ b/framework/test/shader_test.py
@@ -200,7 +200,21 @@  class MultiShaderTest(ReducedProcessMixin, PiglitBaseTest):
             subtest = os.path.basename(os.path.splitext(each)[0]).lower()
 
             if prog is not None:
-                assert parser.prog == prog
+                # This allows mixing GLES2 and GLES3 shader test files
+                # together. Since GLES2 profiles can be promoted to GLES3, this
+                # is fine.
+                if parser.prog != prog:
+                    # Pylint can't figure out that prog is not None.
+                    if 'gles' in parser.prog and 'gles' in prog:  # pylint: disable=unsupported-membership-test
+                        prog = max(parser.prog, prog)
+                    else:
+                        # The only way we can get here is if one is GLES and
+                        # one is not, since there is only one desktop runner
+                        # and so it will never fail the is parser.prog != prog
+                        # check
+                        raise exceptions.PiglitInternalError(
+                            'GLES and GL shaders in the same command!\n'
+                            'Cannot pick a shader_runner binary!')
             else:
                 prog = parser.prog
 

Comments

On 09/11/16 08:51 AM, Dylan Baker wrote:
> Currently MultiShaderRunner (used with --process-isolation false)
> expects each directory will contain either GL, GLES2, or GLES3 shaders.
> The barrier between GLES2 and GLES3 is somewhat artificial, since they
> can be promoted to GLES3. This patch allows GLES2 and GLES3 shaders to
> be run together but still enforces a separation between GLES and GL
> shaders.
> 
> cc: Marek Olšák <maraeo@gmail.com>
> Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
> ---
>  framework/test/shader_test.py | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/framework/test/shader_test.py b/framework/test/shader_test.py
> index 447e8c0..1966149 100644
> --- a/framework/test/shader_test.py
> +++ b/framework/test/shader_test.py
> @@ -200,7 +200,21 @@ class MultiShaderTest(ReducedProcessMixin, PiglitBaseTest):
>              subtest = os.path.basename(os.path.splitext(each)[0]).lower()
>  
>              if prog is not None:
> -                assert parser.prog == prog
> +                # This allows mixing GLES2 and GLES3 shader test files
> +                # together. Since GLES2 profiles can be promoted to GLES3, this
> +                # is fine.
> +                if parser.prog != prog:
> +                    # Pylint can't figure out that prog is not None.
> +                    if 'gles' in parser.prog and 'gles' in prog:  # pylint: disable=unsupported-membership-test
> +                        prog = max(parser.prog, prog)
> +                    else:
> +                        # The only way we can get here is if one is GLES and
> +                        # one is not, since there is only one desktop runner
> +                        # and so it will never fail the is parser.prog != prog
> +                        # check
> +                        raise exceptions.PiglitInternalError(
> +                            'GLES and GL shaders in the same command!\n'
> +                            'Cannot pick a shader_runner binary!')
>              else:
>                  prog = parser.prog
>  
> 

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Tested-by: Marek Olšák <marek.olsak@amd.com>

Marek

On Wed, Nov 9, 2016 at 12:51 AM, Dylan Baker <dylan@pnwbakers.com> wrote:
> Currently MultiShaderRunner (used with --process-isolation false)
> expects each directory will contain either GL, GLES2, or GLES3 shaders.
> The barrier between GLES2 and GLES3 is somewhat artificial, since they
> can be promoted to GLES3. This patch allows GLES2 and GLES3 shaders to
> be run together but still enforces a separation between GLES and GL
> shaders.
>
> cc: Marek Olšák <maraeo@gmail.com>
> Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
> ---
>  framework/test/shader_test.py | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/framework/test/shader_test.py b/framework/test/shader_test.py
> index 447e8c0..1966149 100644
> --- a/framework/test/shader_test.py
> +++ b/framework/test/shader_test.py
> @@ -200,7 +200,21 @@ class MultiShaderTest(ReducedProcessMixin, PiglitBaseTest):
>              subtest = os.path.basename(os.path.splitext(each)[0]).lower()
>
>              if prog is not None:
> -                assert parser.prog == prog
> +                # This allows mixing GLES2 and GLES3 shader test files
> +                # together. Since GLES2 profiles can be promoted to GLES3, this
> +                # is fine.
> +                if parser.prog != prog:
> +                    # Pylint can't figure out that prog is not None.
> +                    if 'gles' in parser.prog and 'gles' in prog:  # pylint: disable=unsupported-membership-test
> +                        prog = max(parser.prog, prog)
> +                    else:
> +                        # The only way we can get here is if one is GLES and
> +                        # one is not, since there is only one desktop runner
> +                        # and so it will never fail the is parser.prog != prog
> +                        # check
> +                        raise exceptions.PiglitInternalError(
> +                            'GLES and GL shaders in the same command!\n'
> +                            'Cannot pick a shader_runner binary!')
>              else:
>                  prog = parser.prog
>
> --
> 2.10.2
>