[Mesa-dev] [PATCH 3/3] radeonsi: fix passing gl_ClipVertex for GS and tess
Nicolai Hähnle
nhaehnle at gmail.com
Thu May 24 08:27:42 UTC 2018
On 23.05.2018 23:05, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> Also add the printf call.
> ---
> src/gallium/drivers/radeonsi/si_shader.c | 5 ++++-
> src/gallium/drivers/radeonsi/si_shader.h | 2 +-
> src/gallium/drivers/radeonsi/si_state_shaders.c | 5 +++--
> 3 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index 6734a1628f5..510ddf71a36 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -226,23 +226,26 @@ unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index,
> return SI_MAX_IO_GENERIC + 8 + index;
> case TGSI_SEMANTIC_BCOLOR:
> assert(index < 2);
> /* If it's a varying, COLOR and BCOLOR alias. */
> if (is_varying)
> return SI_MAX_IO_GENERIC + 8 + index;
> else
> return SI_MAX_IO_GENERIC + 10 + index;
> case TGSI_SEMANTIC_TEXCOORD:
> assert(index < 8);
> - STATIC_ASSERT(SI_MAX_IO_GENERIC + 12 + 8 <= 64);
> + STATIC_ASSERT(SI_MAX_IO_GENERIC + 12 + 8 <= 63);
> return SI_MAX_IO_GENERIC + 12 + index;
> + case TGSI_SEMANTIC_CLIPVERTEX:
> + return 63;
> default:
> + printf("name=%u\n", semantic_name);
fprintf(stderr, ...);
Apart from that, the series is
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
> assert(!"invalid semantic name");
> return 0;
> }
> }
>
> /**
> * Get the value of a shader input parameter and extract a bitfield.
> */
> static LLVMValueRef unpack_llvm_param(struct si_shader_context *ctx,
> LLVMValueRef value, unsigned rshift,
> diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
> index 555ca598d2c..9e8d5736259 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.h
> +++ b/src/gallium/drivers/radeonsi/si_shader.h
> @@ -145,21 +145,21 @@
> struct nir_shader;
> struct si_shader;
> struct si_context;
>
> #define SI_MAX_ATTRIBS 16
> #define SI_MAX_VS_OUTPUTS 40
>
> /* Shader IO unique indices are supported for TGSI_SEMANTIC_GENERIC with an
> * index smaller than this.
> */
> -#define SI_MAX_IO_GENERIC 44
> +#define SI_MAX_IO_GENERIC 43
>
> /* SGPR user data indices */
> enum {
> SI_SGPR_RW_BUFFERS, /* rings (& stream-out, VS only) */
> #if !HAVE_32BIT_POINTERS
> SI_SGPR_RW_BUFFERS_HI,
> #endif
> SI_SGPR_BINDLESS_SAMPLERS_AND_IMAGES,
> #if !HAVE_32BIT_POINTERS
> SI_SGPR_BINDLESS_SAMPLERS_AND_IMAGES_HI,
> diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
> index 4d17082dd9b..9c66c5e9d53 100644
> --- a/src/gallium/drivers/radeonsi/si_state_shaders.c
> +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
> @@ -1219,23 +1219,24 @@ static void si_shader_selector_key_hw_vs(struct si_context *sctx,
> ps_disabled = sctx->queued.named.rasterizer->rasterizer_discard ||
> (!ps_colormask &&
> !ps_modifies_zs &&
> !ps->info.writes_memory);
> }
>
> /* Find out which VS outputs aren't used by the PS. */
> uint64_t outputs_written = vs->outputs_written_before_ps;
> uint64_t inputs_read = 0;
>
> - /* ignore POSITION, PSIZE */
> + /* Ignore outputs that are not passed from VS to PS. */
> outputs_written &= ~((1ull << si_shader_io_get_unique_index(TGSI_SEMANTIC_POSITION, 0, true)) |
> - (1ull << si_shader_io_get_unique_index(TGSI_SEMANTIC_PSIZE, 0, true)));
> + (1ull << si_shader_io_get_unique_index(TGSI_SEMANTIC_PSIZE, 0, true)) |
> + (1ull << si_shader_io_get_unique_index(TGSI_SEMANTIC_CLIPVERTEX, 0, true)));
>
> if (!ps_disabled) {
> inputs_read = ps->inputs_read;
> }
>
> uint64_t linked = outputs_written & inputs_read;
>
> key->opt.kill_outputs = ~linked & outputs_written;
> }
>
>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the mesa-dev
mailing list