On 25.04.2018 11:58, Samuel Pitoiset wrote:
1D textures are allocated as 2D which means we only need
one coordinate for texture query LOD.

Fixes: 625dcbbc456 ("amd/common: pass address components individually to
ac_build_image_intrinsic")
Cc: 18.1 <mesa-sta...@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
---
  src/amd/common/ac_llvm_build.c | 10 ++++++++++
  1 file changed, 10 insertions(+)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index f21a5d2623c..be7379f72ef 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -1533,6 +1533,16 @@ LLVMValueRef ac_build_image_opcode(struct 
ac_llvm_context *ctx,
                default:
                        break;
                }
+
+               /* Fixup for GFX9 which allocates 1D textures as 2D, because at
+                * this point we don't know the orignal sampler dimension.
+                */
+               if (ctx->chip_class >= GFX9) {
+                       if ((a->dim == ac_image_2darray ||
+                            a->dim == ac_image_2d) && !a->coords[1]) {
+                               num_coords = 1;
+                       }
+               }

Can we do this fixup in ac_nir_to_llvm instead, please? Pretty sure that that's needed for correctness anyway: with this change, the second coordinate will be basically random, which can probably affect the hardware's LOD even when the texture's height is 1.

Thanks,
Nicolai

        }
if (a->offset)



--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to