nv50: save some space in immediate buffer
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sat, 23 May 2009 10:25:32 +0000 (12:25 +0200)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 28 May 2009 06:06:18 +0000 (16:06 +1000)
We could do even better (like just allocating 1 value in alloc_immd),
but that's fine for now I guess.

src/gallium/drivers/nv50/nv50_program.c

index 2241801542ea0c31429614670a307d8b6f627f8c..40d2384c3e201ae52a203aad6993610226cac85a 100644 (file)
@@ -250,7 +250,13 @@ alloc_immd(struct nv50_pc *pc, float f)
        struct nv50_reg *r = CALLOC_STRUCT(nv50_reg);
        unsigned hw;
 
-       hw = ctor_immd(pc, f, 0, 0, 0) * 4;
+       for (hw = 0; hw < pc->immd_nr * 4; hw++)
+               if (pc->immd_buf[hw] == f)
+                       break;
+
+       if (hw == pc->immd_nr * 4)
+               hw = ctor_immd(pc, f, -f, 0.5 * f, 0) * 4;
+
        r->type = P_IMMD;
        r->hw = hw;
        r->index = -1;