nir/lower_tex: Make the adding a 0 LOD to nir_op_tex in the VS optional.
This controls the whole lowering of "make tex ops with implicit derivatives on non-implicit-derivative stages be tex ops with an explicit lod of 0 instead", but it's really hard to describe that in a git commit summary. All existing callers get it added except: - nir_to_tgsi which didn't want it. - nouveau, which didn't want it (fixes regressions in shadowcube and shadow2darray with NIR, since the shading languages don't expose txl of those sampler types and thus it's not supported in HW) - optional lowering passes in mesa/st (lower_rect, YUV lowering, etc) Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16156>
This commit is contained in:
@@ -5022,6 +5022,12 @@ typedef struct nir_lower_tex_options {
|
||||
*/
|
||||
bool lower_lod_zero_width;
|
||||
|
||||
/* Turns nir_op_tex and other ops with an implicit derivative, in stages
|
||||
* without implicit derivatives (like the vertex shader) to have an explicit
|
||||
* LOD with a value of 0.
|
||||
*/
|
||||
bool lower_invalid_implicit_lod;
|
||||
|
||||
/**
|
||||
* Payload data to be sent to callback / filter functions.
|
||||
*/
|
||||
|
||||
@@ -1480,7 +1480,8 @@ nir_lower_tex_block(nir_block *block, nir_builder *b,
|
||||
* use an explicit LOD of 0.
|
||||
* But don't touch RECT samplers because they don't have mips.
|
||||
*/
|
||||
if (nir_tex_instr_has_implicit_derivative(tex) &&
|
||||
if (options->lower_invalid_implicit_lod &&
|
||||
nir_tex_instr_has_implicit_derivative(tex) &&
|
||||
tex->sampler_dim != GLSL_SAMPLER_DIM_RECT &&
|
||||
!nir_shader_supports_implicit_lod(b->shader)) {
|
||||
lower_zero_lod(b, tex);
|
||||
|
||||
Reference in New Issue
Block a user