draw: more aos tweaks
authorKeith Whitwell <keith@tungstengraphics.com>
Sun, 25 May 2008 23:09:02 +0000 (00:09 +0100)
committerKeith Whitwell <keith@tungstengraphics.com>
Sun, 25 May 2008 23:09:02 +0000 (00:09 +0100)
src/gallium/auxiliary/draw/draw_vs_aos.c

index 37d04e45a6599e67d41e106b3cdb52e06040ceb7..916203c66b8c1ae07f2411bf4d16f552a9c46ce2 100644 (file)
@@ -202,6 +202,7 @@ static struct x86_reg get_xmm_writable( struct aos_compilation *cp,
       reg = tmp;
    }
 
+   cp->xmm[reg.idx].last_used = cp->insn_counter;
    return reg;
 }
 
@@ -215,6 +216,7 @@ static struct x86_reg get_xmm( struct aos_compilation *cp,
       reg = tmp;
    }
 
+   cp->xmm[reg.idx].last_used = cp->insn_counter;
    return reg;
 }
 
@@ -281,6 +283,18 @@ void aos_adopt_xmm_reg( struct aos_compilation *cp,
       return;
    }
 
+   /* If this xmm reg is already holding this shader reg, just update
+    * last_used, and don't clobber the dirty flag...
+    */
+   if (cp->xmm[reg.idx].file == file &&
+       cp->xmm[reg.idx].idx == idx) 
+   {
+      cp->xmm[reg.idx].dirty |= dirty;
+      cp->xmm[reg.idx].last_used = cp->insn_counter;
+      return;
+   }
+   
+
    /* If any xmm reg thinks it holds this shader reg, break the
     * illusion.
     */
@@ -382,8 +396,16 @@ static struct x86_reg aos_get_shader_reg_xmm( struct aos_compilation *cp,
                                               unsigned file,
                                               unsigned idx )
 {
-   struct x86_reg reg = aos_get_shader_reg( cp, file, idx );
-   return get_xmm( cp, reg );
+   struct x86_reg reg = get_xmm( cp,
+                                 aos_get_shader_reg( cp, file, idx ) );
+
+   aos_adopt_xmm_reg( cp,
+                      reg,
+                      file,
+                      idx,
+                      FALSE );
+   
+   return reg;
 }