summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-10-11 12:56:21 -0500
committerJason Ekstrand <[email protected]>2018-12-11 21:26:23 -0600
commit5a968ae473a11bd074281c5d1c4825a295e1dd13 (patch)
tree95294c52b2fd02805bcc1f042fed192609aaec8a /src/compiler
parentcaeffe75492ef3bf8eaa5dae114ada626a9b7cbd (diff)
nir/lower_tex: Simplify lower_gradient logic
Instead of having to call two different lower_gradient functions based on whether or not it's a cube, just make lower_gradient handle cubes. This significantly simplifies some of the logic. Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_lower_tex.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index e10d4ea62f6..86da6537d2d 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -562,6 +562,12 @@ lower_gradient_cube_map(nir_builder *b, nir_tex_instr *tex)
static void
lower_gradient(nir_builder *b, nir_tex_instr *tex)
{
+ /* Cubes are more complicated and have their own function */
+ if (tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE) {
+ lower_gradient_cube_map(b, tex);
+ return;
+ }
+
assert(tex->sampler_dim != GLSL_SAMPLER_DIM_CUBE);
assert(tex->op == nir_texop_txd);
assert(tex->dest.is_ssa);
@@ -832,19 +838,10 @@ 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 ||
- 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 ||
- (options->lower_txd_shadow &&
- tex->is_shadow && tex->sampler_dim != GLSL_SAMPLER_DIM_CUBE))) {
+ (options->lower_txd_shadow && tex->is_shadow) ||
+ (options->lower_txd_cube_map &&
+ tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE))) {
lower_gradient(b, tex);
progress = true;
continue;