Mesa (master): r300g: hack around issue with doom3 and 0 stride

Dave Airlie airlied at kemper.freedesktop.org
Sat Apr 10 22:11:42 UTC 2010


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Sun Apr 11 08:04:37 2010 +1000

r300g: hack around issue with doom3 and 0 stride

This is most likely a bug in the mesa state tracker, but do the quick hack
for now to avoid the divide by 0.

reported and hack generated by almos on #radeon

Signed-off-by: Dave Airlie <airlied at redhat.com>

---

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

diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 52b8910..30f1df7 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1146,6 +1146,11 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
 
         if (vbo->max_index == ~0) {
             /* Bogus value from broken state tracker; hax it. */
+	    /* TODO - more hax - fixes doom3 from almos on irc */
+	    if (!vbo->stride) {
+		fprintf(stderr, "r300: got a VBO with stride 0 fixing up to stide 4\n");
+		vbo->stride = 4;
+	    }
             vbo->max_index =
                 (vbo->buffer->width0 - vbo->buffer_offset) / vbo->stride;
         }




More information about the mesa-commit mailing list