[Mesa-dev] [PATCH 4/4] swrast: move texture_slices() calls out of loops

Jose Fonseca jfonseca at vmware.com
Thu Apr 24 04:46:17 PDT 2014


Series looks good to me.

Jose

----- Original Message -----
> ---
>  src/mesa/swrast/s_texture.c |   12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
> index 9273e94..5fd80ca 100644
> --- a/src/mesa/swrast/s_texture.c
> +++ b/src/mesa/swrast/s_texture.c
> @@ -269,7 +269,7 @@ _swrast_map_texture(struct gl_context *ctx, struct
> gl_texture_object *texObj)
>        for (level = texObj->BaseLevel; level < MAX_TEXTURE_LEVELS; level++) {
>           struct gl_texture_image *texImage = texObj->Image[face][level];
>           struct swrast_texture_image *swImage =
>           swrast_texture_image(texImage);
> -         unsigned int i;
> +         unsigned int i, slices;
>  
>           if (!texImage)
>              continue;
> @@ -289,7 +289,9 @@ _swrast_map_texture(struct gl_context *ctx, struct
> gl_texture_object *texObj)
>                 continue;
>           }
>  
> -         for (i = 0; i < texture_slices(texImage); i++) {
> +         slices = texture_slices(texImage);
> +
> +         for (i = 0; i < slices; i++) {
>              GLubyte *map;
>              GLint rowStride;
>  
> @@ -327,7 +329,7 @@ _swrast_unmap_texture(struct gl_context *ctx, struct
> gl_texture_object *texObj)
>        for (level = texObj->BaseLevel; level < MAX_TEXTURE_LEVELS; level++) {
>           struct gl_texture_image *texImage = texObj->Image[face][level];
>           struct swrast_texture_image *swImage =
>           swrast_texture_image(texImage);
> -         unsigned int i;
> +         unsigned int i, slices;
>  
>           if (!texImage)
>              continue;
> @@ -338,7 +340,9 @@ _swrast_unmap_texture(struct gl_context *ctx, struct
> gl_texture_object *texObj)
>           if (!swImage->ImageSlices)
>              continue;
>  
> -         for (i = 0; i < texture_slices(texImage); i++) {
> +         slices = texture_slices(texImage);
> +
> +         for (i = 0; i < slices; i++) {
>              if (swImage->ImageSlices[i]) {
>                 ctx->Driver.UnmapTextureImage(ctx, texImage, i);
>                 swImage->ImageSlices[i] = NULL;
> --
> 1.7.10.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=NMr9uy2iTjWVixC0wOcYCWEIYhfo80qKwRgdodpoDzA%3D%0A&m=KFs2hGY7aZVQpjFGiOm4BD4bGrvj7ekX9tjRxABbOAM%3D%0A&s=5ae538c23a2b412d37579b57c230526cb54733b4feb53ac454a3354b114999fa
> 


More information about the mesa-dev mailing list