Mesa (main): ir3/nir: Fix 1d array readonly images
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Feb 28 23:55:24 UTC 2022
Module: Mesa
Branch: main
Commit: 58d72f45e58969dcd45e953487b1bd2338dbb05a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=58d72f45e58969dcd45e953487b1bd2338dbb05a
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Feb 22 11:35:55 2022 +0100
ir3/nir: Fix 1d array readonly images
ncoords includes the array index, and the NIR source has the array index
as its last component, so we have to insert the extra y coordinate in
the middle in this case.
Fixes: 0bb0cac ("freedreno/ir3: handle image buffer")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15114>
---
src/freedreno/ci/freedreno-a630-fails.txt | 2 --
src/freedreno/ir3/ir3_compiler_nir.c | 19 ++++++++++++++-----
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/src/freedreno/ci/freedreno-a630-fails.txt b/src/freedreno/ci/freedreno-a630-fails.txt
index 370451fe929..53ad8041dc4 100644
--- a/src/freedreno/ci/freedreno-a630-fails.txt
+++ b/src/freedreno/ci/freedreno-a630-fails.txt
@@ -239,8 +239,6 @@ spec at arb_texture_rg@texwrap formats-int bordercolor-swizzled at GL_RG32UI- swizzled
spec at arb_texture_rg@texwrap formats-int bordercolor-swizzled at GL_RG8I- swizzled- border color only,Fail
spec at arb_texture_rg@texwrap formats-int bordercolor-swizzled at GL_RG8UI- swizzled- border color only,Fail
-spec at arb_texture_view@rendering-layers-image,Fail
-spec at arb_texture_view@rendering-layers-image at layers rendering of image1DArray,Fail
spec at arb_timer_query@timestamp-get,Fail
# "Expected 1 primitives written, got 0"
diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c
index 0608c14a798..67f1143f92b 100644
--- a/src/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/freedreno/ir3/ir3_compiler_nir.c
@@ -1421,11 +1421,20 @@ emit_intrinsic_load_image(struct ir3_context *ctx, nir_intrinsic_instr *intr,
info.flags |= flags;
- for (unsigned i = 0; i < ncoords; i++)
- coords[i] = src0[i];
-
- if (ncoords == 1)
- coords[ncoords++] = create_immed(b, 0);
+ /* hw doesn't do 1d, so we treat it as 2d with height of 1, and patch up the
+ * y coord. Note that the array index must come after the fake y coord.
+ */
+ enum glsl_sampler_dim dim = nir_intrinsic_image_dim(intr);
+ if (dim == GLSL_SAMPLER_DIM_1D || dim == GLSL_SAMPLER_DIM_BUF) {
+ coords[0] = src0[0];
+ coords[1] = create_immed(b, 0);
+ for (unsigned i = 1; i < ncoords; i++)
+ coords[i + 1] = src0[i];
+ ncoords++;
+ } else {
+ for (unsigned i = 0; i < ncoords; i++)
+ coords[i] = src0[i];
+ }
sam = emit_sam(ctx, OPC_ISAM, info, type, 0b1111,
ir3_create_collect(b, coords, ncoords), NULL);
More information about the mesa-commit
mailing list