From: Marek Olšák Date: Thu, 1 Jun 2017 20:37:25 +0000 (+0200) Subject: radeonsi: remove 8 bytes from si_shader_key X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e9409c86e7b076801626474dfa5a9151da078a73;p=mesa.git radeonsi: remove 8 bytes from si_shader_key We can use a union in si_shader_key::mono. Reviewed-by: Samuel Pitoiset Reviewed-by: Nicolai Hähnle --- diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 5c7deeb250e..2c92269a575 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -2492,7 +2492,7 @@ static void si_copy_tcs_inputs(struct lp_build_tgsi_context *bld_base) lds_base = get_tcs_in_current_patch_offset(ctx); lds_base = LLVMBuildAdd(gallivm->builder, lds_base, lds_vertex_offset, ""); - inputs = ctx->shader->key.mono.ff_tcs_inputs_to_copy; + inputs = ctx->shader->key.mono.u.ff_tcs_inputs_to_copy; while (inputs) { unsigned i = u_bit_scan64(&inputs); @@ -3019,7 +3019,7 @@ static void si_llvm_emit_vs_epilogue(struct lp_build_tgsi_context *bld_base) si_llvm_emit_streamout(ctx, outputs, i, 0); /* Export PrimitiveID. */ - if (ctx->shader->key.mono.vs_export_prim_id) { + if (ctx->shader->key.mono.u.vs_export_prim_id) { outputs[i].semantic_name = TGSI_SEMANTIC_PRIMID; outputs[i].semantic_index = 0; outputs[i].values[0] = bitcast(bld_base, TGSI_TYPE_FLOAT, @@ -5273,8 +5273,8 @@ static void si_dump_shader_key(unsigned processor, const struct si_shader *shade "part.vs.prolog", f); fprintf(f, " as_es = %u\n", key->as_es); fprintf(f, " as_ls = %u\n", key->as_ls); - fprintf(f, " mono.vs_export_prim_id = %u\n", - key->mono.vs_export_prim_id); + fprintf(f, " mono.u.vs_export_prim_id = %u\n", + key->mono.u.vs_export_prim_id); break; case PIPE_SHADER_TESS_CTRL: @@ -5283,13 +5283,13 @@ static void si_dump_shader_key(unsigned processor, const struct si_shader *shade "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); + fprintf(f, " mono.u.ff_tcs_inputs_to_copy = 0x%"PRIx64"\n", key->mono.u.ff_tcs_inputs_to_copy); break; case PIPE_SHADER_TESS_EVAL: fprintf(f, " as_es = %u\n", key->as_es); - fprintf(f, " mono.vs_export_prim_id = %u\n", - key->mono.vs_export_prim_id); + fprintf(f, " mono.u.vs_export_prim_id = %u\n", + key->mono.u.vs_export_prim_id); break; case PIPE_SHADER_GEOMETRY: diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 71126219ceb..f739769af3f 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -487,9 +487,12 @@ struct si_shader_key { struct { /* One byte for every input: SI_FIX_FETCH_* enums. */ uint8_t vs_fix_fetch[SI_MAX_ATTRIBS]; - uint64_t ff_tcs_inputs_to_copy; /* for fixed-func TCS */ - /* When PS needs PrimID and GS is disabled. */ - unsigned vs_export_prim_id:1; + + union { + uint64_t ff_tcs_inputs_to_copy; /* for fixed-func TCS */ + /* When PS needs PrimID and GS is disabled. */ + unsigned vs_export_prim_id:1; + } u; } mono; /* Optimization flags for asynchronous compilation only. */ diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 41f8bdf9a54..7ed6722c26e 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -843,7 +843,7 @@ static void si_shader_vs(struct si_screen *sscreen, struct si_shader *shader, unsigned oc_lds_en; unsigned window_space = shader->selector->info.properties[TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION]; - bool enable_prim_id = shader->key.mono.vs_export_prim_id || shader->selector->info.uses_primid; + bool enable_prim_id = shader->key.mono.u.vs_export_prim_id || shader->selector->info.uses_primid; pm4 = si_get_shader_pm4_state(shader); if (!pm4) @@ -1267,7 +1267,7 @@ static inline void si_shader_selector_key(struct pipe_context *ctx, si_shader_selector_key_hw_vs(sctx, sel, key); if (sctx->ps_shader.cso && sctx->ps_shader.cso->info.uses_primid) - key->mono.vs_export_prim_id = 1; + key->mono.u.vs_export_prim_id = 1; } break; case PIPE_SHADER_TESS_CTRL: @@ -1283,7 +1283,7 @@ static inline void si_shader_selector_key(struct pipe_context *ctx, sctx->tes_shader.cso->info.reads_tess_factors; if (sel == sctx->fixed_func_tcs_shader.cso) - key->mono.ff_tcs_inputs_to_copy = sctx->vs_shader.cso->outputs_written; + key->mono.u.ff_tcs_inputs_to_copy = sctx->vs_shader.cso->outputs_written; break; case PIPE_SHADER_TESS_EVAL: if (sctx->gs_shader.cso) @@ -1292,7 +1292,7 @@ static inline void si_shader_selector_key(struct pipe_context *ctx, si_shader_selector_key_hw_vs(sctx, sel, key); if (sctx->ps_shader.cso && sctx->ps_shader.cso->info.uses_primid) - key->mono.vs_export_prim_id = 1; + key->mono.u.vs_export_prim_id = 1; } break; case PIPE_SHADER_GEOMETRY: