[Mesa-dev] [PATCH 08/12] mesa: Fix incorrect access parameter passed to MapBuffer

Eric Anholt eric at anholt.net
Mon Aug 22 09:17:58 PDT 2011


On Mon, 22 Aug 2011 00:33:00 -0700, "Ian Romanick" <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
> 
> The code previously passed GL_DYNAMIC_DRAW for the access parameter.
> By inspection, I believe that all drivers would treat this as
> GL_READ_WRITE because it's not GL_READ_ONLY and it's not
> GL_WRITE_ONLY.  However, my guess is that this code actually wants to
> use GL_WRITE_ONLY.

Looks to me like the i965 code wants GL_WRITE_ONLY (we're about to write
a bunch of data in, never read data), while the arrayelt code is
GL_READ_ONLY (just dereffed as arguments to CALL_Whatever*v).

Other than that and previous comments, this series is

Reviewed-by: Eric Anholt <eric at anholt.net>

> 
> Cc: Eric Anholt <eric at anholt.net>
> Cc: Keith Whitwell <keithw at vmware.com>
> ---
>  src/mesa/drivers/dri/i965/brw_draw_upload.c |    4 +---
>  src/mesa/main/api_arrayelt.c                |    4 +---
>  2 files changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
> index 66c42aa..3b95244 100644
> --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
> +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
> @@ -689,9 +689,7 @@ static void brw_prepare_indices(struct brw_context *brw)
>         * rebase it into a temporary.
>         */
>         if ((get_size(index_buffer->type) - 1) & offset) {
> -           GLubyte *map = ctx->Driver.MapBuffer(ctx,
> -                                                GL_DYNAMIC_DRAW_ARB,
> -                                                bufferobj);
> +           GLubyte *map = ctx->Driver.MapBuffer(ctx, GL_READ_WRITE, bufferobj);
>             map += offset;
>  
>  	   intel_upload_data(&brw->intel, map, ib_size, ib_type_size,
> diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
> index 6400c8f..b897a33 100644
> --- a/src/mesa/main/api_arrayelt.c
> +++ b/src/mesa/main/api_arrayelt.c
> @@ -1602,9 +1602,7 @@ void _ae_map_vbos( struct gl_context *ctx )
>        _ae_update_state(ctx);
>  
>     for (i = 0; i < actx->nr_vbos; i++)
> -      ctx->Driver.MapBuffer(ctx,
> -			    GL_DYNAMIC_DRAW_ARB,
> -			    actx->vbo[i]);
> +      ctx->Driver.MapBuffer(ctx, GL_READ_WRITE, actx->vbo[i]);
>  
>     if (actx->nr_vbos)
>        actx->mapped_vbos = GL_TRUE;
> -- 
> 1.7.4.4
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110822/ef1950a1/attachment.pgp>


More information about the mesa-dev mailing list