Mesa (master): gallium: rearrange some members to avoid memory holes/ padding

Zack Rusin zack at kemper.freedesktop.org
Tue Jul 7 01:40:13 UTC 2009


Module: Mesa
Branch: master
Commit: 124a6b1958c630ea049025e2b72547096fdc8f2c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=124a6b1958c630ea049025e2b72547096fdc8f2c

Author: Zack Rusin <zack at kde.org>
Date:   Tue Jun 23 19:12:46 2009 -0400

gallium: rearrange some members to avoid memory holes/padding

plus it saves us a cacheline in the cso

---

 src/gallium/auxiliary/cso_cache/cso_context.c |    4 ++--
 src/gallium/include/pipe/p_state.h            |   12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index f388bf5..36c882a 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -55,14 +55,14 @@ struct cso_context {
    void *samplers[PIPE_MAX_SAMPLERS];
    unsigned nr_samplers;
 
-   void *samplers_saved[PIPE_MAX_SAMPLERS];
    unsigned nr_samplers_saved;
+   void *samplers_saved[PIPE_MAX_SAMPLERS];
 
    struct pipe_texture *textures[PIPE_MAX_SAMPLERS];
    uint nr_textures;
 
-   struct pipe_texture *textures_saved[PIPE_MAX_SAMPLERS];
    uint nr_textures_saved;
+   struct pipe_texture *textures_saved[PIPE_MAX_SAMPLERS];
 
    /** Current and saved state.
     * The saved state is used as a 1-deep stack.
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 932c024..626bedb 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -75,11 +75,11 @@ struct pipe_surface;
  */
 struct pipe_buffer
 {
-   struct pipe_reference reference;
-   struct pipe_screen *screen;
-   unsigned alignment;
-   unsigned usage;
-   unsigned size;
+   struct pipe_reference  reference;
+   unsigned               size;
+   struct pipe_screen    *screen;
+   unsigned               alignment;
+   unsigned               usage;
 };
 
 
@@ -286,10 +286,10 @@ struct pipe_surface
    unsigned offset;              /**< offset from start of buffer, in bytes */
    unsigned usage;               /**< PIPE_BUFFER_USAGE_*  */
 
+   unsigned zslice;
    struct pipe_texture *texture; /**< texture into which this is a view  */
    unsigned face;
    unsigned level;
-   unsigned zslice;
 };
 
 




More information about the mesa-commit mailing list