diff options
author | Connor Abbott <cwabbott0@gmail.com> | 2022-02-22 11:35:55 +0100 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-02-28 23:33:22 +0000 |
commit | 58d72f45e58969dcd45e953487b1bd2338dbb05a (patch) | |
tree | fc73e7d88de2ccfae7ad2321e099df6033751779 | |
parent | 21ac044c3e25888eb9f1bc72ed09da825e257ae7 (diff) |
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>
-rw-r--r-- | src/freedreno/ci/freedreno-a630-fails.txt | 2 | ||||
-rw-r--r-- | 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@arb_texture_rg@texwrap formats-int bordercolor-swizzled@GL_RG32UI- swizzled spec@arb_texture_rg@texwrap formats-int bordercolor-swizzled@GL_RG8I- swizzled- border color only,Fail spec@arb_texture_rg@texwrap formats-int bordercolor-swizzled@GL_RG8UI- swizzled- border color only,Fail -spec@arb_texture_view@rendering-layers-image,Fail -spec@arb_texture_view@rendering-layers-image@layers rendering of image1DArray,Fail spec@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); |