Mesa (7.9): r300g: fix rendering with a vertex attrib having a zero stride

Marek Olšák mareko at kemper.freedesktop.org
Thu Dec 16 16:01:36 UTC 2010


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Sat Dec 11 14:45:27 2010 +0100

r300g: fix rendering with a vertex attrib having a zero stride

The hardware apparently does support a zero stride, so let's use it.

This fixes missing objects in ETQW, but might also fix a ton of other
similar-looking bugs.

NOTE: This is a candidate for both the 7.9 and 7.10 branches.
(cherry picked from commit 2af8a1983180fc0168c1e0e53bcc69ee3d684ea4)

---

 src/gallium/drivers/r300/r300_state.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 7779766..b114892 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1510,14 +1510,14 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
                 any_user_buffer = TRUE;
             }
 
+            /* The stride of zero means we will be fetching only the first
+             * vertex, so don't care about max_index. */
+            if (!vbo->stride)
+                continue;
+
             if (vbo->max_index == ~0) {
-                /* if no VBO stride then only one vertex value so max index is 1 */
-                /* should think about converting to VS constants like svga does */
-                if (!vbo->stride)
-                    vbo->max_index = 1;
-                else
-                    vbo->max_index =
-                             (vbo->buffer->width0 - vbo->buffer_offset) / vbo->stride;
+                vbo->max_index =
+                        (vbo->buffer->width0 - vbo->buffer_offset) / vbo->stride;
             }
 
             max_index = MIN2(vbo->max_index, max_index);




More information about the mesa-commit mailing list