From: Marek Olšák Date: Fri, 9 Jun 2017 15:15:07 +0000 (+0200) Subject: radeonsi: remove 8 bytes from si_shader_key by flattening opt.hw_vs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1621b33d73894e7c0c3e2b7252adfcd107d7ebd5;p=mesa.git radeonsi: remove 8 bytes from si_shader_key by flattening opt.hw_vs Reviewed-by: Nicolai Hähnle --- diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 2c92269a575..a6b7e5ebf53 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -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); } } diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 7c04b7e2535..de520a27363 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -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. * diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index a8255f2fe72..27a88a8cef5 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -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; diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 677a6de88c2..07e6a428575 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -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) {