radeonsi: remove 8 bytes from si_shader_key by flattening opt.hw_vs
authorMarek Olšák <marek.olsak@amd.com>
Fri, 9 Jun 2017 15:15:07 +0000 (17:15 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 12 Jun 2017 16:24:37 +0000 (18:24 +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.c
src/gallium/drivers/radeonsi/si_state_shaders.c

index 2c92269a5755de16ebe4d7997d9bda192409534d..a6b7e5ebf53447defacb39f6935280a7f1c6b9d5 100644 (file)
@@ -2289,7 +2289,7 @@ static void si_llvm_export_vs(struct lp_build_tgsi_context *bld_base,
                                break;
                        /* fall through */
                default:
-                       if (shader->key.opt.hw_vs.kill_outputs &
+                       if (shader->key.opt.kill_outputs &
                            (1ull << si_shader_io_get_unique_index(semantic_name, semantic_index)))
                                export_param = false;
                }
@@ -2321,14 +2321,14 @@ handle_semantic:
                        target = V_008DFC_SQ_EXP_POS;
                        break;
                case TGSI_SEMANTIC_CLIPDIST:
-                       if (shader->key.opt.hw_vs.clip_disable) {
+                       if (shader->key.opt.clip_disable) {
                                semantic_name = TGSI_SEMANTIC_GENERIC;
                                goto handle_semantic;
                        }
                        target = V_008DFC_SQ_EXP_POS + 2 + semantic_index;
                        break;
                case TGSI_SEMANTIC_CLIPVERTEX:
-                       if (shader->key.opt.hw_vs.clip_disable)
+                       if (shader->key.opt.clip_disable)
                                continue;
                        si_llvm_emit_clipvertex(bld_base, pos_args, outputs[i].values);
                        continue;
@@ -5335,8 +5335,8 @@ static void si_dump_shader_key(unsigned processor, const struct si_shader *shade
             processor == PIPE_SHADER_TESS_EVAL ||
             processor == PIPE_SHADER_VERTEX) &&
            !key->as_es && !key->as_ls) {
-               fprintf(f, "  opt.hw_vs.kill_outputs = 0x%"PRIx64"\n", key->opt.hw_vs.kill_outputs);
-               fprintf(f, "  opt.hw_vs.clip_disable = %u\n", key->opt.hw_vs.clip_disable);
+               fprintf(f, "  opt.kill_outputs = 0x%"PRIx64"\n", key->opt.kill_outputs);
+               fprintf(f, "  opt.clip_disable = %u\n", key->opt.clip_disable);
        }
 }
 
index 7c04b7e2535dca53a68103d334ef366aa9abde68..de520a273637303ee6ce31afbd7a0860598b6baa 100644 (file)
@@ -500,10 +500,9 @@ struct si_shader_key {
 
        /* Optimization flags for asynchronous compilation only. */
        struct {
-               struct {
-                       uint64_t        kill_outputs; /* "get_unique_index" bits */
-                       unsigned        clip_disable:1;
-               } hw_vs; /* HW VS (it can be VS, TES, GS) */
+               /* For HW VS (it can be VS, TES, GS) */
+               uint64_t        kill_outputs; /* "get_unique_index" bits */
+               unsigned        clip_disable:1;
 
                /* For shaders where monolithic variants have better code.
                 *
index a8255f2fe724fb1f399f3ba2f972bd8796934198..27a88a8cef5e219dc4a3047166b44df224d3d191 100644 (file)
@@ -695,7 +695,7 @@ static void si_emit_clip_regs(struct si_context *sctx, struct r600_atom *atom)
        unsigned culldist_mask = vs_sel->culldist_mask;
        unsigned total_mask;
 
-       if (vs->key.opt.hw_vs.clip_disable) {
+       if (vs->key.opt.clip_disable) {
                assert(!info->culldist_writemask);
                clipdist_mask = 0;
                culldist_mask = 0;
index 677a6de88c20fdfa8e3a00bfa865c7d56a909e66..07e6a42857511ea16d0470984017b7cbb22a36b3 100644 (file)
@@ -1203,7 +1203,7 @@ static void si_shader_selector_key_hw_vs(struct si_context *sctx,
 {
        struct si_shader_selector *ps = sctx->ps_shader.cso;
 
-       key->opt.hw_vs.clip_disable =
+       key->opt.clip_disable =
                sctx->queued.named.rasterizer->clip_plane_enable == 0 &&
                (vs->info.clipdist_writemask ||
                 vs->info.writes_clipvertex) &&
@@ -1243,7 +1243,7 @@ static void si_shader_selector_key_hw_vs(struct si_context *sctx,
 
        uint64_t linked = outputs_written & inputs_read;
 
-       key->opt.hw_vs.kill_outputs = ~linked & outputs_written;
+       key->opt.kill_outputs = ~linked & outputs_written;
 }
 
 /* Compute the key for the hw shader variant */
@@ -2195,8 +2195,8 @@ static void si_update_clip_regs(struct si_context *sctx,
             old_hw_vs->culldist_mask != next_hw_vs->culldist_mask ||
             !old_hw_vs_variant ||
             !next_hw_vs_variant ||
-            old_hw_vs_variant->key.opt.hw_vs.clip_disable !=
-            next_hw_vs_variant->key.opt.hw_vs.clip_disable))
+            old_hw_vs_variant->key.opt.clip_disable !=
+            next_hw_vs_variant->key.opt.clip_disable))
                si_mark_atom_dirty(sctx, &sctx->clip_regs);
 }
 
@@ -3094,7 +3094,7 @@ bool si_update_shaders(struct si_context *sctx)
        struct si_compiler_ctx_state compiler_state;
        struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;
        struct si_shader *old_vs = si_get_vs_state(sctx);
-       bool old_clip_disable = old_vs ? old_vs->key.opt.hw_vs.clip_disable : false;
+       bool old_clip_disable = old_vs ? old_vs->key.opt.clip_disable : false;
        struct si_shader *old_ps = sctx->ps_shader.current;
        unsigned old_spi_shader_col_format =
                old_ps ? old_ps->key.part.ps.epilog.spi_shader_col_format : 0;
@@ -3199,7 +3199,7 @@ bool si_update_shaders(struct si_context *sctx)
 
        si_update_vgt_shader_config(sctx);
 
-       if (old_clip_disable != si_get_vs_state(sctx)->key.opt.hw_vs.clip_disable)
+       if (old_clip_disable != si_get_vs_state(sctx)->key.opt.clip_disable)
                si_mark_atom_dirty(sctx, &sctx->clip_regs);
 
        if (sctx->ps_shader.cso) {