From 64c2afe7a8dff4b9dfec0819132dd4445c4d690b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 30 Mar 2022 16:36:06 -0700 Subject: [PATCH] nir: intel/compiler: Lower TXD on array surfaces on DG2+ DG2 can only do sample_d and sample_d_c on 1D and 2D surfaces. Cube maps and 3D surfaces were already handled, but 1D array and 2D array surfaces were not. Fixes the following Vulkan CTS failures on DG2: dEQP-VK.glsl.texture_functions.texturegradclamp.isampler1darray_fragment dEQP-VK.glsl.texture_functions.texturegradclamp.isampler2darray_fragment dEQP-VK.glsl.texture_functions.texturegradclamp.sampler1darray_fixed_fragment dEQP-VK.glsl.texture_functions.texturegradclamp.sampler1darray_float_fragment dEQP-VK.glsl.texture_functions.texturegradclamp.sampler2darray_fixed_fragment dEQP-VK.glsl.texture_functions.texturegradclamp.sampler2darray_float_fragment dEQP-VK.glsl.texture_functions.texturegradclamp.usampler1darray_fragment dEQP-VK.glsl.texture_functions.texturegradclamp.usampler2darray_fragment The Fixes: tag below is a bit misleading. This commit adds another lowering, similar to the one in the Fixes: commit, that probably should have been added at the same time. I just want to make sure this commit gets applied everywhere that commit was also applied. Fixes: 635ed58e527 ("intel/compiler: Lower txd for 3D samplers on XeHP.") Reviewed-by: Jason Ekstrand Part-of: (cherry picked from commit 7fd1955412e252957486e0430b2e5a6e7c755364) --- .pick_status.json | 2 +- src/compiler/nir/nir.h | 5 +++++ src/compiler/nir/nir_lower_tex.c | 3 ++- src/intel/compiler/brw_nir.c | 3 ++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index f28e158180c..6f6e5010027 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -6460,7 +6460,7 @@ "description": "nir: intel/compiler: Lower TXD on array surfaces on DG2+", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "because_sha": "635ed58e527f1a1c0b11eca0552e892f56f8ccf6" }, { diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 272e1d175da..4ea0be0b666 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -4839,6 +4839,11 @@ typedef struct nir_lower_tex_options { */ bool lower_txd_3d; + /** + * If true, lower nir_texop_txd any array surfaces with nir_texop_txl. + */ + bool lower_txd_array; + /** * 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 2664925568f..60e49984bab 100644 --- a/src/compiler/nir/nir_lower_tex.c +++ b/src/compiler/nir/nir_lower_tex.c @@ -1449,7 +1449,8 @@ nir_lower_tex_block(nir_block *block, nir_builder *b, (options->lower_txd_cube_map && tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE) || (options->lower_txd_3d && - tex->sampler_dim == GLSL_SAMPLER_DIM_3D))) { + tex->sampler_dim == GLSL_SAMPLER_DIM_3D) || + (options->lower_txd_array && tex->is_array))) { lower_gradient(b, tex); progress = true; continue; diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index 9998edfc735..377bb5c3e3d 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -814,7 +814,8 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir, .lower_txf_offset = true, .lower_rect_offset = true, .lower_txd_cube_map = true, - .lower_txd_3d = devinfo->verx10 >= 125, + .lower_txd_3d = devinfo->verx10 >= 125, /* Wa_1209978020 */ + .lower_txd_array = devinfo->verx10 >= 125, /* Wa_1209978020 */ .lower_txb_shadow_clamp = true, .lower_txd_shadow_clamp = true, .lower_txd_offset_clamp = true,