From 3263c9824ebf35a24380e401bb1b1852d538a46d Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 4 Dec 2019 09:26:46 +1000 Subject: [PATCH] llvmpipe: enable texcoord semantics To make NIR transitioning easier, move the driver to using texcoord semantics. Reviewed-by: Eric Anholt --- src/gallium/drivers/llvmpipe/lp_screen.c | 2 +- src/gallium/drivers/llvmpipe/lp_setup_point.c | 26 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 0814145512c..ce41baa529b 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -227,8 +227,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY: case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: - case PIPE_CAP_TGSI_TEXCOORD: return 0; + case PIPE_CAP_TGSI_TEXCOORD: case PIPE_CAP_DRAW_INDIRECT: return 1; diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 0c4b1b758f9..073ca5b1c88 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -241,27 +241,35 @@ setup_point_coefficients( struct lp_setup_context *setup, case LP_INTERP_LINEAR: /* Sprite tex coords may use linear interpolation someday */ /* fall-through */ - case LP_INTERP_PERSPECTIVE: + case LP_INTERP_PERSPECTIVE: { /* check if the sprite coord flag is set for this attribute. * If so, set it up so it up so x and y vary from 0 to 1. */ - if (shader->info.base.input_semantic_name[slot] == TGSI_SEMANTIC_GENERIC) { + bool do_texcoord_coef = false; + if (shader->info.base.input_semantic_name[slot] == TGSI_SEMANTIC_PCOORD) { + do_texcoord_coef = true; + } + else if (shader->info.base.input_semantic_name[slot] == TGSI_SEMANTIC_TEXCOORD) { unsigned semantic_index = shader->info.base.input_semantic_index[slot]; /* Note that sprite_coord enable is a bitfield of * PIPE_MAX_SHADER_OUTPUTS bits. */ if (semantic_index < PIPE_MAX_SHADER_OUTPUTS && (setup->sprite_coord_enable & (1u << semantic_index))) { - for (i = 0; i < NUM_CHANNELS; i++) { - if (usage_mask & (1 << i)) { - texcoord_coef(setup, info, slot + 1, i, - setup->sprite_coord_origin, - perspective); - } + do_texcoord_coef = true; + } + } + if (do_texcoord_coef) { + for (i = 0; i < NUM_CHANNELS; i++) { + if (usage_mask & (1 << i)) { + texcoord_coef(setup, info, slot + 1, i, + setup->sprite_coord_origin, + perspective); } - break; } + break; } + } /* fall-through */ case LP_INTERP_CONSTANT: for (i = 0; i < NUM_CHANNELS; i++) { -- 2.30.2