From 7091fe887b3b676fe70c44ff10e5027f4b44513d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolai=20H=C3=A4hnle?= Date: Wed, 10 May 2017 09:55:36 +0200 Subject: [PATCH] radeonsi: use SI_MAX_IO_GENERIC instead of magic values MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Tested-by: Dieter Nützel Reviewed-by: Marek Olšák --- src/gallium/drivers/radeonsi/si_shader.c | 2 +- src/gallium/drivers/radeonsi/si_shader.h | 5 +++++ src/gallium/drivers/radeonsi/si_state_shaders.c | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index b969376e9d2..bdc9cc10fab 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -142,7 +142,7 @@ unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index) assert(index <= 1); return 2 + index; case TGSI_SEMANTIC_GENERIC: - if (index <= 63-4) + if (index < SI_MAX_IO_GENERIC) return 4 + index; assert(!"invalid generic index"); diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index b49dca4ef77..cf97a719f2d 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -145,6 +145,11 @@ struct ac_shader_binary; #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 60 + /* SGPR user data indices */ enum { /* GFX9 merged shaders have RW_BUFFERS among the first 8 system SGPRs, diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 11e3dab2d7d..8193fe041dd 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -1843,7 +1843,7 @@ void si_init_shader_selector_async(void *job, int thread_index) switch (name) { case TGSI_SEMANTIC_GENERIC: /* don't process indices the function can't handle */ - if (index >= 60) + if (index >= SI_MAX_IO_GENERIC) break; /* fall through */ case TGSI_SEMANTIC_CLIPDIST: @@ -2000,7 +2000,7 @@ static void *si_create_shader_selector(struct pipe_context *ctx, case TGSI_SEMANTIC_GENERIC: /* don't process indices the function can't handle */ - if (index >= 60) + if (index >= SI_MAX_IO_GENERIC) break; /* fall through */ case TGSI_SEMANTIC_POSITION: -- 2.30.2