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: b154a4154b ("nir/lower_tex: rewrite tex/txb -> txd/txl before saturating srcs")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9181>
This commit is contained in:
Vinson Lee 2021-02-21 17:31:30 -08:00 committed by Marge Bot
parent 816d28f4a1
commit 7b934d1ecd

View file

@ -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);