From e86256c51229c135bc4861018c16b9a8f1c255a6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolai=20H=C3=A4hnle?= Date: Fri, 17 Nov 2017 13:40:18 +0100 Subject: [PATCH] radeonsi/gfx10: distinguish between merged shaders and multi-part shaders Acked-by: Bas Nieuwenhuizen --- src/gallium/drivers/radeonsi/si_shader.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index fdb4346f7fd..b6410c62448 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -83,7 +83,8 @@ static bool llvm_type_is_64bit(struct si_shader_context *ctx, return false; } -static bool is_merged_shader(struct si_shader_context *ctx) +/** Whether the shader runs as a combination of multiple API shaders */ +static bool is_multi_part_shader(struct si_shader_context *ctx) { if (ctx->screen->info.chip_class <= GFX8) return false; @@ -94,6 +95,12 @@ static bool is_merged_shader(struct si_shader_context *ctx) ctx->type == PIPE_SHADER_GEOMETRY; } +/** Whether the shader runs on a merged HW stage (LSHS or ESGS) */ +static bool is_merged_shader(struct si_shader_context *ctx) +{ + return ctx->shader->key.as_ngg || is_multi_part_shader(ctx); +} + void si_init_function_info(struct si_function_info *fninfo) { fninfo->num_params = 0; @@ -6543,7 +6550,7 @@ static void si_build_wrapper_function(struct si_shader_context *ctx, /* Merged shaders are executed conditionally depending * on the number of enabled threads passed in the input SGPRs. */ - if (is_merged_shader(ctx) && part == 0) { + if (is_multi_part_shader(ctx) && part == 0) { LLVMValueRef ena, count = initial[3]; count = LLVMBuildAnd(builder, count, @@ -6605,7 +6612,7 @@ static void si_build_wrapper_function(struct si_shader_context *ctx, ret = ac_build_call(&ctx->ac, parts[part], in, num_params); - if (is_merged_shader(ctx) && + if (is_multi_part_shader(ctx) && part + 1 == next_shader_first_part) { lp_build_endif(&if_state); -- 2.30.2