From: Iago Toral Quiroga Date: Thu, 6 Jun 2019 07:41:33 +0000 (+0200) Subject: v3d: add a helper to track variables that need point coordinates X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5e26e55e724f4eff28840cfb6922963069231902;p=mesa.git v3d: add a helper to track variables that need point coordinates Reviewed-by: Eric Anholt --- diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c index 55e41e16b36..1e98e69efbc 100644 --- a/src/broadcom/compiler/nir_to_vir.c +++ b/src/broadcom/compiler/nir_to_vir.c @@ -1453,6 +1453,15 @@ ntq_setup_vpm_inputs(struct v3d_compile *c) } } +static bool +var_needs_point_coord(struct v3d_compile *c, nir_variable *var) +{ + return (var->data.location == VARYING_SLOT_PNTC || + (var->data.location >= VARYING_SLOT_VAR0 && + (c->fs_key->point_sprite_mask & + (1 << (var->data.location - VARYING_SLOT_VAR0))))); +} + static void ntq_setup_fs_inputs(struct v3d_compile *c) { @@ -1486,11 +1495,7 @@ ntq_setup_fs_inputs(struct v3d_compile *c) if (var->data.location == VARYING_SLOT_POS) { emit_fragcoord_input(c, loc); - } else if (var->data.location == VARYING_SLOT_PNTC || - (var->data.location >= VARYING_SLOT_VAR0 && - (c->fs_key->point_sprite_mask & - (1 << (var->data.location - - VARYING_SLOT_VAR0))))) { + } else if (var_needs_point_coord(c, var)) { c->inputs[loc * 4 + 0] = c->point_x; c->inputs[loc * 4 + 1] = c->point_y; } else {