From 022c363cfbb7e37eef5d5b7559d24f8237a72f27 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Mon, 22 Jun 2020 08:24:55 -0700 Subject: [PATCH] freedreno/ir3: add helper to determine point-coord inputs This will simplify a bit the logic for setting up vinterp/vprepl in the driver backend, and also avoid it being a flag-day when we switch the texcoord pipe cap. Signed-off-by: Rob Clark Part-of: --- src/freedreno/ir3/ir3_shader.h | 2 -- .../drivers/freedreno/ir3/ir3_gallium.h | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/freedreno/ir3/ir3_shader.h b/src/freedreno/ir3/ir3_shader.h index 5ccbd8cb658..3e7ee89debe 100644 --- a/src/freedreno/ir3/ir3_shader.h +++ b/src/freedreno/ir3/ir3_shader.h @@ -769,8 +769,6 @@ struct ir3_shader_linkage { static inline void ir3_link_add(struct ir3_shader_linkage *l, uint8_t regid_, uint8_t compmask, uint8_t loc) { - - for (int j = 0; j < util_last_bit(compmask); j++) { uint8_t comploc = loc + j; l->varmask[comploc / 32] |= 1 << (comploc % 32); diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.h b/src/gallium/drivers/freedreno/ir3/ir3_gallium.h index 0f103388b67..e0a8d20e88d 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.h +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.h @@ -49,4 +49,22 @@ void ir3_shader_state_delete(struct pipe_context *pctx, void *hwcso); void ir3_prog_init(struct pipe_context *pctx); +/** + * A helper to determine if a fs input 'i' is point/sprite coord, given + * the specified sprite_coord_enable mask + */ +static inline bool +ir3_point_sprite(const struct ir3_shader_variant *fs, int i, + uint32_t sprite_coord_enable, bool *coord_mode) +{ + gl_varying_slot slot = fs->inputs[i].slot; + (void)coord_mode; /* this will be used later */ + /* since we don't enable PIPE_CAP_TGSI_TEXCOORD: */ + if (slot >= VARYING_SLOT_VAR0) { + unsigned texmask = 1 << (slot - VARYING_SLOT_VAR0); + return !!(sprite_coord_enable & texmask); + } + return false; +} + #endif /* IR3_GALLIUM_H_ */ -- 2.30.2