[Mesa-dev] [PATCH 6/9] gallium: decrease the size of pipe_box - 24 -> 16 bytes

Brian Paul brianp at vmware.com
Mon Apr 3 15:10:35 UTC 2017


On 04/02/2017 12:00 PM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> Also:
>
> pipe_transfer: 48 -> 40 bytes.
> pipe_blit_info = 176 -> 160 bytes.
> ---
>   src/gallium/include/pipe/p_state.h | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
> index 392bb8b..6a147ef 100644
> --- a/src/gallium/include/pipe/p_state.h
> +++ b/src/gallium/include/pipe/p_state.h
> @@ -472,25 +472,25 @@ struct pipe_image_view
>      } u;
>   };
>
>
>   /**
>    * Subregion of 1D/2D/3D image resource.
>    */
>   struct pipe_box
>   {
>      int x;
> -   int y;
> -   int z;
> +   int16_t y;
> +   int16_t z;
>      int width;
> -   int height;
> -   int depth;
> +   int16_t height;
> +   int16_t depth;

I think a comment explaining why x/width are int but y/z/height/depth 
are int16_t (texture buffer objects, right?) would be good.  Otherwise, 
someone's going to wonder about that and maybe submit a patch to change it.

Same thing for the pipe_resource change.

I tested the series on Windows/MSVC and MinGW and didn't see any problems.

With the above comments, Reviewed-by: Brian Paul <brianp at vmware.com>

BTW, some years ago I looked at using bitfields in gl_texture_image and 
gl_texture_object and it looked like a substantial size reduction was 
possible.  Maybe you or someone else would like to look into that.

-Brian


>   };
>
>
>   /**
>    * A memory object/resource such as a vertex buffer or texture.
>    */
>   struct pipe_resource
>   {
>      struct pipe_reference reference;
>      struct pipe_screen *screen; /**< screen that this texture belongs to */
>



More information about the mesa-dev mailing list