Module: Mesa
Branch: master
Commit: 2764cf8d329d97bc8a06b733db25b85c1d7792eb
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2764cf8d329d97bc8a06b733db25b85c1d7792eb

Author: Danylo Piliaiev <[email protected]>
Date:   Wed Mar  3 18:26:56 2021 +0200

ir3: use OPC_GETBUF to get size of sampler buffers

The maximum value which OPC_GETSIZE could return for one dimension
is 0x007ff0, however sampler buffer could be much bigger.
Blob uses OPC_GETBUF for them.

Fixes tests:
 dEQP-VK.memory.pipeline_barrier.transfer_dst_uniform_texel_buffer.1048576

Signed-off-by: Danylo Piliaiev <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9391>

---

 src/freedreno/ir3/ir3_compiler_nir.c | 12 +++++++++++-
 src/freedreno/ir3/tests/disasm.c     |  2 ++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/freedreno/ir3/ir3_compiler_nir.c 
b/src/freedreno/ir3/ir3_compiler_nir.c
index 7ae85ce74cc..71f57cc6aec 100644
--- a/src/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/freedreno/ir3/ir3_compiler_nir.c
@@ -2568,7 +2568,17 @@ emit_tex_txs(struct ir3_context *ctx, nir_tex_instr *tex)
 
        lod = ir3_get_src(ctx, &tex->src[lod_idx].src)[0];
 
-       sam = emit_sam(ctx, OPC_GETSIZE, info, dst_type, 0b1111, lod, NULL);
+       if (tex->sampler_dim != GLSL_SAMPLER_DIM_BUF) {
+               sam = emit_sam(ctx, OPC_GETSIZE, info, dst_type, 0b1111, lod, 
NULL);
+       } else {
+               /*
+                * The maximum value which OPC_GETSIZE could return for one 
dimension
+                * is 0x007ff0, however sampler buffer could be much bigger.
+                * Blob uses OPC_GETBUF for them.
+                */
+               sam = emit_sam(ctx, OPC_GETBUF, info, dst_type, 0b1111, NULL, 
NULL);
+       }
+
        ir3_split_dest(b, dst, sam, 0, 4);
 
        /* Array size actually ends up in .w rather than .z. This doesn't
diff --git a/src/freedreno/ir3/tests/disasm.c b/src/freedreno/ir3/tests/disasm.c
index c03484c3522..27c2f68918e 100644
--- a/src/freedreno/ir3/tests/disasm.c
+++ b/src/freedreno/ir3/tests/disasm.c
@@ -134,6 +134,8 @@ static const struct test {
        INSTR_6XX(a0c00f00_04400002, "sam (f16)(xyzw)hr0.x, hr0.y, s#2, t#2"),
        INSTR_6XX(a6c02f00_00000000, "rgetinfo (u16)(xyzw)hr0.x"),
        INSTR_6XX(a3482f08_c0000000, "getinfo.base0 (u16)(xyzw)hr2.x, t#0"),
+       /* 
dEQP-GLES31.functional.texture.texture_buffer.render.as_fragment_texture.buffer_size_65536
 */
+       INSTR_5XX(a2c03102_00000000, "getbuf (u32)(x)r0.z, t#0"),
 
 
        /* cat6 */

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to