Mesa (master): i965: Clarify the nr_regs calculation in brw_clip.c

Eric Anholt anholt at kemper.freedesktop.org
Tue Jul 20 02:33:59 UTC 2010


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

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Jul 19 16:11:19 2010 -0700

i965: Clarify the nr_regs calculation in brw_clip.c

---

 src/mesa/drivers/dri/i965/brw_clip.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c
index 228ee3f..96d278f 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.c
+++ b/src/mesa/drivers/dri/i965/brw_clip.c
@@ -83,11 +83,16 @@ static void compile_clip_prog( struct brw_context *brw,
       }
 
    c.nr_attrs = brw_count_bits(c.key.attrs);
-   
+
+   /* The vertex attributes start at a URB row-aligned offset after
+    * the 8-20 dword vertex header, and continue for a URB row-aligned
+    * length.  nr_regs determines the urb_read_length from the start
+    * of the header to the end of the vertex data.
+    */
    if (intel->gen == 5)
-       c.nr_regs = (c.nr_attrs + 1) / 2 + 3;  /* are vertices packed, or reg-aligned? */
+       c.nr_regs = 3 + (c.nr_attrs + 1) / 2;
    else
-       c.nr_regs = (c.nr_attrs + 1) / 2 + 1;  /* are vertices packed, or reg-aligned? */
+       c.nr_regs = 1 + (c.nr_attrs + 1) / 2;
 
    c.nr_bytes = c.nr_regs * REG_SIZE;
 




More information about the mesa-commit mailing list