nir/lower_tex: Rework invalid implicit LOD lowering
Only fragment and some compute shaders support implicit derivatives. They're totally meaningless without helper invocations and some understanding of the dispatch pattern. We've got code to lower nir_texop_tex in these shader stages to use an explicit derivative of 0 but it was pretty badly broken: 1. It only handled nir_texop_tex, not nir_texop_txb or nir_texop_lod. 2. It didn't take min_lod into account 3. It was conflated with adding a missing LOD parameter to opcodes which expect one such as nir_texop_txf. While not really a bug, this does make it way harder to reason about the code. 4. Unless you set a flag (which most drivers don't), it left the opcode nir_texop_tex instead of nir_texop_txl which it should have been. This reworks it to go through roughly the same path as other LOD lowering only with a constant lod of 0 instead of calling out to nir_texop_lod. We also get rid of the lower_tex_without_implicit_lod flag because most drivers set it and those that don't are probably subtly broken. If someone really wants to get nir_texop_tex in their vertex shaders, they can write a new patch to add the flag back in. Fixes:e382890e25
"nir: set default lod to texture opcodes that..." Fixes:d5ac5d6e83
"nir: Add option to lower tex to txl when..." Reviewed-by: Connor Abbott <cwabbott0@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11775>
This commit is contained in:

committed by
Marge Bot

parent
f9442e46ff
commit
74ec2b12be
@@ -831,7 +831,6 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir,
|
||||
.lower_txp = ~0,
|
||||
.lower_txf_offset = true,
|
||||
.lower_rect_offset = true,
|
||||
.lower_tex_without_implicit_lod = true,
|
||||
.lower_txd_cube_map = true,
|
||||
.lower_txd_3d = devinfo->verx10 >= 125,
|
||||
.lower_txb_shadow_clamp = true,
|
||||
|
Reference in New Issue
Block a user