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

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


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

Before:

struct wined3d_shader_instruction {
        const struct wined3d_shader_context  * ctx;      /*     0     8 */
        enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx; /*     8     4 */
        DWORD                      flags;                /*    12     4 */
        BOOL                       coissue;              /*    16     4 */

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

        const struct wined3d_shader_src_param  * predicate; /*    24     8 */
        UINT                       dst_count;            /*    32     4 */

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

        const struct wined3d_shader_dst_param  * dst;    /*    40     8 */
        UINT                       src_count;            /*    48     4 */

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

        const struct wined3d_shader_src_param  * src;    /*    56     8 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        struct wined3d_shader_texel_offset texel_offset; /*    64     3 */

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

        union {
                struct wined3d_shader_semantic semantic; /*          96 */
                struct wined3d_shader_register_semantic register_semantic; /*          88 */
                enum wined3d_primitive_type primitive_type; /*           4 */
                struct wined3d_shader_dst_param dst;     /*          80 */
                struct wined3d_shader_src_param src;     /*          72 */
                unsigned int       count;                /*           4 */
                unsigned int       index;                /*           4 */
                const struct wined3d_shader_immediate_constant_buffer  * icb; /*           8 */
                struct wined3d_shader_structured_resource structured_resource; /*          88 */
                struct wined3d_shader_tgsm_raw tgsm_raw; /*          88 */
                struct wined3d_shader_tgsm_structured tgsm_structured; /*          88 */
                struct wined3d_shader_thread_group_size thread_group_size; /*          12 */
                enum wined3d_tessellator_domain tessellator_domain; /*           4 */
                enum wined3d_tessellator_output_primitive tessellator_output_primitive; /*           4 */
                enum wined3d_tessellator_partitioning tessellator_partitioning; /*           4 */
                float              max_tessellation_factor; /*           4 */
                struct wined3d_shader_index_range index_range; /*          88 */
                struct wined3d_shader_indexable_temp indexable_temp; /*          32 */
                struct wined3d_shader_function_table_pointer fp; /*          16 */
        } declaration;                                   /*    72    96 */
        /* --- cacheline 2 boundary (128 bytes) was 40 bytes ago --- */

        /* size: 168, cachelines: 3, members: 11 */
        /* sum members: 151, holes: 4, sum holes: 17 */
        /* last cacheline: 40 bytes */
};

After:

struct wined3d_shader_instruction {
        const struct wined3d_shader_context  * ctx;      /*     0     8 */
        enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx; /*     8     4 */
        DWORD                      flags;                /*    12     4 */
        unsigned int               dst_count;            /*    16     4 */
        unsigned int               src_count;            /*    20     4 */
        const struct wined3d_shader_dst_param  * dst;    /*    24     8 */
        const struct wined3d_shader_src_param  * src;    /*    32     8 */
        struct wined3d_shader_texel_offset texel_offset; /*    40     3 */

        /* XXX 1 byte hole, try to pack */

        BOOL                       coissue;              /*    44     4 */
        const struct wined3d_shader_src_param  * predicate; /*    48     8 */
        union {
                struct wined3d_shader_semantic semantic; /*          96 */
                struct wined3d_shader_register_semantic register_semantic; /*          88 */
                enum wined3d_primitive_type primitive_type; /*           4 */
                struct wined3d_shader_dst_param dst;     /*          80 */
                struct wined3d_shader_src_param src;     /*          72 */
                unsigned int       count;                /*           4 */
                unsigned int       index;                /*           4 */
                const struct wined3d_shader_immediate_constant_buffer  * icb; /*           8 */
                struct wined3d_shader_structured_resource structured_resource; /*          88 */
                struct wined3d_shader_tgsm_raw tgsm_raw; /*          88 */
                struct wined3d_shader_tgsm_structured tgsm_structured; /*          88 */
                struct wined3d_shader_thread_group_size thread_group_size; /*          12 */
                enum wined3d_tessellator_domain tessellator_domain; /*           4 */
                enum wined3d_tessellator_output_primitive tessellator_output_primitive; /*           4 */
                enum wined3d_tessellator_partitioning tessellator_partitioning; /*           4 */
                float              max_tessellation_factor; /*           4 */
                struct wined3d_shader_index_range index_range; /*          88 */
                struct wined3d_shader_indexable_temp indexable_temp; /*          32 */
                struct wined3d_shader_function_table_pointer fp; /*          16 */
        } declaration;                                   /*    56    96 */
        /* --- cacheline 2 boundary (128 bytes) was 24 bytes ago --- */

        /* size: 152, cachelines: 3, members: 11 */
        /* sum members: 151, holes: 1, sum holes: 1 */
        /* last cacheline: 24 bytes */
};

No change in 32-bit build.

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

diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 1641390..761ef18 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1140,13 +1140,13 @@ struct wined3d_shader_instruction
     const struct wined3d_shader_context *ctx;
     enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx;
     DWORD flags;
-    BOOL coissue;
-    const struct wined3d_shader_src_param *predicate;
-    UINT dst_count;
+    unsigned int dst_count;
+    unsigned int src_count;
     const struct wined3d_shader_dst_param *dst;
-    UINT src_count;
     const struct wined3d_shader_src_param *src;
     struct wined3d_shader_texel_offset texel_offset;
+    BOOL coissue;
+    const struct wined3d_shader_src_param *predicate;
     union
     {
         struct wined3d_shader_semantic semantic;
-- 
2.10.2




More information about the wine-patches mailing list