From 933c44bcc435f2285be4c0cdb5684bacc193ff8d Mon Sep 17 00:00:00 2001 From: Sagar Ghuge Date: Thu, 13 Dec 2018 11:40:58 -0800 Subject: [PATCH] nir: Add a new lowering option to lower 3D surfaces from txd to txl. Tested on gen9. v2: Rename lower_txd_3d_surafaces flag to lower_txd_3d (Jason Ekstrand) Signed-off-by: Sagar Ghuge Reviewed-by: Jason Ekstrand --- src/compiler/nir/nir.h | 5 +++++ src/compiler/nir/nir_lower_tex.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 54f9c64a3a3..12bbfa3220e 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -3008,6 +3008,11 @@ typedef struct nir_lower_tex_options { */ bool lower_txd_cube_map; + /** + * If true, lower nir_texop_txd on 3D surfaces with nir_texop_txl. + */ + bool lower_txd_3d; + /** * If true, lower nir_texop_txd on shadow samplers (except cube maps) * with nir_texop_txl. Notice that cube map shadow samplers are lowered diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c index 6a6b6c41a7b..43094d5174d 100644 --- a/src/compiler/nir/nir_lower_tex.c +++ b/src/compiler/nir/nir_lower_tex.c @@ -905,7 +905,9 @@ nir_lower_tex_block(nir_block *block, nir_builder *b, (options->lower_txd_shadow_clamp && tex->is_shadow && has_min_lod) || (options->lower_txd_offset_clamp && has_offset && has_min_lod) || (options->lower_txd_cube_map && - tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE))) { + tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE) || + (options->lower_txd_3d && + tex->sampler_dim == GLSL_SAMPLER_DIM_3D))) { lower_gradient(b, tex); progress = true; continue; -- 2.30.2