[Mesa-dev] [PATCH 09/23] i965/vs: Map scalar VS input locations properly; avoid tons of MOVs.

Kenneth Graunke kenneth at whitecape.org
Wed Sep 30 17:09:24 PDT 2015


On Wednesday, September 30, 2015 12:58:13 AM Kenneth Graunke wrote:
[snip]
> diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c
> index 64763e0..56bd3d3 100644
> --- a/src/mesa/drivers/dri/i965/brw_nir.c
> +++ b/src/mesa/drivers/dri/i965/brw_nir.c
> @@ -33,15 +33,36 @@ brw_nir_lower_inputs(nir_shader *nir,
>                       bool is_scalar)
>  {
>     switch (nir->stage) {
> +   case MESA_SHADER_VERTEX:
> +      /* For now, leave the vec4 backend doing the old method. */
> +      if (!is_scalar) {
> +         nir_assign_var_locations(&nir->inputs, &nir->num_inputs,
> +                                  type_size_vec4);
> +         break;
> +      }
> +
> +      /* Start with the location of the variable's base. */
> +      foreach_list_typed(nir_variable, var, node, &nir->inputs) {
> +         var->data.driver_location = var->data.location;
> +      }
> +
> +      /* Now use nir_lower_io to walk dereference chains.  Attribute arrays
> +       * are loaded as one vec4 per element (or matrix column), so we use
> +       * type_size_vec4 here.
> +       */
> +      nir_lower_io(nir, nir_var_shader_in, type_size_vec4);
> +      break;
>     case MESA_SHADER_GEOMETRY:
>        foreach_list_typed(nir_variable, var, node, &nir->inputs) {
>           var->data.driver_location = var->data.location;
>        }
>        break;
> -   default:
> +   case MESA_SHADER_FRAGMENT:
>        nir_assign_var_locations(&nir->inputs, &nir->num_inputs,
>                                 is_scalar ? type_size_scalar : type_size_vec4);
>        break;
> +   default:
> +      unreachable("unsupported scalar shader stage");
>     }
>  }

This function is used for vec4 shaders as well, so the message ought to
be: "unsupported shader stage".  Fixed locally.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150930/fbd77b6e/attachment.sig>


More information about the mesa-dev mailing list