aco: fix determining if LOD is zero for nir_texop_txf/nir_texop_txs

txf/txs expects LOD to be a 32-bit unsigned integer while other
texture operations expects a float.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3668
Fixes: 93c8ebfa78 ("aco: Initial commit of independent AMD compiler")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7256>
(cherry picked from commit 4e2fe34aa9)
This commit is contained in:
Samuel Pitoiset 2020-10-21 18:25:56 +02:00 committed by Dylan Baker
parent 2f09ff3fc8
commit e12a581a3a
2 changed files with 2 additions and 4 deletions

View file

@ -1282,7 +1282,7 @@
"description": "aco: fix determining if LOD is zero for nir_texop_txf/nir_texop_txs",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "93c8ebfa780ebd1495095e794731881aef29e7d3"
},

View file

@ -8514,9 +8514,7 @@ void visit_tex(isel_context *ctx, nir_tex_instr *instr)
has_bias = true;
break;
case nir_tex_src_lod: {
nir_const_value *val = nir_src_as_const_value(instr->src[i].src);
if (val && val->f32 <= 0.0) {
if (nir_src_is_const(instr->src[i].src) && nir_src_as_uint(instr->src[i].src) == 0) {
level_zero = true;
} else {
lod = get_ssa_temp(ctx, instr->src[i].src.ssa);