[Mesa-dev] [PATCH 1/2] mesa: use GL_MAP_INVALIDATE_RANGE_BIT in glTexImage paths

Ian Romanick idr at freedesktop.org
Tue Jan 17 10:15:20 PST 2012


On 01/17/2012 07:19 AM, Brian Paul wrote:
> Update the dd.h docs to indicate that GL_MAP_INVALIDATE_RANGE_BIT
> can be used with GL_MAP_WRITE_BIT when mapping renderbuffers and
> texture images.
>
> Pass the flag when mapping texture images for glTexImage, glTexSubImage,
> etc.  It's up to drivers whether to actually make use of the flag.
>
> NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> ---
>   src/mesa/main/dd.h       |    8 +++++++-
>   src/mesa/main/texstore.c |    4 ++--
>   2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
> index 24f3d4c..8393f32 100644
> --- a/src/mesa/main/dd.h
> +++ b/src/mesa/main/dd.h
> @@ -460,7 +460,8 @@ struct dd_function_table {
>       * \param texImage  the texture image
>       * \param slice  the 3D image slice or array texture slice
>       * \param x, y, w, h  region of interest
> -    * \param mode  bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT
> +    * \param mode  bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
> +    *              GL_MAP_INVALIDATE_RANGE_BIT (if writing)
>       * \param mapOut  returns start of mapping of region of interest
>       * \param rowStrideOut  returns row stride (in bytes)
>       */
> @@ -489,6 +490,11 @@ struct dd_function_table {
>                                       GLsizei levels, GLsizei width,
>                                       GLsizei height, GLsizei depth);
>
> +   /**
> +    * Map a renderbuffer into user space.
> +    * \param mode  bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
> +    *              GL_MAP_INVALIDATE_RANGE_BIT (if writing)
> +    */
>      void (*MapRenderbuffer)(struct gl_context *ctx,
>   			   struct gl_renderbuffer *rb,
>   			   GLuint x, GLuint y, GLuint w, GLuint h,
> diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
> index a9c64ce..600dab3 100644
> --- a/src/mesa/main/texstore.c
> +++ b/src/mesa/main/texstore.c
> @@ -4404,7 +4404,7 @@ get_read_write_mode(GLenum userFormat, gl_format texFormat)
>          &&  _mesa_get_format_base_format(texFormat) == GL_DEPTH_STENCIL)
>         return GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
>      else
> -      return GL_MAP_WRITE_BIT;
> +      return GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT;
>   }
>
>
> @@ -4805,7 +4805,7 @@ _mesa_store_compressed_texsubimage2d(struct gl_context *ctx,
>      /* Map dest texture buffer */
>      ctx->Driver.MapTextureImage(ctx, texImage, 0,
>                                  xoffset, yoffset, width, height,
> -                               GL_MAP_WRITE_BIT,
> +                               GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT,
>                                  &dstMap,&dstRowStride);
>
>      if (dstMap) {



More information about the mesa-dev mailing list