[PATCH 3/5] wined3d: Eliminate holes in wined3d_buffer structure.

Józef Kucia jkucia at codeweavers.com
Fri Apr 7 07:45:13 CDT 2017


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---

Before:

struct wined3d_buffer {
        struct wined3d_resource    resource;             /*     0   152 */
        /* --- cacheline 2 boundary (128 bytes) was 24 bytes ago --- */
        struct wined3d_buffer_desc desc;                 /*   152    24 */
        GLuint                     buffer_object;        /*   176     4 */
        GLenum                     buffer_object_usage;  /*   180     4 */
        GLenum                     buffer_type_hint;     /*   184     4 */
        unsigned int               bind_flags;           /*   188     4 */
        /* --- cacheline 3 boundary (192 bytes) --- */
        DWORD                      flags;                /*   192     4 */

        /* XXX 4 bytes hole, try to pack */

        void *                     map_ptr;              /*   200     8 */
        struct wined3d_map_range * maps;                 /*   208     8 */
        SIZE_T                     maps_size;            /*   216     8 */
        SIZE_T                     modified_areas;       /*   224     8 */
        DWORD                      locations;            /*   232     4 */

        /* XXX 4 bytes hole, try to pack */

        struct wined3d_event_query * query;              /*   240     8 */
        UINT                       decl_change_count;    /*   248     4 */
        UINT                       full_conversion_count; /*   252     4 */
        /* --- cacheline 4 boundary (256 bytes) --- */
        UINT                       draw_count;           /*   256     4 */
        UINT                       stride;               /*   260     4 */
        UINT                       conversion_stride;    /*   264     4 */

        /* XXX 4 bytes hole, try to pack */

        enum wined3d_buffer_conversion_type * conversion_map; /*   272     8 */

        /* size: 280, cachelines: 5, members: 19 */
        /* sum members: 268, holes: 3, sum holes: 12 */
        /* last cacheline: 24 bytes */
};

After:

struct wined3d_buffer {
        struct wined3d_resource    resource;             /*     0   152 */
        /* --- cacheline 2 boundary (128 bytes) was 24 bytes ago --- */
        struct wined3d_buffer_desc desc;                 /*   152    24 */
        GLuint                     buffer_object;        /*   176     4 */
        GLenum                     buffer_object_usage;  /*   180     4 */
        GLenum                     buffer_type_hint;     /*   184     4 */
        unsigned int               bind_flags;           /*   188     4 */
        /* --- cacheline 3 boundary (192 bytes) --- */
        DWORD                      flags;                /*   192     4 */
        DWORD                      locations;            /*   196     4 */
        void *                     map_ptr;              /*   200     8 */
        struct wined3d_map_range * maps;                 /*   208     8 */
        SIZE_T                     maps_size;            /*   216     8 */
        SIZE_T                     modified_areas;       /*   224     8 */
        struct wined3d_event_query * query;              /*   232     8 */
        UINT                       decl_change_count;    /*   240     4 */
        UINT                       full_conversion_count; /*   244     4 */
        UINT                       draw_count;           /*   248     4 */
        UINT                       stride;               /*   252     4 */
        /* --- cacheline 4 boundary (256 bytes) --- */
        enum wined3d_buffer_conversion_type * conversion_map; /*   256     8 */
        UINT                       conversion_stride;    /*   264     4 */

        /* size: 272, cachelines: 5, members: 19 */
        /* padding: 4 */
        /* last cacheline: 16 bytes */
};

No change in 32-bit build.

---
 dlls/wined3d/wined3d_private.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 29a1d66..8ce3363 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3341,19 +3341,19 @@ struct wined3d_buffer
     GLenum buffer_type_hint;
     unsigned int bind_flags;
     DWORD flags;
+    DWORD locations;
     void *map_ptr;
 
     struct wined3d_map_range *maps;
     SIZE_T maps_size, modified_areas;
-    DWORD locations;
     struct wined3d_event_query *query;
 
     /* conversion stuff */
     UINT decl_change_count, full_conversion_count;
     UINT draw_count;
     UINT stride;                                            /* 0 if no conversion */
-    UINT conversion_stride;                                 /* 0 if no shifted conversion */
     enum wined3d_buffer_conversion_type *conversion_map;    /* NULL if no conversion */
+    UINT conversion_stride;                                 /* 0 if no shifted conversion */
 };
 
 static inline struct wined3d_buffer *buffer_from_resource(struct wined3d_resource *resource)
-- 
2.10.2




More information about the wine-patches mailing list