mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
draw: fix non-indexed draw calls if there's an index buffer
pipe_draw_info::indexed determines if it should be indexed and not the presence of an index buffer. This fixes crashes in r300g. NOTE: This is a candidate for the stable branches. Tested-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
parent
bbb2ebe2fc
commit
2988fa940e
3 changed files with 6 additions and 8 deletions
|
|
@ -621,7 +621,7 @@ draw_set_indexes(struct draw_context *draw,
|
||||||
elem_size == 2 ||
|
elem_size == 2 ||
|
||||||
elem_size == 4);
|
elem_size == 4);
|
||||||
draw->pt.user.elts = elements;
|
draw->pt.user.elts = elements;
|
||||||
draw->pt.user.eltSize = elem_size;
|
draw->pt.user.eltSizeIB = elem_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,7 @@ struct draw_context
|
||||||
/** vertex element/index buffer (ex: glDrawElements) */
|
/** vertex element/index buffer (ex: glDrawElements) */
|
||||||
const void *elts;
|
const void *elts;
|
||||||
/** bytes per index (0, 1, 2 or 4) */
|
/** bytes per index (0, 1, 2 or 4) */
|
||||||
|
unsigned eltSizeIB;
|
||||||
unsigned eltSize;
|
unsigned eltSize;
|
||||||
int eltBias;
|
int eltBias;
|
||||||
unsigned min_index;
|
unsigned min_index;
|
||||||
|
|
|
||||||
|
|
@ -362,7 +362,7 @@ draw_pt_arrays_restart(struct draw_context *draw,
|
||||||
|
|
||||||
assert(info->primitive_restart);
|
assert(info->primitive_restart);
|
||||||
|
|
||||||
if (draw->pt.user.elts) {
|
if (draw->pt.user.eltSize) {
|
||||||
/* indexed prims (draw_elements) */
|
/* indexed prims (draw_elements) */
|
||||||
cur_start = start;
|
cur_start = start;
|
||||||
cur_count = 0;
|
cur_count = 0;
|
||||||
|
|
@ -433,12 +433,8 @@ draw_arrays_instanced(struct draw_context *draw,
|
||||||
info.count = count;
|
info.count = count;
|
||||||
info.start_instance = startInstance;
|
info.start_instance = startInstance;
|
||||||
info.instance_count = instanceCount;
|
info.instance_count = instanceCount;
|
||||||
|
info.min_index = start;
|
||||||
info.indexed = (draw->pt.user.elts != NULL);
|
info.max_index = start + count - 1;
|
||||||
if (!info.indexed) {
|
|
||||||
info.min_index = start;
|
|
||||||
info.max_index = start + count - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
draw_vbo(draw, &info);
|
draw_vbo(draw, &info);
|
||||||
}
|
}
|
||||||
|
|
@ -465,6 +461,7 @@ draw_vbo(struct draw_context *draw,
|
||||||
draw->pt.user.eltBias = info->index_bias;
|
draw->pt.user.eltBias = info->index_bias;
|
||||||
draw->pt.user.min_index = info->min_index;
|
draw->pt.user.min_index = info->min_index;
|
||||||
draw->pt.user.max_index = info->max_index;
|
draw->pt.user.max_index = info->max_index;
|
||||||
|
draw->pt.user.eltSize = info->indexed ? draw->pt.user.eltSizeIB : 0;
|
||||||
|
|
||||||
if (0)
|
if (0)
|
||||||
debug_printf("draw_vbo(mode=%u start=%u count=%u):\n",
|
debug_printf("draw_vbo(mode=%u start=%u count=%u):\n",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue