[Mesa-dev] [PATCH 1/2] mesa: break up _mesa_swizzle_and_convert() to reduce compile time

Brian Paul brianp at vmware.com
Sat Sep 13 06:12:59 PDT 2014


On 09/12/2014 03:48 PM, Jason Ekstrand wrote:
> One comment below.  Otherwise, both of these look good to me.
>
> Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com
> <mailto:jason.ekstrand at intel.com>>
>
> I haven't applied it and benchmarked it myself, but I don't see anything
> that would hurt performance.
> --Jason
>
> On Fri, Sep 12, 2014 at 9:17 AM, Brian Paul <brianp at vmware.com
> <mailto:brianp at vmware.com>> wrote:
>
>     This reduces gcc -O3 compile time to 1/4 of what it was on my system.
>     Reduces MSVC release build time too.
>     ---
>       src/mesa/main/format_utils.c | 1030
>     ++++++++++++++++++++++--------------------
>       1 file changed, 550 insertions(+), 480 deletions(-)
>
>     diff --git a/src/mesa/main/format_utils.c b/src/mesa/main/format_utils.c
>     index 240e3bc..29d779a 100644
>     --- a/src/mesa/main/format_utils.c
>     +++ b/src/mesa/main/format_utils.c
>     @@ -352,9 +352,14 @@ swizzle_convert_try_memcpy(void *dst, GLenum
>     dst_type, int num_dst_channels,
>        */
>       #define SWIZZLE_CONVERT(DST_TYPE, SRC_TYPE, CONV)                 \
>          do {                                                           \
>     +      const uint8_t swizzle_x = swizzle[0];                       \
>     +      const uint8_t swizzle_y = swizzle[1];                       \
>     +      const uint8_t swizzle_z = swizzle[2];                       \
>     +      const uint8_t swizzle_w = swizzle[3];                       \
>
>
> Is there a reason you got rid of the "register" qualifiers?  I'm not
> 100% sure they were needed in the first place, but I was wondering if
> you had a reason.

It don't make any difference.  The .o file is identical with or without 
the register qualifier (with gcc at least).  We can usually rely on the 
optimizer to do the right thing.

-Brian



More information about the mesa-dev mailing list