[Mesa-dev] [PATCH 03/13] radeonsi: remove 8 bytes from si_shader_key with uint32_t ff_tcs_inputs_to_copy
Marek Olšák
maraeo at gmail.com
Sat Jun 10 16:39:41 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
The previous patch helps with this.
---
src/gallium/drivers/radeonsi/si_shader.c | 8 ++++++--
src/gallium/drivers/radeonsi/si_shader.h | 3 ++-
src/gallium/drivers/radeonsi/si_state_shaders.c | 8 ++++++--
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 4ee4a64..e525a18 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2486,21 +2486,22 @@ static void si_copy_tcs_inputs(struct lp_build_tgsi_context *bld_base)
invocation_id = unpack_param(ctx, ctx->param_tcs_rel_ids, 8, 5);
buffer = desc_from_addr_base64k(ctx, ctx->param_tcs_offchip_addr_base64k);
buffer_offset = LLVMGetParam(ctx->main_fn, ctx->param_tcs_offchip_offset);
lds_vertex_stride = unpack_param(ctx, ctx->param_vs_state_bits, 24, 8);
lds_vertex_offset = LLVMBuildMul(gallivm->builder, invocation_id,
lds_vertex_stride, "");
lds_base = get_tcs_in_current_patch_offset(ctx);
lds_base = LLVMBuildAdd(gallivm->builder, lds_base, lds_vertex_offset, "");
- inputs = ctx->shader->key.mono.u.ff_tcs_inputs_to_copy;
+ inputs = ctx->shader->key.mono.u.ff_tcs_inputs_to_copy[0] |
+ ((uint64_t)ctx->shader->key.mono.u.ff_tcs_inputs_to_copy[1] << 32);
while (inputs) {
unsigned i = u_bit_scan64(&inputs);
LLVMValueRef lds_ptr = LLVMBuildAdd(gallivm->builder, lds_base,
LLVMConstInt(ctx->i32, 4 * i, 0),
"");
LLVMValueRef buffer_addr = get_tcs_tes_buffer_address(ctx,
get_rel_patch_id(ctx),
invocation_id,
@@ -5277,21 +5278,24 @@ static void si_dump_shader_key(unsigned processor, const struct si_shader *shade
fprintf(f, " mono.u.vs_export_prim_id = %u\n",
key->mono.u.vs_export_prim_id);
break;
case PIPE_SHADER_TESS_CTRL:
if (shader->selector->screen->b.chip_class >= GFX9) {
si_dump_shader_key_vs(key, &key->part.tcs.ls_prolog,
"part.tcs.ls_prolog", f);
}
fprintf(f, " part.tcs.epilog.prim_mode = %u\n", key->part.tcs.epilog.prim_mode);
- fprintf(f, " mono.u.ff_tcs_inputs_to_copy = 0x%"PRIx64"\n", key->mono.u.ff_tcs_inputs_to_copy);
+ fprintf(f, " mono.u.ff_tcs_inputs_to_copy[0] = 0x%x\n",
+ key->mono.u.ff_tcs_inputs_to_copy[0]);
+ fprintf(f, " mono.u.ff_tcs_inputs_to_copy[1] = 0x%x\n",
+ key->mono.u.ff_tcs_inputs_to_copy[1]);
break;
case PIPE_SHADER_TESS_EVAL:
fprintf(f, " as_es = %u\n", key->as_es);
fprintf(f, " mono.u.vs_export_prim_id = %u\n",
key->mono.u.vs_export_prim_id);
break;
case PIPE_SHADER_GEOMETRY:
if (shader->is_gs_copy_shader)
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index 76e09b2..ed1df2b 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -485,21 +485,22 @@ struct si_shader_key {
*/
unsigned as_es:1; /* export shader, which precedes GS */
unsigned as_ls:1; /* local shader, which precedes TCS */
/* Flags for monolithic compilation only. */
struct {
/* One byte for every input: SI_FIX_FETCH_* enums. */
uint8_t vs_fix_fetch[SI_MAX_ATTRIBS];
union {
- uint64_t ff_tcs_inputs_to_copy; /* for fixed-func TCS */
+ /* Don't use "uint64_t" in order to get 32-bit alignment. */
+ uint32_t ff_tcs_inputs_to_copy[2]; /* 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. */
struct {
/* For HW VS (it can be VS, TES, GS) */
/* Don't use "uint64_t" in order to get 32-bit alignment. */
uint32_t kill_outputs[2]; /* "get_unique_index" bits */
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 15e46b5..6247b9c 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -1276,22 +1276,26 @@ static inline void si_shader_selector_key(struct pipe_context *ctx,
si_shader_selector_key_vs(sctx, sctx->vs_shader.cso,
key, &key->part.tcs.ls_prolog);
key->part.tcs.ls = sctx->vs_shader.cso;
}
key->part.tcs.epilog.prim_mode =
sctx->tes_shader.cso->info.properties[TGSI_PROPERTY_TES_PRIM_MODE];
key->part.tcs.epilog.tes_reads_tess_factors =
sctx->tes_shader.cso->info.reads_tess_factors;
- if (sel == sctx->fixed_func_tcs_shader.cso)
- key->mono.u.ff_tcs_inputs_to_copy = sctx->vs_shader.cso->outputs_written;
+ if (sel == sctx->fixed_func_tcs_shader.cso) {
+ uint64_t outputs_written = sctx->vs_shader.cso->outputs_written;
+
+ key->mono.u.ff_tcs_inputs_to_copy[0] = outputs_written;
+ key->mono.u.ff_tcs_inputs_to_copy[1] = outputs_written >> 32;
+ }
break;
case PIPE_SHADER_TESS_EVAL:
if (sctx->gs_shader.cso)
key->as_es = 1;
else {
si_shader_selector_key_hw_vs(sctx, sel, key);
if (sctx->ps_shader.cso && sctx->ps_shader.cso->info.uses_primid)
key->mono.u.vs_export_prim_id = 1;
}
--
2.7.4
More information about the mesa-dev
mailing list