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

Author: Corbin Simpson <[email protected]>
Date:   Fri Mar 12 02:47:44 2010 -0800

r300g: Properly clamp index limits.

Make the kernel even less likely to barf on us.

---

 src/gallium/drivers/r300/r300_render.c |    2 +-
 src/gallium/drivers/r300/r300_state.c  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_render.c 
b/src/gallium/drivers/r300/r300_render.c
index 9c001ae..ef1b751 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -280,7 +280,7 @@ static void r300_emit_draw_elements(struct r300_context 
*r300,
     DBG(r300, DBG_DRAW, "r300: Indexbuf of %u indices, min %u max %u\n",
         count, minIndex, maxIndex);
 
-    maxIndex = MIN2(maxIndex, r300->vertex_buffer_max_index);
+    maxIndex = MIN3(maxIndex, r300->vertex_buffer_max_index, (1 << 24) - 1);
 
     if (alt_num_verts) {
         BEGIN_CS(15);
diff --git a/src/gallium/drivers/r300/r300_state.c 
b/src/gallium/drivers/r300/r300_state.c
index bd4c276..ced6c81 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1031,7 +1031,7 @@ static void r300_set_vertex_buffers(struct pipe_context* 
pipe,
                                     const struct pipe_vertex_buffer* buffers)
 {
     struct r300_context* r300 = r300_context(pipe);
-    unsigned i, max_index = ~0;
+    unsigned i, max_index = (1 << 24) - 1;
 
     memcpy(r300->vertex_buffer, buffers,
         sizeof(struct pipe_vertex_buffer) * count);

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to