etnaviv: nir: set num_components for inputs/outputs
authorJonathan Marek <jonathan@marek.ca>
Wed, 11 Sep 2019 20:45:05 +0000 (16:45 -0400)
committerJonathan Marek <jonathan@marek.ca>
Sat, 28 Sep 2019 04:33:42 +0000 (00:33 -0400)
This can improve performance by allowing the LAST_VARYING_2X bit to be
set when possible (and possibility more benefits on HALTI5 where the
number of components is set for each varying).

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c

index a00f89b4e214f6b7b11cc88e6b755bac7f506d15..cc03e59fedeaf64b724d5d96f534713e746cd4dd 100644 (file)
@@ -596,7 +596,7 @@ etna_compile_shader_nir(struct etna_shader_variant *v)
          unsigned idx = var->data.driver_location;
          sf->reg[idx].reg = idx;
          sf->reg[idx].slot = var->data.location;
-         sf->reg[idx].num_components = 4; /* TODO */
+         sf->reg[idx].num_components = glsl_get_components(var->type);
          sf->num_reg = MAX2(sf->num_reg, idx+1);
       }
    } else {
@@ -605,7 +605,7 @@ etna_compile_shader_nir(struct etna_shader_variant *v)
          unsigned idx = var->data.driver_location;
          sf->reg[idx].reg = idx + 1;
          sf->reg[idx].slot = var->data.location;
-         sf->reg[idx].num_components = 4; /* TODO */
+         sf->reg[idx].num_components = glsl_get_components(var->type);
          sf->num_reg = MAX2(sf->num_reg, idx+1);
          count++;
       }
@@ -740,7 +740,7 @@ etna_compile_shader_nir(struct etna_shader_variant *v)
 
       sf->reg[sf->num_reg].reg = native;
       sf->reg[sf->num_reg].slot = var->data.location;
-      sf->reg[sf->num_reg].num_components = 4; /* TODO */
+      sf->reg[sf->num_reg].num_components = glsl_get_components(var->type);
       sf->num_reg++;
    }