Mesa (master): nir: Add a new lowering option to lower all txd to txl.
Eric Anholt
anholt at kemper.freedesktop.org
Thu Dec 14 22:38:01 UTC 2017
Module: Mesa
Branch: master
Commit: 0bead224fea0ad278ec65d2b2a09033b6c5192ff
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0bead224fea0ad278ec65d2b2a09033b6c5192ff
Author: Eric Anholt <eric at anholt.net>
Date: Tue Nov 21 16:21:36 2017 -0800
nir: Add a new lowering option to lower all txd to txl.
VC5 requires that all txd are lowered in the shader.
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/compiler/nir/nir.h | 6 ++++++
src/compiler/nir/nir_lower_tex.c | 14 ++++++++------
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 25c36c66ef..440c3fe997 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2619,6 +2619,12 @@ typedef struct nir_lower_tex_options {
* with lower_txd_cube_map.
*/
bool lower_txd_shadow;
+
+ /**
+ * If true, lower nir_texop_txd on all samplers to a nir_texop_txl.
+ * Implies lower_txd_cube_map and lower_txd_shadow.
+ */
+ bool lower_txd;
} nir_lower_tex_options;
bool nir_lower_tex(nir_shader *shader,
diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index bd603cc228..1062afd97f 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -524,10 +524,9 @@ lower_gradient_cube_map(nir_builder *b, nir_tex_instr *tex)
}
static void
-lower_gradient_shadow(nir_builder *b, nir_tex_instr *tex)
+lower_gradient(nir_builder *b, nir_tex_instr *tex)
{
assert(tex->sampler_dim != GLSL_SAMPLER_DIM_CUBE);
- assert(tex->is_shadow);
assert(tex->op == nir_texop_txd);
assert(tex->dest.is_ssa);
@@ -809,16 +808,19 @@ nir_lower_tex_block(nir_block *block, nir_builder *b,
if (tex->op == nir_texop_txd &&
tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE &&
- (options->lower_txd_cube_map ||
+ (options->lower_txd ||
+ options->lower_txd_cube_map ||
(tex->is_shadow && options->lower_txd_shadow))) {
lower_gradient_cube_map(b, tex);
progress = true;
continue;
}
- if (tex->op == nir_texop_txd && options->lower_txd_shadow &&
- tex->is_shadow && tex->sampler_dim != GLSL_SAMPLER_DIM_CUBE) {
- lower_gradient_shadow(b, tex);
+ if (tex->op == nir_texop_txd &&
+ (options->lower_txd ||
+ (options->lower_txd_shadow &&
+ tex->is_shadow && tex->sampler_dim != GLSL_SAMPLER_DIM_CUBE))) {
+ lower_gradient(b, tex);
progress = true;
continue;
}
More information about the mesa-commit
mailing list