From 16964024b6db31051eba6bb09c6e122349b5c15b Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 20 Jun 2023 13:48:05 -0400 Subject: [PATCH] nir/lower_tex: ignore saturate for txf ops saturate is used for GL_CLAMP emulation, and GL_CLAMP cannot be used with txf ref #9226 cc: mesa-stable Reviewed-by: Jesse Natalie Part-of: (cherry picked from commit 402ae3b132e026d681cb5e4b8b44d6504998c2b5) --- .pick_status.json | 2 +- src/compiler/nir/nir_lower_tex.c | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 27175d7b13d..2c2a7077f04 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1687,7 +1687,7 @@ "description": "nir/lower_tex: ignore saturate for txf ops", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c index 64ab92c4619..60364999a3e 100644 --- a/src/compiler/nir/nir_lower_tex.c +++ b/src/compiler/nir/nir_lower_tex.c @@ -1419,13 +1419,15 @@ nir_lower_tex_block(nir_block *block, nir_builder *b, /* mask of src coords to saturate (clamp): */ unsigned sat_mask = 0; - - if ((1 << tex->sampler_index) & options->saturate_r) - sat_mask |= (1 << 2); /* .z */ - if ((1 << tex->sampler_index) & options->saturate_t) - sat_mask |= (1 << 1); /* .y */ - if ((1 << tex->sampler_index) & options->saturate_s) - sat_mask |= (1 << 0); /* .x */ + /* ignore saturate for txf ops: these don't use samplers and can't GL_CLAMP */ + if (nir_tex_instr_need_sampler(tex)) { + if ((1 << tex->sampler_index) & options->saturate_r) + sat_mask |= (1 << 2); /* .z */ + if ((1 << tex->sampler_index) & options->saturate_t) + sat_mask |= (1 << 1); /* .y */ + if ((1 << tex->sampler_index) & options->saturate_s) + sat_mask |= (1 << 0); /* .x */ + } if (options->lower_index_to_offset) progress |= lower_index_to_offset(b, tex);