diff options
author | Dave Airlie <[email protected]> | 2010-04-18 18:49:27 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2010-04-18 18:51:10 +1000 |
commit | 851edfe3c9d24d2678a17a8fc74c31fbea0343c2 (patch) | |
tree | d87a81502d9f5c4fd9ef32ac1b844f32a9f86997 | |
parent | 4b148bcf5e6cf08fac31cd10b42ac5f5a5f43cd6 (diff) |
r300g: fixup 0 stride buffer properly.
Just set the max index to 1, this lets doom3 run and seems correct,
though it would be better to just emit a constant like SVGA does.
Signed-off-by: Dave Airlie <[email protected]>
-rw-r--r-- | src/gallium/drivers/r300/r300_state.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 371e52d2089..1c318264d23 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1192,14 +1192,13 @@ 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; + /* 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; } max_index = MIN2(vbo->max_index, max_index); |