radeonsi/gfx9: add initial code generation for non-monolithic merged LS-HS
authorMarek Olšák <marek.olsak@amd.com>
Thu, 6 Apr 2017 20:55:06 +0000 (22:55 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 28 Apr 2017 19:47:35 +0000 (21:47 +0200)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_shader.c
src/gallium/drivers/radeonsi/si_shader.h
src/gallium/drivers/radeonsi/si_state_shaders.c

index 8b467ea342dfb660fd400546e9cac7b0b48fbf17..b7d3514def2f94db281bf16bcafcfa1ab425eaca 100644 (file)
@@ -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;
 
index 65da65469b99f7d475174000c4017559f4a743da..90d8a18e17484014d57a9ff81a1842af41452bae 100644 (file)
@@ -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 {
index 0be8252af5f35473b3926b9afbb3aac75009826d..4403903eab991279c9d0607ae1f26c521747c0fb 100644 (file)
@@ -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 =