ac/nir: clean up a hack about rounding 2nd coord component
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 26 Feb 2018 13:05:05 +0000 (14:05 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 27 Feb 2018 09:09:27 +0000 (10:09 +0100)
It's basically just the opposite, and it only makes sense to
round the layer for 2D texture arrays.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/common/ac_nir_to_llvm.c

index 8183e48bd3e4b3fd3b1c9c64fc21a223f90a6264..3f0bfedfa7d4cf313d966e7b1bc4364b36bbf351 100644 (file)
@@ -5082,9 +5082,11 @@ static void visit_tex(struct ac_nir_context *ctx, nir_tex_instr *instr)
                        address[count++] = coords[1];
                }
                if (instr->coord_components > 2) {
-                       /* This seems like a bit of a hack - but it passes Vulkan CTS with it */
-                       if (instr->sampler_dim != GLSL_SAMPLER_DIM_3D &&
-                           instr->sampler_dim != GLSL_SAMPLER_DIM_CUBE &&
+                       if ((instr->sampler_dim == GLSL_SAMPLER_DIM_2D ||
+                            instr->sampler_dim == GLSL_SAMPLER_DIM_MS ||
+                            instr->sampler_dim == GLSL_SAMPLER_DIM_SUBPASS ||
+                            instr->sampler_dim == GLSL_SAMPLER_DIM_SUBPASS_MS) &&
+                           instr->is_array &&
                            instr->op != nir_texop_txf) {
                                coords[2] = apply_round_slice(&ctx->ac, coords[2]);
                        }