Mesa (master): radeonsi: turn si_shader_key::mono into a non-union
Marek Olšák
mareko at kemper.freedesktop.org
Wed Apr 26 11:23:41 UTC 2017
Module: Mesa
Branch: master
Commit: 96b0cfc82ef08c0a81016278c69f24766f2410b2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=96b0cfc82ef08c0a81016278c69f24766f2410b2
Author: Marek Olšák <marek.olsak at amd.com>
Date: Tue Feb 14 22:23:04 2017 +0100
radeonsi: turn si_shader_key::mono into a non-union
A merged LS-HS shader needs both fix_fetch and inputs_to_copy
for compilation.
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
src/gallium/drivers/radeonsi/si_shader.c | 10 +++++-----
src/gallium/drivers/radeonsi/si_shader.h | 12 ++++--------
src/gallium/drivers/radeonsi/si_state_shaders.c | 4 ++--
3 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index bbb1c13cf2..3c2c7f5c75 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -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:
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index cfa691b058..05c0e623b4 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -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. */
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 3a604eb660..8afc731491 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -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)
More information about the mesa-commit
mailing list