[Mesa-dev] [PATCH 10/20] mesa: reduce the size of gl_image_unit

Ian Romanick idr at freedesktop.org
Wed Nov 22 22:07:35 UTC 2017


On 11/21/2017 10:01 AM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> gl_context::ImageUnits: 6144 -> 4608 bytes
> gl_context: 74608 -> 73072 bytes
> ---
>  src/mesa/main/mtypes.h | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index f16ff4e..6ddef05 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -4605,59 +4605,58 @@ struct gl_buffer_binding
>  struct gl_image_unit
>  {
>     /**
>      * Texture object bound to this unit.
>      */
>     struct gl_texture_object *TexObj;
>  
>     /**
>      * Level of the texture object bound to this unit.
>      */
> -   GLuint Level;
> +   GLubyte Level;
>  
>     /**
>      * \c GL_TRUE if the whole level is bound as an array of layers, \c
>      * GL_FALSE if only some specific layer of the texture is bound.
>      * \sa Layer
>      */
>     GLboolean Layered;
>  
>     /**
>      * Layer of the texture object bound to this unit as specified by the
>      * application.
>      */
> -   GLuint Layer;
> +   GLushort Layer;
>  
>     /**
> -    * Layer of the texture object bound to this unit, or zero if the
> -    * whole level is bound.
> +    * Layer of the texture object bound to this unit, or zero if
> +    * Layered == false.
>      */
> -   GLuint _Layer;
> +   GLushort _Layer;
>  
>     /**
>      * Access allowed to this texture image.  Either \c GL_READ_ONLY,
>      * \c GL_WRITE_ONLY or \c GL_READ_WRITE.
>      */
>     GLenum16 Access;
>  
>     /**
>      * GL internal format that determines the interpretation of the
>      * image memory when shader image operations are performed through
>      * this unit.
>      */
>     GLenum16 Format;
>  
>     /**
>      * Mesa format corresponding to \c Format.
>      */
> -   mesa_format _ActualFormat;
> -
> +   mesa_format _ActualFormat:16;

We should either add checks using Brian's new macro or just make
mesa_format packed on GCC / clang builds.

>  };
>  
>  /**
>   * Shader subroutines storage
>   */
>  struct gl_subroutine_index_binding
>  {
>     GLuint NumIndex;
>     GLuint *IndexPtr;
>  };
> 



More information about the mesa-dev mailing list