From 62abdb17bb717c3aa50ee614f2fe4cd808468d63 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 6 Apr 2017 22:55:06 +0200 Subject: [PATCH] radeonsi/gfx9: add initial code generation for non-monolithic merged LS-HS MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_shader.c | 16 +++++++++++++++- src/gallium/drivers/radeonsi/si_shader.h | 2 ++ src/gallium/drivers/radeonsi/si_state_shaders.c | 6 ++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 8b467ea342d..b7d3514def2 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -6693,6 +6693,10 @@ static void si_dump_shader_key(unsigned processor, struct si_shader *shader, break; case PIPE_SHADER_TESS_CTRL: + if (shader->selector->screen->b.chip_class >= GFX9) { + si_dump_shader_key_vs(key, &key->part.tcs.ls_prolog, + "part.tcs.ls_prolog", f); + } fprintf(f, " part.tcs.epilog.prim_mode = %u\n", key->part.tcs.epilog.prim_mode); fprintf(f, " mono.ff_tcs_inputs_to_copy = 0x%"PRIx64"\n", key->mono.ff_tcs_inputs_to_copy); break; @@ -8007,9 +8011,19 @@ static bool si_shader_select_tcs_parts(struct si_screen *sscreen, struct si_shader *shader, struct pipe_debug_callback *debug) { - union si_shader_part_key epilog_key; + if (sscreen->b.chip_class >= GFX9) { + struct si_shader *ls_main_part = + shader->key.part.tcs.ls->main_shader_part_ls; + + if (!si_get_vs_prolog(sscreen, tm, shader, debug, ls_main_part, + &shader->key.part.tcs.ls_prolog)) + return false; + + shader->previous_stage = ls_main_part; + } /* Get the epilog. */ + union si_shader_part_key epilog_key; memset(&epilog_key, 0, sizeof(epilog_key)); epilog_key.tcs_epilog.states = shader->key.part.tcs.epilog; diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 65da65469b9..90d8a18e174 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -435,6 +435,8 @@ struct si_shader_key { struct si_vs_epilog_bits epilog; } vs; struct { + struct si_vs_prolog_bits ls_prolog; /* for merged LS-HS */ + struct si_shader_selector *ls; /* for merged LS-HS */ struct si_tcs_epilog_bits epilog; } tcs; /* tessellation control shader */ struct { diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 0be8252af5f..4403903eab9 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -1060,6 +1060,12 @@ static inline void si_shader_selector_key(struct pipe_context *ctx, } break; case PIPE_SHADER_TESS_CTRL: + if (sctx->b.chip_class >= GFX9) { + si_shader_selector_key_vs(sctx, sctx->vs_shader.cso, + key, &key->part.tcs.ls_prolog); + key->part.tcs.ls = sctx->vs_shader.cso; + } + key->part.tcs.epilog.prim_mode = sctx->tes_shader.cso->info.properties[TGSI_PROPERTY_TES_PRIM_MODE]; key->part.tcs.epilog.tes_reads_tess_factors = -- 2.30.2