radeonsi: remove 8 bytes from si_shader_key
authorMarek Olšák <marek.olsak@amd.com>
Thu, 1 Jun 2017 20:37:25 +0000 (22:37 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 7 Jun 2017 18:17:06 +0000 (20:17 +0200)
We can use a union in si_shader_key::mono.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
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 5c7deeb250ec49429fbb2abf43a5ca70dbcae98a..2c92269a5755de16ebe4d7997d9bda192409534d 100644 (file)
@@ -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:
index 71126219cebc4f92f559c1d4024cf305c9830baa..f739769af3ffab21f5d6d250fdfa37512e75c5f3 100644 (file)
@@ -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. */
index 41f8bdf9a544e1b10444c50c42ae246bc07d885b..7ed6722c26e64e98dd541ff73d28a3b2316aba86 100644 (file)
@@ -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: