Mesa (master): translate: disable clamping of instanced array indexes

Brian Paul brianp at kemper.freedesktop.org
Tue Apr 19 22:35:42 UTC 2011


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

Author: Brian Paul <brianp at vmware.com>
Date:   Tue Apr 19 16:13:43 2011 -0600

translate: disable clamping of instanced array indexes

This fixes piglit's draw-instanced-divisor test for softpipe on both
the generic and SSE paths.  This is temporary until we have the
correct per-array max_index information.

---

 .../auxiliary/translate/translate_generic.c        |    9 ++++++---
 src/gallium/auxiliary/translate/translate_sse.c    |   16 ++++++++++------
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/gallium/auxiliary/translate/translate_generic.c b/src/gallium/auxiliary/translate/translate_generic.c
index ad809db..e4e1c86 100644
--- a/src/gallium/auxiliary/translate/translate_generic.c
+++ b/src/gallium/auxiliary/translate/translate_generic.c
@@ -381,14 +381,17 @@ static ALWAYS_INLINE void PIPE_CDECL generic_run_one( struct translate_generic *
 
          if (tg->attrib[attr].instance_divisor) {
             index = instance_id / tg->attrib[attr].instance_divisor;
+            /* XXX we need to clamp the index here too, but to a
+             * per-array max value, not the draw->pt.max_index value
+             * that's being given to us via translate->set_buffer().
+             */
          }
          else {
             index = elt;
+            /* clamp to avoid going out of bounds */
+            index = MIN2(index, tg->attrib[attr].max_index);
          }
 
-         /* clamp to void going out of bounds */
-         index = MIN2(index, tg->attrib[attr].max_index);
-
          src = tg->attrib[attr].input_ptr +
                tg->attrib[attr].input_stride * index;
 
diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c
index 09e70d9..c3d1566 100644
--- a/src/gallium/auxiliary/translate/translate_sse.c
+++ b/src/gallium/auxiliary/translate/translate_sse.c
@@ -1098,14 +1098,19 @@ static boolean init_inputs( struct translate_sse *p,
                x86_mov_reg_imm(p->func, tmp_ECX, variant->instance_divisor);
                x86_div(p->func, tmp_ECX);    /* EAX = EDX:EAX / ECX */
             }
+
+            /* XXX we need to clamp the index here too, but to a
+             * per-array max value, not the draw->pt.max_index value
+             * that's being given to us via translate->set_buffer().
+             */
          } else {
             x86_mov(p->func, tmp_EAX, elt);
-         }
 
-         /* Clamp to max_index
-          */
-         x86_cmp(p->func, tmp_EAX, buf_max_index);
-         x86_cmovcc(p->func, tmp_EAX, buf_max_index, cc_AE);
+            /* Clamp to max_index
+             */
+            x86_cmp(p->func, tmp_EAX, buf_max_index);
+            x86_cmovcc(p->func, tmp_EAX, buf_max_index, cc_AE);
+         }
 
          x86_imul(p->func, tmp_EAX, buf_stride);
          x64_rexw(p->func);
@@ -1113,7 +1118,6 @@ static boolean init_inputs( struct translate_sse *p,
 
          x86_cmp(p->func, p->count_EBP, p->tmp_EAX);
 
-
          /* In the linear case, keep the buffer pointer instead of the
           * index number.
           */




More information about the mesa-commit mailing list