max_index must be observed to prevent crashes due to bad index data.
I've been using this patch for some time without regressions.
Some places, where we use internal vertex buffer, it is not entirely
clear what max_index should be, so passing just ~0 to avoid regressions
for now.
*/
/* Note: we really do want data[0] here, not data[pos]:
*/
- vbuf->translate->set_buffer(vbuf->translate, 0, vertex->data[0], 0);
+ vbuf->translate->set_buffer(vbuf->translate, 0, vertex->data[0], 0, ~0);
vbuf->translate->run(vbuf->translate, 0, 1, 0, vbuf->vertex_ptr);
if (0) draw_dump_emitted_vertex(vbuf->vinfo, (uint8_t *)vbuf->vertex_ptr);
translate_key_sanitize(&hw_key);
vbuf->translate = translate_cache_find(vbuf->cache, &hw_key);
- vbuf->translate->set_buffer(vbuf->translate, 1, &vbuf->point_size, 0);
+ vbuf->translate->set_buffer(vbuf->translate, 1, &vbuf->point_size, 0, ~0);
}
vbuf->point_size = vbuf->stage.draw->rasterizer->point_size;
translate->set_buffer(translate,
0,
vertex_data,
- stride );
+ stride,
+ ~0);
translate->set_buffer(translate,
1,
&draw->rasterizer->point_size,
- 0);
+ 0,
+ ~0);
translate->run( translate,
0,
goto fail;
translate->set_buffer(translate, 0,
- vertex_data, stride);
+ vertex_data, stride, count - 1);
translate->set_buffer(translate, 1,
&draw->rasterizer->point_size,
- 0);
+ 0, ~0);
translate->run(translate,
0,
fetch->translate->set_buffer(fetch->translate,
draw->pt.nr_vertex_buffers,
&vh,
- 0);
+ 0,
+ ~0);
}
}
i,
((char *)draw->pt.user.vbuffer[i] +
draw->pt.vertex_buffer[i].buffer_offset),
- draw->pt.vertex_buffer[i].stride );
+ draw->pt.vertex_buffer[i].stride,
+ draw->pt.vertex_buffer[i].max_index);
}
translate->run_elts( translate,
i,
((char *)draw->pt.user.vbuffer[i] +
draw->pt.vertex_buffer[i].buffer_offset),
- draw->pt.vertex_buffer[i].stride );
+ draw->pt.vertex_buffer[i].stride,
+ draw->pt.vertex_buffer[i].max_index);
}
translate->run( translate,
feme->translate->set_buffer(feme->translate,
draw->pt.nr_vertex_buffers,
&feme->point_size,
- 0);
+ 0,
+ ~0);
}
feme->point_size = draw->rasterizer->point_size;
i,
((char *)draw->pt.user.vbuffer[i] +
draw->pt.vertex_buffer[i].buffer_offset),
- draw->pt.vertex_buffer[i].stride );
+ draw->pt.vertex_buffer[i].stride,
+ draw->pt.vertex_buffer[i].max_index);
}
*max_vertices = (draw->render->max_vertex_buffer_bytes /
i,
((const ubyte *) draw->pt.user.vbuffer[i] +
draw->pt.vertex_buffer[i].buffer_offset),
- draw->pt.vertex_buffer[i].stride );
+ draw->pt.vertex_buffer[i].stride,
+ draw->pt.vertex_buffer[i].max_index );
}
*max_vertices = (draw->render->max_vertex_buffer_bytes /
void (*set_buffer)( struct draw_vs_varient *,
unsigned i,
const void *ptr,
- unsigned stride );
+ unsigned stride,
+ unsigned max_stride );
void (PIPE_CDECL *run_linear)( struct draw_vs_varient *shader,
unsigned start,
static void vsvg_set_buffer( struct draw_vs_varient *varient,
unsigned buffer,
const void *ptr,
- unsigned stride )
+ unsigned stride,
+ unsigned max_index )
{
struct draw_vs_varient_generic *vsvg = (struct draw_vs_varient_generic *)varient;
vsvg->fetch->set_buffer(vsvg->fetch,
buffer,
ptr,
- stride);
+ stride,
+ max_index );
}
vsvg->emit->set_buffer( vsvg->emit,
0,
temp_buffer,
- temp_vertex_stride );
+ temp_vertex_stride,
+ ~0 );
vsvg->emit->set_buffer( vsvg->emit,
1,
&vsvg->draw->rasterizer->point_size,
- 0);
+ 0,
+ ~0 );
vsvg->emit->run( vsvg->emit,
0, count,
vsvg->emit->set_buffer( vsvg->emit,
0,
temp_buffer,
- temp_vertex_stride );
+ temp_vertex_stride,
+ ~0 );
vsvg->emit->set_buffer( vsvg->emit,
1,
&vsvg->draw->rasterizer->point_size,
- 0);
+ 0,
+ ~0 );
vsvg->emit->run( vsvg->emit,
0, count,