[Mesa-dev] [PATCH 5/9] gallium: decrease the size of pipe_sampler_view - 48 -> 32 bytes

Marek Olšák maraeo at gmail.com
Sun Apr 2 18:00:26 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/include/pipe/p_state.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index a4692b6..392bb8b 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -419,40 +419,40 @@ struct pipe_surface
    union pipe_surface_desc u;
 };
 
 
 /**
  * A view into a texture that can be bound to a shader stage.
  */
 struct pipe_sampler_view
 {
    struct pipe_reference reference;
-   enum pipe_texture_target target; /**< PIPE_TEXTURE_x */
-   enum pipe_format format;      /**< typed PIPE_FORMAT_x */
+   enum pipe_format format:16;      /**< typed PIPE_FORMAT_x */
+   enum pipe_texture_target target:4; /**< PIPE_TEXTURE_x */
+   unsigned swizzle_r:3;         /**< PIPE_SWIZZLE_x for red component */
+   unsigned swizzle_g:3;         /**< PIPE_SWIZZLE_x for green component */
+   unsigned swizzle_b:3;         /**< PIPE_SWIZZLE_x for blue component */
+   unsigned swizzle_a:3;         /**< PIPE_SWIZZLE_x for alpha component */
    struct pipe_resource *texture; /**< texture into which this is a view  */
    struct pipe_context *context; /**< context this view belongs to */
    union {
       struct {
          unsigned first_layer:16;  /**< first layer to use for array textures */
          unsigned last_layer:16;   /**< last layer to use for array textures */
          unsigned first_level:8;   /**< first mipmap level to use */
          unsigned last_level:8;    /**< last mipmap level to use */
       } tex;
       struct {
          unsigned offset;   /**< offset in bytes */
          unsigned size;     /**< size of the readable sub-range in bytes */
       } buf;
    } u;
-   unsigned swizzle_r:3;         /**< PIPE_SWIZZLE_x for red component */
-   unsigned swizzle_g:3;         /**< PIPE_SWIZZLE_x for green component */
-   unsigned swizzle_b:3;         /**< PIPE_SWIZZLE_x for blue component */
-   unsigned swizzle_a:3;         /**< PIPE_SWIZZLE_x for alpha component */
 };
 
 
 /**
  * A description of a buffer or texture image that can be bound to a shader
  * stage.
  */
 struct pipe_image_view
 {
    struct pipe_resource *resource; /**< resource into which this is a view  */
-- 
2.7.4



More information about the mesa-dev mailing list