[Mesa-dev] [PATCH] swr: Templetize std::max to work on windows

Ilia Mirkin imirkin at alum.mit.edu
Tue Nov 29 19:53:50 UTC 2016


How about just making 'layers' unsigned? (Hm, I wonder why this didn't
trigger issues with gcc... maybe it should be +1u instead of +1?)

On Tue, Nov 29, 2016 at 2:46 PM, George Kyriazis
<george.kyriazis at intel.com> wrote:
> ---
>  src/gallium/drivers/swr/swr_clear.cpp | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/swr/swr_clear.cpp b/src/gallium/drivers/swr/swr_clear.cpp
> index f59179f..e752ee0 100644
> --- a/src/gallium/drivers/swr/swr_clear.cpp
> +++ b/src/gallium/drivers/swr/swr_clear.cpp
> @@ -46,20 +46,20 @@ swr_clear(struct pipe_context *pipe,
>        for (unsigned i = 0; i < fb->nr_cbufs; ++i)
>           if (fb->cbufs[i] && (buffers & (PIPE_CLEAR_COLOR0 << i))) {
>              clearMask |= (SWR_ATTACHMENT_COLOR0_BIT << i);
> -            layers = std::max(layers, fb->cbufs[i]->u.tex.last_layer -
> +            layers = std::max<int>(layers, fb->cbufs[i]->u.tex.last_layer -
>                                        fb->cbufs[i]->u.tex.first_layer + 1);
>           }
>     }
>
>     if (buffers & PIPE_CLEAR_DEPTH && fb->zsbuf) {
>        clearMask |= SWR_ATTACHMENT_DEPTH_BIT;
> -      layers = std::max(layers, fb->zsbuf->u.tex.last_layer -
> +      layers = std::max<int>(layers, fb->zsbuf->u.tex.last_layer -
>                                  fb->zsbuf->u.tex.first_layer + 1);
>     }
>
>     if (buffers & PIPE_CLEAR_STENCIL && fb->zsbuf) {
>        clearMask |= SWR_ATTACHMENT_STENCIL_BIT;
> -      layers = std::max(layers, fb->zsbuf->u.tex.last_layer -
> +      layers = std::max<int>(layers, fb->zsbuf->u.tex.last_layer -
>                                  fb->zsbuf->u.tex.first_layer + 1);
>     }
>
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list