freedreno/ir3: Emit link map as byte or dwords offsets as needed
authorKristian H. Kristensen <hoegsberg@google.com>
Tue, 22 Oct 2019 23:07:45 +0000 (16:07 -0700)
committerKristian H. Kristensen <hoegsberg@google.com>
Fri, 8 Nov 2019 00:36:42 +0000 (16:36 -0800)
Stages that load inputs with ldlw (TCS, GS) need byte offsets, stages
that load with ldg (TES) need dwords offsets.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/ir3/ir3_gallium.c

index 9fad7446080300e7cb7e4e7aeab1f95a287ea264..8b329687978ce2529640e34d98338ccfc4bec01b 100644 (file)
@@ -400,13 +400,27 @@ link_geometry_stages(const struct ir3_shader_variant *producer,
                const struct ir3_shader_variant *consumer,
                uint32_t *locs)
 {
-       uint32_t num_loc = 0;
+       uint32_t num_loc = 0, factor;
+
+       switch (consumer->type) {
+       case MESA_SHADER_TESS_CTRL:
+       case MESA_SHADER_GEOMETRY:
+               /* These stages load with ldlw, which expects byte offsets. */
+               factor = 4;
+               break;
+       case MESA_SHADER_TESS_EVAL:
+               /* The tess eval shader uses ldg, which takes dword offsets. */
+               factor = 1;
+               break;
+       default:
+               unreachable("bad shader stage");
+       }
 
        nir_foreach_variable(in_var, &consumer->shader->nir->inputs) {
                nir_foreach_variable(out_var, &producer->shader->nir->outputs) {
                        if (in_var->data.location == out_var->data.location) {
                                locs[in_var->data.driver_location] =
-                                       producer->shader->output_loc[out_var->data.driver_location] * 4;
+                                       producer->shader->output_loc[out_var->data.driver_location] * factor;
 
                                debug_assert(num_loc <= in_var->data.driver_location + 1);
                                num_loc = in_var->data.driver_location + 1;