[Mesa-dev] [PATCH] radeon: remove unnecessary checks
Nicolai Hähnle
nhaehnle at gmail.com
Mon Jun 13 10:02:10 UTC 2016
On 13.06.2016 03:19, Jakob Sinclair wrote:
> PIPE_SWIZZLE_X is always 0 and desc->swizzle is an unsigned char meaning
> that desc->swizzle can never be smaller then PIPE_SWIZZLE_X. Removing
> these checks doesn't change the code path at all because they would
> always give the same result. Issue discovered by Coverity.
Meh. This is the kind of thing where Coverity should perhaps just shut up :/
Anyway...
> CID: 1337954
>
> Signed-off-by: Jakob Sinclair <sinclair.jakob at openmailbox.org>
> ---
>
> I don't have push access so anyone reviewing this could push it. Thanks!
>
> src/gallium/drivers/radeon/r600_texture.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
> index a1c314e..aa19fc0 100644
> --- a/src/gallium/drivers/radeon/r600_texture.c
> +++ b/src/gallium/drivers/radeon/r600_texture.c
> @@ -1752,10 +1752,9 @@ static void vi_get_fast_clear_parameters(enum pipe_format surface_format,
> return;
>
> for (i = 0; i < 4; ++i) {
> - int index = desc->swizzle[i] - PIPE_SWIZZLE_X;
> + int index = desc->swizzle[i];
>
> - if (desc->swizzle[i] < PIPE_SWIZZLE_X ||
> - desc->swizzle[i] > PIPE_SWIZZLE_W)
> + if (desc->swizzle[i] > PIPE_SWIZZLE_W)
> continue;
>
> if (util_format_is_pure_sint(surface_format)) {
> @@ -1781,7 +1780,6 @@ static void vi_get_fast_clear_parameters(enum pipe_format surface_format,
> for (int i = 0; i < 4; ++i)
> if (values[i] != main_value &&
> desc->swizzle[i] - PIPE_SWIZZLE_X != extra_channel &&
> - desc->swizzle[i] >= PIPE_SWIZZLE_X &&
> desc->swizzle[i] <= PIPE_SWIZZLE_W)
I think for consistency, you should also remove the '- PIPE_SWIZZLE_X'
here, similar to the first hunk. With that changed,
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
> return;
>
>
More information about the mesa-dev
mailing list