[Mesa-dev] [PATCH 06/11] mesa: Add new pixel pack/unpack state for ARB_compressed_texture_pixel_storage

Ian Romanick idr at freedesktop.org
Mon Jun 2 15:13:23 PDT 2014


This patch is

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

On 06/01/2014 11:29 PM, Chris Forbes wrote:
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
>  src/mesa/main/get_hash_params.py | 10 +++++++
>  src/mesa/main/mtypes.h           |  4 +++
>  src/mesa/main/pixelstore.c       | 64 ++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 78 insertions(+)
> 
> diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
> index d40fa07..d480d84 100644
> --- a/src/mesa/main/get_hash_params.py
> +++ b/src/mesa/main/get_hash_params.py
> @@ -541,6 +541,16 @@ descriptor=[
>    [ "ARRAY_ELEMENT_LOCK_FIRST_EXT", "CONTEXT_INT(Array.LockFirst), NO_EXTRA" ],
>    [ "ARRAY_ELEMENT_LOCK_COUNT_EXT", "CONTEXT_INT(Array.LockCount), NO_EXTRA" ],
>  
> +# GL_ARB_compressed_texture_pixel_storage
> +  [ "UNPACK_COMPRESSED_BLOCK_WIDTH", "CONTEXT_INT(Unpack.CompressedBlockWidth), NO_EXTRA" ],
> +  [ "UNPACK_COMPRESSED_BLOCK_HEIGHT", "CONTEXT_INT(Unpack.CompressedBlockHeight), NO_EXTRA" ],
> +  [ "UNPACK_COMPRESSED_BLOCK_DEPTH", "CONTEXT_INT(Unpack.CompressedBlockDepth), NO_EXTRA" ],
> +  [ "UNPACK_COMPRESSED_BLOCK_SIZE", "CONTEXT_INT(Unpack.CompressedBlockSize), NO_EXTRA" ],
> +  [ "PACK_COMPRESSED_BLOCK_WIDTH", "CONTEXT_INT(Pack.CompressedBlockWidth), NO_EXTRA" ],
> +  [ "PACK_COMPRESSED_BLOCK_HEIGHT", "CONTEXT_INT(Pack.CompressedBlockHeight), NO_EXTRA" ],
> +  [ "PACK_COMPRESSED_BLOCK_DEPTH", "CONTEXT_INT(Pack.CompressedBlockDepth), NO_EXTRA" ],
> +  [ "PACK_COMPRESSED_BLOCK_SIZE", "CONTEXT_INT(Pack.CompressedBlockSize), NO_EXTRA" ],
> +
>  # GL_ARB_transpose_matrix
>    [ "TRANSPOSE_MODELVIEW_MATRIX_ARB", "CONTEXT_MATRIX_T(ModelviewMatrixStack), NO_EXTRA" ],
>    [ "TRANSPOSE_PROJECTION_MATRIX_ARB", "CONTEXT_MATRIX_T(ProjectionMatrixStack.Top), NO_EXTRA" ],
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 917d071..e366d00 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -1502,6 +1502,10 @@ struct gl_pixelstore_attrib
>     GLboolean SwapBytes;
>     GLboolean LsbFirst;
>     GLboolean Invert;        /**< GL_MESA_pack_invert */
> +   GLint CompressedBlockWidth;   /**< GL_ARB_compressed_texture_pixel_storage */
> +   GLint CompressedBlockHeight;
> +   GLint CompressedBlockDepth;
> +   GLint CompressedBlockSize;
>     struct gl_buffer_object *BufferObj; /**< GL_ARB_pixel_buffer_object */
>  };
>  
> diff --git a/src/mesa/main/pixelstore.c b/src/mesa/main/pixelstore.c
> index 86625e4..05f6583 100644
> --- a/src/mesa/main/pixelstore.c
> +++ b/src/mesa/main/pixelstore.c
> @@ -97,6 +97,34 @@ _mesa_PixelStorei( GLenum pname, GLint param )
>              goto invalid_enum_error;
>           ctx->Pack.Invert = param;
>           break;
> +      case GL_PACK_COMPRESSED_BLOCK_WIDTH:
> +         if (!_mesa_is_desktop_gl(ctx))
> +            goto invalid_enum_error;
> +         if (param<0)
> +            goto invalid_value_error;
> +         ctx->Pack.CompressedBlockWidth = param;
> +         break;
> +      case GL_PACK_COMPRESSED_BLOCK_HEIGHT:
> +         if (!_mesa_is_desktop_gl(ctx))
> +            goto invalid_enum_error;
> +         if (param<0)
> +            goto invalid_value_error;
> +         ctx->Pack.CompressedBlockHeight = param;
> +         break;
> +      case GL_PACK_COMPRESSED_BLOCK_DEPTH:
> +         if (!_mesa_is_desktop_gl(ctx))
> +            goto invalid_enum_error;
> +         if (param<0)
> +            goto invalid_value_error;
> +         ctx->Pack.CompressedBlockDepth = param;
> +         break;
> +      case GL_PACK_COMPRESSED_BLOCK_SIZE:
> +         if (!_mesa_is_desktop_gl(ctx))
> +            goto invalid_enum_error;
> +         if (param<0)
> +            goto invalid_value_error;
> +         ctx->Pack.CompressedBlockSize = param;
> +         break;
>  
>        case GL_UNPACK_SWAP_BYTES:
>           if (!_mesa_is_desktop_gl(ctx))
> @@ -148,6 +176,34 @@ _mesa_PixelStorei( GLenum pname, GLint param )
>              goto invalid_value_error;
>           ctx->Unpack.Alignment = param;
>           break;
> +      case GL_UNPACK_COMPRESSED_BLOCK_WIDTH:
> +         if (!_mesa_is_desktop_gl(ctx))
> +            goto invalid_enum_error;
> +         if (param<0)
> +            goto invalid_value_error;
> +         ctx->Unpack.CompressedBlockWidth = param;
> +         break;
> +      case GL_UNPACK_COMPRESSED_BLOCK_HEIGHT:
> +         if (!_mesa_is_desktop_gl(ctx))
> +            goto invalid_enum_error;
> +         if (param<0)
> +            goto invalid_value_error;
> +         ctx->Unpack.CompressedBlockHeight = param;
> +         break;
> +      case GL_UNPACK_COMPRESSED_BLOCK_DEPTH:
> +         if (!_mesa_is_desktop_gl(ctx))
> +            goto invalid_enum_error;
> +         if (param<0)
> +            goto invalid_value_error;
> +         ctx->Unpack.CompressedBlockDepth = param;
> +         break;
> +      case GL_UNPACK_COMPRESSED_BLOCK_SIZE:
> +         if (!_mesa_is_desktop_gl(ctx))
> +            goto invalid_enum_error;
> +         if (param<0)
> +            goto invalid_value_error;
> +         ctx->Unpack.CompressedBlockSize = param;
> +         break;
>        default:
>           goto invalid_enum_error;
>     }
> @@ -188,6 +244,10 @@ _mesa_init_pixelstore( struct gl_context *ctx )
>     ctx->Pack.SwapBytes = GL_FALSE;
>     ctx->Pack.LsbFirst = GL_FALSE;
>     ctx->Pack.Invert = GL_FALSE;
> +   ctx->Pack.CompressedBlockWidth = 0;
> +   ctx->Pack.CompressedBlockHeight = 0;
> +   ctx->Pack.CompressedBlockDepth = 0;
> +   ctx->Pack.CompressedBlockSize = 0;
>     _mesa_reference_buffer_object(ctx, &ctx->Pack.BufferObj,
>                                   ctx->Shared->NullBufferObj);
>     ctx->Unpack.Alignment = 4;
> @@ -199,6 +259,10 @@ _mesa_init_pixelstore( struct gl_context *ctx )
>     ctx->Unpack.SwapBytes = GL_FALSE;
>     ctx->Unpack.LsbFirst = GL_FALSE;
>     ctx->Unpack.Invert = GL_FALSE;
> +   ctx->Unpack.CompressedBlockWidth = 0;
> +   ctx->Unpack.CompressedBlockHeight = 0;
> +   ctx->Unpack.CompressedBlockDepth = 0;
> +   ctx->Unpack.CompressedBlockSize = 0;
>     _mesa_reference_buffer_object(ctx, &ctx->Unpack.BufferObj,
>                                   ctx->Shared->NullBufferObj);
>  
> 



More information about the mesa-dev mailing list