summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2012-02-14 19:30:23 -0500
committerTom Stellard <thomas.stellard@amd.com>2012-02-14 19:30:23 -0500
commitfa64d58da7298d7eba8676d55982e3e1778a5263 (patch)
treedc4716679c7a3f85734a35455e0f233e7cc438a2
parent310de137d36836603d910e1d15fecbc86faa45a2 (diff)
Revert "tgsi/ureg: Support local temp emission."
This reverts commit 3b4220ee93a78afc4c0d01b332619aa0f5934817. This breaks temp declarations
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_ureg.c71
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_ureg.h3
2 files changed, 21 insertions, 53 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 18739d0b324..75be6cf81dc 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -36,7 +36,6 @@
#include "util/u_debug.h"
#include "util/u_memory.h"
#include "util/u_math.h"
-#include "util/u_dynarray.h"
union tgsi_any_token {
struct tgsi_header header;
@@ -76,6 +75,7 @@ struct ureg_tokens {
#define UREG_MAX_OUTPUT PIPE_MAX_ATTRIBS
#define UREG_MAX_CONSTANT_RANGE 32
#define UREG_MAX_IMMEDIATE 256
+#define UREG_MAX_TEMP 256
#define UREG_MAX_ADDR 2
#define UREG_MAX_PRED 1
@@ -151,8 +151,7 @@ struct ureg_program
} resource[PIPE_MAX_SHADER_RESOURCES];
unsigned nr_resources;
- struct util_dynarray temps_active;
- struct util_dynarray local_temps;
+ unsigned temps_active[UREG_MAX_TEMP / 32];
unsigned nr_temps;
struct const_decl const_decls;
@@ -531,17 +530,16 @@ out:
return ureg_src_register(TGSI_FILE_CONSTANT, index);
}
-#define ent(array, i) (*util_dynarray_element(&(array), unsigned, i / 32))
-static struct ureg_dst alloc_temporary( struct ureg_program *ureg,
- boolean local )
+/* Allocate a new temporary. Temporaries greater than UREG_MAX_TEMP
+ * are legal, but will not be released.
+ */
+struct ureg_dst ureg_DECL_temporary( struct ureg_program *ureg )
{
- unsigned i, n;
-
- for (i = 0; i < ureg->nr_temps; i += 32) {
- unsigned mask = ent(ureg->local_temps, i);
- int bit = ffs(~ent(ureg->temps_active, i) & (local ? mask : ~mask));
+ unsigned i;
+ for (i = 0; i < UREG_MAX_TEMP; i += 32) {
+ int bit = ffs(~ureg->temps_active[i/32]);
if (bit != 0) {
i += bit - 1;
goto out;
@@ -551,34 +549,27 @@ static struct ureg_dst alloc_temporary( struct ureg_program *ureg,
/* No reusable temps, so allocate a new one:
*/
i = ureg->nr_temps++;
- n = align(ureg->nr_temps, 32) / 32;
- util_dynarray_resize(&ureg->temps_active, n);
- util_dynarray_resize(&ureg->local_temps, n);
out:
- ent(ureg->temps_active, i) |= 1 << (i % 32);
- ent(ureg->local_temps, i) |= (local ? 1 << (i % 32) : 0);
+ if (i < UREG_MAX_TEMP)
+ ureg->temps_active[i/32] |= 1 << (i % 32);
- return ureg_dst_register( TGSI_FILE_TEMPORARY, i );
-}
+ if (i >= ureg->nr_temps)
+ ureg->nr_temps = i + 1;
-struct ureg_dst ureg_DECL_temporary( struct ureg_program *ureg )
-{
- return alloc_temporary(ureg, FALSE);
+ return ureg_dst_register( TGSI_FILE_TEMPORARY, i );
}
-struct ureg_dst ureg_DECL_local_temporary( struct ureg_program *ureg )
-{
- return alloc_temporary(ureg, TRUE);
-}
void ureg_release_temporary( struct ureg_program *ureg,
struct ureg_dst tmp )
{
if(tmp.File == TGSI_FILE_TEMPORARY)
- ent(ureg->temps_active, tmp.Index) &= ~(1 << (tmp.Index % 32));
+ if (tmp.Index < UREG_MAX_TEMP)
+ ureg->temps_active[tmp.Index/32] &= ~(1 << (tmp.Index % 32));
}
+
/* Allocate a new address register.
*/
struct ureg_dst ureg_DECL_address( struct ureg_program *ureg )
@@ -1264,25 +1255,6 @@ emit_decl_fs(struct ureg_program *ureg,
}
-static void emit_decl( struct ureg_program *ureg,
- unsigned file,
- unsigned first,
- boolean local )
-{
- union tgsi_any_token *out = get_tokens( ureg, DOMAIN_DECL, 2 );
-
- out[0].value = 0;
- out[0].decl.Type = TGSI_TOKEN_TYPE_DECLARATION;
- out[0].decl.NrTokens = 2;
- out[0].decl.File = file;
- out[0].decl.UsageMask = TGSI_WRITEMASK_XYZW;
- out[0].decl.Local = !!local;
-
- out[1].value = 0;
- out[1].decl_range.First = first;
- out[1].decl_range.Last = first;
-}
-
static void emit_decl_range( struct ureg_program *ureg,
unsigned file,
unsigned first,
@@ -1537,11 +1509,10 @@ static void emit_decls( struct ureg_program *ureg )
}
}
- for (i = 0; i < ureg->nr_temps; i++) {
- emit_decl(ureg,
- TGSI_FILE_TEMPORARY,
- i,
- ent(ureg->local_temps, i) & (1 << (i % 32)));
+ if (ureg->nr_temps) {
+ emit_decl_range( ureg,
+ TGSI_FILE_TEMPORARY,
+ 0, ureg->nr_temps );
}
if (ureg->nr_addrs) {
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index 5ec06a8d5a7..07ab8cba0ba 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
@@ -272,9 +272,6 @@ ureg_DECL_constant( struct ureg_program *,
struct ureg_dst
ureg_DECL_temporary( struct ureg_program * );
-struct ureg_dst
-ureg_DECL_local_temporary( struct ureg_program * );
-
void
ureg_release_temporary( struct ureg_program *ureg,
struct ureg_dst tmp );