nir/lower_tex: Add a way to lower TXS(non-0-LOD) instructions

The V3D driver has an open-coded solution for this, and we need the
same thing for Panfrost, so let's add a generic way to lower TXS(LOD)
into max(TXS(0) >> LOD, 1).

Changes in v2:
* Use == 0 instead of !
* Rework the minification logic as suggested by Jason
* Assign cursor pos at the beginning of the function
* Patch the LOD just after retrieving the old value

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Boris Brezillon
2019-06-17 11:43:13 +02:00
committed by Alyssa Rosenzweig
parent 0e489fd360
commit 296c5fd25d
2 changed files with 52 additions and 0 deletions

View File

@@ -3426,6 +3426,12 @@ typedef struct nir_lower_tex_options {
*/
bool lower_txd_clamp_if_sampler_index_not_lt_16;
/**
* If true, lower nir_texop_txs with a non-0-lod into nir_texop_txs with
* 0-lod followed by a nir_ishr.
*/
bool lower_txs_lod;
/**
* If true, apply a .bagr swizzle on tg4 results to handle Broadcom's
* mixed-up tg4 locations.