[Mesa-dev] [PATCH] mesa: move GLES checks for SSO input/output validation

Tapani Pälli tapani.palli at intel.com
Mon Dec 7 00:56:44 PST 2015


Reviewed-by: Tapani Pälli <tapani.palli at intel.com>

On 12/06/2015 07:12 AM, Timothy Arceri wrote:
> This function is unfinished there is a bunch more validation rules
> that need to be applied here. We will still want to call it for desktop
> GL we just don't want to validate precision so move the ES check to
> reflect this.
>
> Cc: Tapani Pälli <tapani.palli at intel.com>
> ---
>   src/mesa/main/shader_query.cpp | 45 +++++++++++++++++++++---------------------
>   1 file changed, 23 insertions(+), 22 deletions(-)
>
> diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
> index ad9fa25..31b9e12 100644
> --- a/src/mesa/main/shader_query.cpp
> +++ b/src/mesa/main/shader_query.cpp
> @@ -1378,7 +1378,7 @@ _mesa_get_program_resourceiv(struct gl_shader_program *shProg,
>
>   static bool
>   validate_io(const struct gl_shader *input_stage,
> -            const struct gl_shader *output_stage)
> +            const struct gl_shader *output_stage, bool isES)
>   {
>      assert(input_stage && output_stage);
>
> @@ -1394,15 +1394,25 @@ validate_io(const struct gl_shader *input_stage,
>               continue;
>
>            if (strcmp(in_var->name, out_var->name) == 0) {
> -            /* From OpenGL ES 3.1 spec:
> -             *     "When both shaders are in separate programs, mismatched
> -             *     precision qualifiers will result in a program interface
> -             *     mismatch that will result in program pipeline validation
> -             *     failures, as described in section 7.4.1 (“Shader Interface
> -             *     Matching”) of the OpenGL ES 3.1 Specification."
> +            /* Since we now only validate precision, we can skip this step for
> +             * desktop GLSL shaders, there precision qualifier is ignored.
> +             *
> +             * From OpenGL 4.50 Shading Language spec, section 4.7:
> +             *     "For the purposes of determining if an output from one
> +             *     shader stage matches an input of the next stage, the
> +             *     precision qualifier need not match."
>                */
> -            if (in_var->data.precision != out_var->data.precision)
> -               return false;
> +            if (isES) {
> +               /* From OpenGL ES 3.1 spec:
> +                *     "When both shaders are in separate programs, mismatched
> +                *     precision qualifiers will result in a program interface
> +                *     mismatch that will result in program pipeline validation
> +                *     failures, as described in section 7.4.1 (“Shader Interface
> +                *     Matching”) of the OpenGL ES 3.1 Specification."
> +                */
> +               if (in_var->data.precision != out_var->data.precision)
> +                  return false;
> +            }
>            }
>         }
>      }
> @@ -1429,19 +1439,10 @@ _mesa_validate_pipeline_io(struct gl_pipeline_object *pipeline)
>
>      for (idx = prev + 1; idx < ARRAY_SIZE(pipeline->CurrentProgram); idx++) {
>         if (shProg[idx]) {
> -         /* Since we now only validate precision, we can skip this step for
> -          * desktop GLSL shaders, there precision qualifier is ignored.
> -          *
> -          * From OpenGL 4.50 Shading Language spec, section 4.7:
> -          *     "For the purposes of determining if an output from one shader
> -          *     stage matches an input of the next stage, the precision
> -          *     qualifier need not match."
> -          */
> -         if (shProg[prev]->IsES || shProg[idx]->IsES) {
> -            if (!validate_io(shProg[prev]->_LinkedShaders[prev],
> -                             shProg[idx]->_LinkedShaders[idx]))
> -               return false;
> -         }
> +         if (!validate_io(shProg[prev]->_LinkedShaders[prev],
> +                          shProg[idx]->_LinkedShaders[idx],
> +                          shProg[prev]->IsES || shProg[idx]->IsES))
> +            return false;
>            prev = idx;
>         }
>      }
>


More information about the mesa-dev mailing list