tgsi/ureg: cleanup local temporary emission v2
Instead of emitting each temporary separately, emit them in a chunk. v2: keep separate function for emitting temps Signed-off-by: Christian König <christian.koenig@amd.com>
This commit is contained in:
parent
36320bfa54
commit
52947b93b2
|
@ -1260,24 +1260,23 @@ emit_decl_fs(struct ureg_program *ureg,
|
||||||
out[3].decl_semantic.Index = semantic_index;
|
out[3].decl_semantic.Index = semantic_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
static void emit_decl( struct ureg_program *ureg,
|
emit_decl_temps( struct ureg_program *ureg,
|
||||||
unsigned file,
|
unsigned first, unsigned last,
|
||||||
unsigned index,
|
boolean local )
|
||||||
boolean local )
|
|
||||||
{
|
{
|
||||||
union tgsi_any_token *out = get_tokens( ureg, DOMAIN_DECL, 2 );
|
union tgsi_any_token *out = get_tokens( ureg, DOMAIN_DECL, 2 );
|
||||||
|
|
||||||
out[0].value = 0;
|
out[0].value = 0;
|
||||||
out[0].decl.Type = TGSI_TOKEN_TYPE_DECLARATION;
|
out[0].decl.Type = TGSI_TOKEN_TYPE_DECLARATION;
|
||||||
out[0].decl.NrTokens = 2;
|
out[0].decl.NrTokens = 2;
|
||||||
out[0].decl.File = file;
|
out[0].decl.File = TGSI_FILE_TEMPORARY;
|
||||||
out[0].decl.UsageMask = TGSI_WRITEMASK_XYZW;
|
out[0].decl.UsageMask = TGSI_WRITEMASK_XYZW;
|
||||||
out[0].decl.Local = local;
|
out[0].decl.Local = local;
|
||||||
|
|
||||||
out[1].value = 0;
|
out[1].value = 0;
|
||||||
out[1].decl_range.First = index;
|
out[1].decl_range.First = first;
|
||||||
out[1].decl_range.Last = index;
|
out[1].decl_range.Last = last;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void emit_decl_range( struct ureg_program *ureg,
|
static void emit_decl_range( struct ureg_program *ureg,
|
||||||
|
@ -1535,16 +1534,13 @@ static void emit_decls( struct ureg_program *ureg )
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ureg->nr_temps) {
|
if (ureg->nr_temps) {
|
||||||
if (util_bitmask_get_first_index(ureg->local_temps) == UTIL_BITMASK_INVALID_INDEX) {
|
for (i = 0; i < ureg->nr_temps;) {
|
||||||
emit_decl_range( ureg,
|
boolean local = util_bitmask_get(ureg->local_temps, i);
|
||||||
TGSI_FILE_TEMPORARY,
|
unsigned first = i++;
|
||||||
0, ureg->nr_temps );
|
while (i < ureg->nr_temps && local == util_bitmask_get(ureg->local_temps, i))
|
||||||
|
++i;
|
||||||
|
|
||||||
} else {
|
emit_decl_temps( ureg, first, i - 1, local );
|
||||||
for (i = 0; i < ureg->nr_temps; i++) {
|
|
||||||
emit_decl( ureg, TGSI_FILE_TEMPORARY, i,
|
|
||||||
util_bitmask_get(ureg->local_temps, i) );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue