[Mesa-dev] [PATCH] i965: Make sure we always compute valid index bounds before drawing.

Eric Anholt eric at anholt.net
Mon Apr 7 10:21:28 PDT 2014


Iago Toral Quiroga <itoral at igalia.com> writes:

> When doing software rendering (i.e. rendering to the selection buffer) we need
> to make sure that we have valid index bounds before calling _tnl_draw_prims(),
> otherwise we can crash.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59455
> ---
>  src/mesa/drivers/dri/i965/brw_draw.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
> index d684c17..ef0f273 100644
> --- a/src/mesa/drivers/dri/i965/brw_draw.c
> +++ b/src/mesa/drivers/dri/i965/brw_draw.c
> @@ -554,7 +554,8 @@ void brw_draw_prims( struct gl_context *ctx,
>      * get the minimum and maximum of their index buffer so we know what range
>      * to upload.
>      */
> -   if (!vbo_all_varyings_in_vbos(arrays) && !index_bounds_valid) {
> +   if (!index_bounds_valid &&
> +       (ctx->RenderMode != GL_RENDER || !vbo_all_varyings_in_vbos(arrays))) {
>        perf_debug("Scanning index buffer to compute index buffer bounds.  "
>                   "Use glDrawRangeElements() to avoid this.\n");
>        vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index, nr_prims);

How about instead, let's just merge _tnl_vbo_draw_prims() into
_tnl_draw_prims(), so that this mistake can't be made again?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140407/6de1b4a4/attachment.sig>


More information about the mesa-dev mailing list