[Mesa-dev] [PATCH] glsl: remove useless null checks and make match_explicit_outputs_to_inputs() static

Timothy Arceri timothy.arceri at collabora.com
Wed Dec 2 03:43:05 PST 2015


On Wed, 2015-12-02 at 11:48 +0200, Juha-Pekka Heikkila wrote:
> match_explicit_outputs_to_inputs() cannot get null inputs and if it
> ever did 
> triggering first null check would later in the function cause
> segfault.

I had to go over my changes to figure out what I'd done wrong here as I
was sure this was needed for SSO (obviously without the segfaults).
However it seems this is just left over from an early attempt at
getting it working.

Thanks for cleaning up my mess.

Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>


> 
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> CC: timothy.arceri at collabora.com
> ---
>  src/glsl/linker.cpp | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index 660c435..ae628cd 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -2687,7 +2687,7 @@
> assign_attribute_or_color_locations(gl_shader_program *prog,
>   * Match explicit locations of outputs to inputs and deactivate the
>   * unmatch flag if found so we don't optimise them away.
>   */
> -void
> +static void
>  match_explicit_outputs_to_inputs(struct gl_shader_program *prog,
>                                   gl_shader *producer,
>                                   gl_shader *consumer)
> @@ -2703,10 +2703,6 @@ match_explicit_outputs_to_inputs(struct
> gl_shader_program *prog,
>        if ((var == NULL) || (var->data.mode != ir_var_shader_out))
>           continue;
>  
> -      /* Mark output as matched if separate shader with no linked
> consumer */
> -      if (consumer == NULL)
> -         var->data.is_unmatched_generic_inout = 0;
> -
>        if (var->data.explicit_location &&
>            var->data.location >= VARYING_SLOT_VAR0) {
>           const unsigned idx = var->data.location -
> VARYING_SLOT_VAR0;
> @@ -2722,10 +2718,6 @@ match_explicit_outputs_to_inputs(struct
> gl_shader_program *prog,
>        if ((input == NULL) || (input->data.mode != ir_var_shader_in))
>           continue;
>  
> -      /* Mark input as matched if separate shader with no linked
> producer */
> -      if (producer == NULL)
> -         input->data.is_unmatched_generic_inout = 0;
> -
>        ir_variable *output = NULL;
>        if (input->data.explicit_location
>            && input->data.location >= VARYING_SLOT_VAR0) {


More information about the mesa-dev mailing list