summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-11-20 19:22:47 +0100
committerMarek Olšák <[email protected]>2011-11-20 19:29:19 +0100
commit94cd9d6be8980f28fdb6b7a8526814802a90f25d (patch)
tree856070829faa25998493d9287abbefeb2cf347ba /src/gallium
parent03df791c6f0881e45a65106c22ccd28f77018fb3 (diff)
r300g: set max_index to 0xffffff if there are no per-vertex attribs
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/r300/r300_render.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index b880b0b6416..90b8e53113f 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -128,6 +128,8 @@ static void r300_emit_draw_init(struct r300_context *r300, unsigned mode,
{
CS_LOCALS(r300);
+ assert(max_index < (1 << 24));
+
BEGIN_CS(5);
OUT_CS_REG(R300_GA_COLOR_CONTROL,
r300_provoking_vertex_fixes(r300, mode));
@@ -444,7 +446,7 @@ static void r300_emit_draw_elements(struct r300_context *r300,
boolean alt_num_verts = count > 65535;
CS_LOCALS(r300);
- if (count >= (1 << 24) || max_index >= (1 << 24)) {
+ if (count >= (1 << 24)) {
fprintf(stderr, "r300: Got a huge number of vertices: %i, "
"refusing to render (max_index: %i).\n", count, max_index);
return;
@@ -761,13 +763,20 @@ 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;
+
+ if (max_count == ~0) {
+ /* There are no per-vertex vertex elements. Use the hardware maximum. */
+ max_count = 0xffffff;
+ }
+
info.max_index = max_count - 1;
+ info.start += r300->vbuf_mgr->index_buffer.offset / r300->vbuf_mgr->index_buffer.index_size;
if (info.instance_count <= 1) {
if (info.count <= 8 &&