radeonsi: turn si_shader_key::mono into a non-union
authorMarek Olšák <marek.olsak@amd.com>
Tue, 14 Feb 2017 21:23:04 +0000 (22:23 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 26 Apr 2017 11:08:05 +0000 (13:08 +0200)
A merged LS-HS shader needs both fix_fetch and inputs_to_copy
for compilation.

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 bbb1c13..3c2c7f5 100644 (file)
@@ -364,7 +364,7 @@ static void declare_input_vs(
                                    ctx->param_vertex_index0 +
                                    input_index);
 
-       fix_fetch = ctx->shader->key.mono.vs.fix_fetch[input_index];
+       fix_fetch = ctx->shader->key.mono.vs_fix_fetch[input_index];
 
        /* Do multiple loads for special formats. */
        switch (fix_fetch) {
@@ -2427,7 +2427,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.tcs.inputs_to_copy;
+       inputs = ctx->shader->key.mono.ff_tcs_inputs_to_copy;
        while (inputs) {
                unsigned i = u_bit_scan64(&inputs);
 
@@ -6661,15 +6661,15 @@ static void si_dump_shader_key(unsigned shader, struct si_shader_key *key,
                fprintf(f, "  as_es = %u\n", key->as_es);
                fprintf(f, "  as_ls = %u\n", key->as_ls);
 
-               fprintf(f, "  mono.vs.fix_fetch = {");
+               fprintf(f, "  mono.vs_fix_fetch = {");
                for (i = 0; i < SI_MAX_ATTRIBS; i++)
-                       fprintf(f, !i ? "%u" : ", %u", key->mono.vs.fix_fetch[i]);
+                       fprintf(f, !i ? "%u" : ", %u", key->mono.vs_fix_fetch[i]);
                fprintf(f, "}\n");
                break;
 
        case PIPE_SHADER_TESS_CTRL:
                fprintf(f, "  part.tcs.epilog.prim_mode = %u\n", key->part.tcs.epilog.prim_mode);
-               fprintf(f, "  mono.tcs.inputs_to_copy = 0x%"PRIx64"\n", key->mono.tcs.inputs_to_copy);
+               fprintf(f, "  mono.ff_tcs_inputs_to_copy = 0x%"PRIx64"\n", key->mono.ff_tcs_inputs_to_copy);
                break;
 
        case PIPE_SHADER_TESS_EVAL:
index cfa691b..05c0e62 100644 (file)
@@ -451,14 +451,10 @@ struct si_shader_key {
        unsigned as_ls:1; /* local shader, which precedes TCS */
 
        /* Flags for monolithic compilation only. */
-       union {
-               struct {
-                       /* One byte for every input: SI_FIX_FETCH_* enums. */
-                       uint8_t         fix_fetch[SI_MAX_ATTRIBS];
-               } vs;
-               struct {
-                       uint64_t        inputs_to_copy; /* for fixed-func TCS */
-               } tcs;
+       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 */
        } mono;
 
        /* Optimization flags for asynchronous compilation only. */
index 3a604eb..8afc731 100644 (file)
@@ -1035,7 +1035,7 @@ static inline void si_shader_selector_key(struct pipe_context *ctx,
                                key->part.vs.prolog.instance_divisors[i] =
                                        sctx->vertex_elements->elements[i].instance_divisor;
 
-                       memcpy(key->mono.vs.fix_fetch,
+                       memcpy(key->mono.vs_fix_fetch,
                               sctx->vertex_elements->fix_fetch, count);
                }
                if (sctx->tes_shader.cso)
@@ -1056,7 +1056,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.tcs.inputs_to_copy = sctx->vs_shader.cso->outputs_written;
+                       key->mono.ff_tcs_inputs_to_copy = sctx->vs_shader.cso->outputs_written;
                break;
        case PIPE_SHADER_TESS_EVAL:
                if (sctx->gs_shader.cso)