[Mesa-dev] [PATCH 4/6] glsl: don't dead code remove SSO varyings marked as active

Tapani Pälli tapani.palli at intel.com
Mon Nov 30 04:27:46 PST 2015


On 11/25/2015 11:54 AM, Timothy Arceri wrote:
> From: Gregory Hainaut <gregory.hainaut at gmail.com>
>
> GL_ARB_separate_shader_objects allow matching by name variable or block
> interface. Input varyings can't be removed because it is will impact the
> location assignment.
>
> This fixes the bug 79783 and likely any application that uses
> GL_ARB_separate_shader_objects extension.
>
> V2 (by Timothy Arceri):
> * simplify now that builtins are not set as always active
>
> Signed-off-by: Gregory Hainaut <gregory.hainaut at gmail.com>
> Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>
> https://bugs.freedesktop.org/show_bug.cgi?id=79783
> ---
>   src/glsl/opt_dead_code.cpp | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
>
> diff --git a/src/glsl/opt_dead_code.cpp b/src/glsl/opt_dead_code.cpp
> index c5be166..d2316bc 100644
> --- a/src/glsl/opt_dead_code.cpp
> +++ b/src/glsl/opt_dead_code.cpp
> @@ -75,6 +75,22 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned)
>   	  || !entry->declaration)
>   	 continue;
>
> +      /* Section 7.4.1 (Shader Interface Matching) of the OpenGL 4.5
> +       * (Core Profile) spec says:
> +       *
> +       *    "With separable program objects, interfaces between shader
> +       *    stages may involve the outputs from one program object and the
> +       *    inputs from a second program object.  For such interfaces, it is
> +       *    not possible to detect mismatches at link time, because the
> +       *    programs are linked separately. When each such program is
> +       *    linked, all inputs or outputs interfacing with another program
> +       *    stage are treated as active."
> +       */
> +      if (entry->var->data.always_active_io &&
> +          (entry->var->data.mode == ir_var_shader_in ||
> +           entry->var->data.mode == ir_var_shader_out))

always_active_io is only set for inputs and outputs so this check can be 
changed to just that;

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

> +         continue;
> +
>         if (!entry->assign_list.is_empty()) {
>   	 /* Remove all the dead assignments to the variable we found.
>   	  * Don't do so if it's a shader or function output, though.
>


More information about the mesa-dev mailing list