diff options
author | Marek Olšák <[email protected]> | 2011-11-20 03:58:34 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-11-20 16:24:12 +0100 |
commit | 03df791c6f0881e45a65106c22ccd28f77018fb3 (patch) | |
tree | b7ada8008fc05f4c4fe3820085f5afde9df33d06 /src/gallium/drivers | |
parent | 72e1117e489986783dd5b27a3ad781b86c2d5d67 (diff) |
u_vbuf_mgr: correctly compute max vertex count from hw buffers
And update r300g.
This is different from util_draw_max_index in how it obtains vertex elements
and that it doesn't have to call util_format_description due to additional
precomputed data in vertex elements.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/r300/r300_render.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 84cabc0bac3..b880b0b6416 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -760,8 +760,14 @@ static void r300_draw_vbo(struct pipe_context* pipe, /* Draw. */ if (info.indexed) { + unsigned max_count = u_vbuf_draw_max_vertex_count(r300->vbuf_mgr); + if (!max_count) { + fprintf(stderr, "r300: Skipping a draw command. There is a buffer " + " which is too small to be used for rendering.\n"); + goto done; + } info.start += r300->vbuf_mgr->index_buffer.offset / r300->vbuf_mgr->index_buffer.index_size; - info.max_index = MIN2(r300->vbuf_mgr->max_index, info.max_index); + info.max_index = max_count - 1; if (info.instance_count <= 1) { if (info.count <= 8 && @@ -785,6 +791,7 @@ static void r300_draw_vbo(struct pipe_context* pipe, } } +done: u_vbuf_draw_end(r300->vbuf_mgr); } |