From 902dd50cf0f31fe1e730ee077c9e23716d06e066 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 31 Jul 2019 21:28:40 -0400 Subject: [PATCH] gallium: add AMD-specific compute TGSI enums for tgsi_to_nir --- src/gallium/auxiliary/tgsi/tgsi_strings.c | 2 ++ src/gallium/drivers/radeonsi/si_compute.c | 2 +- src/gallium/drivers/radeonsi/si_shader.c | 4 ++-- src/gallium/drivers/radeonsi/si_shader.h | 6 ------ src/gallium/drivers/radeonsi/si_shaderlib_tgsi.c | 4 ++-- src/gallium/include/pipe/p_shader_tokens.h | 2 ++ 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c index b997b53fa6e..558c33e5f89 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c @@ -108,6 +108,7 @@ const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] = "SUBGROUP_GT_MASK", "SUBGROUP_LE_MASK", "SUBGROUP_LT_MASK", + "CS_USER_DATA_AMD", }; const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] = @@ -160,6 +161,7 @@ const char *tgsi_property_names[TGSI_PROPERTY_COUNT] = "CS_FIXED_BLOCK_DEPTH", "MUL_ZERO_WINS", "VS_BLIT_SGPRS_AMD", + "CS_USER_DATA_COMPONENTS_AMD", }; const char *tgsi_return_type_names[TGSI_RETURN_TYPE_COUNT] = diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index 360b5a1b510..22975069c99 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -145,7 +145,7 @@ static void si_create_compute_state_async(void *job, int thread_index) sel->info.uses_block_size && sel->info.properties[TGSI_PROPERTY_CS_FIXED_BLOCK_WIDTH] == 0; program->num_cs_user_data_dwords = - sel->info.properties[TGSI_PROPERTY_CS_USER_DATA_DWORDS]; + sel->info.properties[TGSI_PROPERTY_CS_USER_DATA_COMPONENTS_AMD]; void *ir_binary = si_get_ir_binary(sel); diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index e191a4a9631..032b6c24965 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -2215,7 +2215,7 @@ void si_load_system_value(struct si_shader_context *ctx, break; } - case TGSI_SEMANTIC_CS_USER_DATA: + case TGSI_SEMANTIC_CS_USER_DATA_AMD: value = LLVMGetParam(ctx->main_fn, ctx->param_cs_user_data); break; @@ -4978,7 +4978,7 @@ static void create_function(struct si_shader_context *ctx) ctx->param_block_size = add_arg(&fninfo, ARG_SGPR, v3i32); unsigned cs_user_data_dwords = - shader->selector->info.properties[TGSI_PROPERTY_CS_USER_DATA_DWORDS]; + shader->selector->info.properties[TGSI_PROPERTY_CS_USER_DATA_COMPONENTS_AMD]; if (cs_user_data_dwords) { ctx->param_cs_user_data = add_arg(&fninfo, ARG_SGPR, LLVMVectorType(ctx->i32, cs_user_data_dwords)); diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index c942bd20ee7..0054a48ac15 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -261,18 +261,12 @@ enum { /* Values from set_tess_state. */ TGSI_SEMANTIC_DEFAULT_TESSOUTER_SI = TGSI_SEMANTIC_COUNT, TGSI_SEMANTIC_DEFAULT_TESSINNER_SI, - - /* Up to 4 dwords in user SGPRs for compute shaders. */ - TGSI_SEMANTIC_CS_USER_DATA, }; enum { /* Use a property enum that CS wouldn't use. */ TGSI_PROPERTY_CS_LOCAL_SIZE = TGSI_PROPERTY_FS_COORD_ORIGIN, - /* The number of used user data dwords in the range [1, 4]. */ - TGSI_PROPERTY_CS_USER_DATA_DWORDS = TGSI_PROPERTY_FS_COORD_PIXEL_CENTER, - /* These represent the number of SGPRs the shader uses. */ SI_VS_BLIT_SGPRS_POS = 3, SI_VS_BLIT_SGPRS_POS_COLOR = 7, diff --git a/src/gallium/drivers/radeonsi/si_shaderlib_tgsi.c b/src/gallium/drivers/radeonsi/si_shaderlib_tgsi.c index fcd885c080f..57f8aec550c 100644 --- a/src/gallium/drivers/radeonsi/si_shaderlib_tgsi.c +++ b/src/gallium/drivers/radeonsi/si_shaderlib_tgsi.c @@ -152,8 +152,8 @@ void *si_create_dma_compute_shader(struct pipe_context *ctx, struct ureg_src value; if (!is_copy) { - ureg_property(ureg, TGSI_PROPERTY_CS_USER_DATA_DWORDS, inst_dwords[0]); - value = ureg_DECL_system_value(ureg, TGSI_SEMANTIC_CS_USER_DATA, 0); + ureg_property(ureg, TGSI_PROPERTY_CS_USER_DATA_COMPONENTS_AMD, inst_dwords[0]); + value = ureg_DECL_system_value(ureg, TGSI_SEMANTIC_CS_USER_DATA_AMD, 0); } struct ureg_src tid = ureg_DECL_system_value(ureg, TGSI_SEMANTIC_THREAD_ID, 0); diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index 0c5ee580fb0..bff3b78ab24 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -208,6 +208,7 @@ enum tgsi_semantic { TGSI_SEMANTIC_SUBGROUP_GT_MASK, TGSI_SEMANTIC_SUBGROUP_LE_MASK, TGSI_SEMANTIC_SUBGROUP_LT_MASK, + TGSI_SEMANTIC_CS_USER_DATA_AMD, TGSI_SEMANTIC_COUNT, /**< number of semantic values */ }; @@ -302,6 +303,7 @@ enum tgsi_property_name { TGSI_PROPERTY_CS_FIXED_BLOCK_DEPTH, TGSI_PROPERTY_MUL_ZERO_WINS, TGSI_PROPERTY_VS_BLIT_SGPRS_AMD, + TGSI_PROPERTY_CS_USER_DATA_COMPONENTS_AMD, TGSI_PROPERTY_COUNT, }; -- 2.30.2