[PATCH v2 1/5] wined3d: Save pixel and vertex shader resource views in stateblocks.

Henri Verbeet hverbeet at gmail.com
Wed Apr 5 12:03:15 CDT 2017


On 5 April 2017 at 15:38, Józef Kucia <jkucia at codeweavers.com> wrote:
> @@ -3129,6 +3129,8 @@ struct wined3d_saved_states
>      WORD vertexShaderConstantsB;                /* WINED3D_MAX_CONSTS_B, 16 */
>      WORD vertexShaderConstantsI;                /* WINED3D_MAX_CONSTS_I, 16 */
>      BOOL vs_consts_f[WINED3D_MAX_VS_CONSTS_F];
> +    DWORD pixel_shader_resource_views : 16;     /* MAX_FRAGMENT_SAMPLERS, 16 */
> +    DWORD vertex_shader_resource_views : 4;     /* MAX_VERTEX_SAMPLERS,    4 */
>      DWORD textures : 20;                        /* MAX_COMBINED_SAMPLERS, 20 */
>      DWORD indices : 1;
>      DWORD material : 1;
> @@ -3137,17 +3139,18 @@ struct wined3d_saved_states
>      DWORD pixelShader : 1;
>      DWORD vertexShader : 1;
>      DWORD scissorRect : 1;
> -    DWORD padding : 5;
> +    DWORD padding : 17;

That doesn't do the right thing, unfortunately:

    struct wined3d_saved_states {
           DWORD                      transform[16];        /*     0    64 */
           /* --- cacheline 1 boundary (64 bytes) --- */
           WORD                       streamSource;         /*    64     2 */
           WORD                       streamFreq;           /*    66     2 */
           DWORD                      renderState[7];       /*    68    28 */
           DWORD                      textureState[8];      /*    96    32 */
           /* --- cacheline 2 boundary (128 bytes) --- */
           WORD                       samplerState[20];     /*   128    40 */
           DWORD                      clipplane;            /*   168     4 */
           WORD                       pixelShaderConstantsB; /*   172     2 */
           WORD                       pixelShaderConstantsI; /*   174     2 */
           BOOL                       ps_consts_f[224];     /*   176   896 */
           /* --- cacheline 16 boundary (1024 bytes) was 48 bytes ago --- */
           WORD                       vertexShaderConstantsB; /*  1072     2 */
           WORD                       vertexShaderConstantsI; /*  1074     2 */
           BOOL                       vs_consts_f[256];     /*  1076  1024 */
           /* --- cacheline 32 boundary (2048 bytes) was 52 bytes ago --- */
           DWORD                      pixel_shader_resource_views:16;
/*  2100:16  4 */
           DWORD                      vertex_shader_resource_views:4;
/*  2100:12  4 */

           /* XXX 12 bits hole, try to pack */

           DWORD                      textures:20;          /*  2104:12  4 */
           DWORD                      indices:1;            /*  2104:11  4 */
           DWORD                      material:1;           /*  2104:10  4 */
           DWORD                      viewport:1;           /*  2104: 9  4 */
           DWORD                      vertexDecl:1;         /*  2104: 8  4 */
           DWORD                      pixelShader:1;        /*  2104: 7  4 */
           DWORD                      vertexShader:1;       /*  2104: 6  4 */
           DWORD                      scissorRect:1;        /*  2104: 5  4 */

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

           DWORD                      padding:17;           /*  2108:15  4 */
           /* --- cacheline 33 boundary (2112 bytes) --- */

           /* size: 2112, cachelines: 33, members: 24 */
           /* bit holes: 2, sum bit holes: 17 bits */
           /* bit_padding: 15 bits */
    };

Incidentally, this also illustrates the issue of the ps_consts_f and
vs_consts_f fields using up way more space than needed.



More information about the wine-devel mailing list