From 7b934d1ecde6072aa72db550cebc72a327e7a865 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 21 Feb 2021 17:31:30 -0800 Subject: [PATCH] nir/lower_tex: Change coord type to int. nir_tex_instr_src_index returns an int. Fix defect reported by Coverity Scan. Macro compares unsigned to 0 (NO_EFFECT) unsigned_compare: This greater-than-or-equal-to-zero comparison of an unsigned value is always true. coord >= 0U. Fixes: b154a4154b4 ("nir/lower_tex: rewrite tex/txb -> txd/txl before saturating srcs") Signed-off-by: Vinson Lee Reviewed-by: Jason Ekstrand Part-of: --- src/compiler/nir/nir_lower_tex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c index 2447b4b0ed9..ccce138a9cc 100644 --- a/src/compiler/nir/nir_lower_tex.c +++ b/src/compiler/nir/nir_lower_tex.c @@ -705,7 +705,7 @@ lower_tex_to_txd(nir_builder *b, nir_tex_instr *tex) nir_src_copy(&txd->src[i].src, &tex->src[i].src, txd); txd->src[i].src_type = tex->src[i].src_type; } - unsigned coord = nir_tex_instr_src_index(tex, nir_tex_src_coord); + int coord = nir_tex_instr_src_index(tex, nir_tex_src_coord); assert(coord >= 0); nir_ssa_def *dfdx = nir_fddx(b, tex->src[coord].src.ssa); nir_ssa_def *dfdy = nir_fddy(b, tex->src[coord].src.ssa);