[Mesa-dev] [PATCH] st/mesa: don't set the border color if it's unused

Michel Dänzer michel at daenzer.net
Fri Jun 16 04:08:10 UTC 2017


On 15/06/17 08:56 PM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>

[...]

>     /* For non-black borders... */
> -   if (msamp->BorderColor.ui[0] ||
> -       msamp->BorderColor.ui[1] ||
> -       msamp->BorderColor.ui[2] ||
> -       msamp->BorderColor.ui[3]) {
> +   if ((msamp->BorderColor.ui[0] ||
> +        msamp->BorderColor.ui[1] ||
> +        msamp->BorderColor.ui[2] ||
> +        msamp->BorderColor.ui[3]) &&
> +       /* This is true if wrap modes are using the border color. */
> +       (sampler->wrap_s | sampler->wrap_t | sampler->wrap_r) & 0x1) {

I'd make this

   if (/* This is true if wrap modes are using the border color. */
       (sampler->wrap_s | sampler->wrap_t | sampler->wrap_r) & 0x1 &&
       (msamp->BorderColor.ui[0] ||
        msamp->BorderColor.ui[1] ||
        msamp->BorderColor.ui[2] ||
        msamp->BorderColor.ui[3])) {

No need to test the BorderColor.ui array when the border colour isn't used.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list