diff options
author | Lionel Landwerlin <lionel.g.landwerlin@intel.com> | 2020-09-15 15:33:14 +0300 |
---|---|---|
committer | Eric Engestrom <eric@engestrom.ch> | 2020-09-23 20:58:04 +0200 |
commit | a4f2c6facefbb5aafe3beb41a793cac3794b5ad1 (patch) | |
tree | 367274d46b9b85a97a44720cdc7216396de31348 | |
parent | 077d2a8068f89b06c6796cfa6a0113d3cb852798 (diff) |
intel/compiler: fixup Gen12 workaround for array sizes
We didn't handle the case of NULL images/textures for which we should
return 0.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 397ff2976ba281 ("intel: Implement Gen12 workaround for array textures of size 1")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3522
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6729>
(cherry picked from commit cc3bf00cc26ddb991b4036a9911299e7d122115b)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/intel/compiler/brw_nir_clamp_image_1d_2d_array_sizes.c | 21 |
2 files changed, 20 insertions, 3 deletions
diff --git a/.pick_status.json b/.pick_status.json index 4956c2a16fa..151d38f494c 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -589,7 +589,7 @@ "description": "intel/compiler: fixup Gen12 workaround for array sizes", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "397ff2976ba281a7d599b6246b7f6311011eaa0c" }, diff --git a/src/intel/compiler/brw_nir_clamp_image_1d_2d_array_sizes.c b/src/intel/compiler/brw_nir_clamp_image_1d_2d_array_sizes.c index d77955a2d54..8626a87f83f 100644 --- a/src/intel/compiler/brw_nir_clamp_image_1d_2d_array_sizes.c +++ b/src/intel/compiler/brw_nir_clamp_image_1d_2d_array_sizes.c @@ -107,12 +107,29 @@ brw_nir_clamp_image_1d_2d_array_sizes(nir_shader *shader) b.cursor = nir_after_instr(instr); nir_ssa_def *components[4]; + /* OR all the sizes for all components but the last. */ + nir_ssa_def *or_components = nir_imm_int(&b, 0); for (int i = 0; i < image_size->num_components; i++) { if (i == (image_size->num_components - 1)) { - components[i] = nir_imax(&b, nir_channel(&b, image_size, i), - nir_imm_int(&b, 1)); + nir_ssa_def *null_or_size[2] = { + nir_imm_int(&b, 0), + nir_imax(&b, nir_channel(&b, image_size, i), + nir_imm_int(&b, 1)), + }; + nir_ssa_def *vec2_null_or_size = nir_vec(&b, null_or_size, 2); + + /* Using the ORed sizes select either the element 0 or 1 + * from this vec2. For NULL textures which have a size of + * 0x0x0, we'll select the first element which is 0 and for + * the rest MAX(depth, 1). + */ + components[i] = + nir_vector_extract(&b, vec2_null_or_size, + nir_imin(&b, or_components, + nir_imm_int(&b, 1))); } else { components[i] = nir_channel(&b, image_size, i); + or_components = nir_ior(&b, components[i], or_components); } } nir_ssa_def *image_size_replacement = |