Mesa (master): nv50: alloc_reg on reg_instance

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Thu Dec 31 13:38:08 UTC 2009


Module: Mesa
Branch: master
Commit: 170cdb4507683fb9042620f7ab2ad96e57787d6c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=170cdb4507683fb9042620f7ab2ad96e57787d6c

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Thu Dec 31 00:37:47 2009 +0100

nv50: alloc_reg on reg_instance

If we create multiple instances of an nv50_reg referencing
them same resource, register allocation from alloc_reg has
to be done with the original nv50_reg.

---

 src/gallium/drivers/nv50/nv50_program.c |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index 739621a..295725a 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -163,20 +163,6 @@ struct nv50_pc {
 	uint8_t edgeflag_out;
 };
 
-static INLINE struct nv50_reg *
-reg_instance(struct nv50_pc *pc, struct nv50_reg *reg)
-{
-	struct nv50_reg *ri;
-
-	assert(pc->reg_instance_nr < 16);
-	ri = &pc->reg_instances[pc->reg_instance_nr++];
-	if (reg) {
-		*ri = *reg;
-		reg->mod = 0;
-	}
-	return ri;
-}
-
 static INLINE void
 ctor_reg(struct nv50_reg *reg, unsigned type, int index, int hw)
 {
@@ -255,6 +241,21 @@ alloc_reg(struct nv50_pc *pc, struct nv50_reg *reg)
 	assert(0);
 }
 
+static INLINE struct nv50_reg *
+reg_instance(struct nv50_pc *pc, struct nv50_reg *reg)
+{
+	struct nv50_reg *ri;
+
+	assert(pc->reg_instance_nr < 16);
+	ri = &pc->reg_instances[pc->reg_instance_nr++];
+	if (reg) {
+		alloc_reg(pc, reg);
+		*ri = *reg;
+		reg->mod = 0;
+	}
+	return ri;
+}
+
 /* XXX: For shaders that aren't executed linearly (e.g. shaders that
  * contain loops), we need to assign all hw regs to TGSI TEMPs early,
  * lest we risk temp_temps overwriting regs alloc'd "later".




More information about the mesa-commit mailing list