Mesa (main): pan/mdg: Handle 8/16-bit UBO loads

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 18 15:28:39 UTC 2022


Module: Mesa
Branch: main
Commit: 3a53e46fcda431f35f302cdc8c908efac6630326
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3a53e46fcda431f35f302cdc8c908efac6630326

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Fri Feb  4 17:36:56 2022 -0500

pan/mdg: Handle 8/16-bit UBO loads

These will be seen by the compiler when we enable fp16 constant buffers.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14888>

---

 src/panfrost/midgard/midgard_compile.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index 4dabf8bf9a4..71bb4c6a954 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -131,6 +131,8 @@ schedule_barrier(compiler_context *ctx)
 
 M_LOAD(ld_attr_32, nir_type_uint32);
 M_LOAD(ld_vary_32, nir_type_uint32);
+M_LOAD(ld_ubo_u8, nir_type_uint32); /* mandatory extension to 32-bit */
+M_LOAD(ld_ubo_u16, nir_type_uint32);
 M_LOAD(ld_ubo_32, nir_type_uint32);
 M_LOAD(ld_ubo_64, nir_type_uint32);
 M_LOAD(ld_ubo_128, nir_type_uint32);
@@ -1236,7 +1238,11 @@ emit_ubo_read(
         unsigned bitsize = dest_size * nr_comps;
 
         /* Pick the smallest intrinsic to avoid out-of-bounds reads */
-        if (bitsize <= 32)
+        if (bitsize <= 8)
+                ins = m_ld_ubo_u8(dest, 0);
+        else if (bitsize <= 16)
+                ins = m_ld_ubo_u16(dest, 0);
+        else if (bitsize <= 32)
                 ins = m_ld_ubo_32(dest, 0);
         else if (bitsize <= 64)
                 ins = m_ld_ubo_64(dest, 0);



More information about the mesa-commit mailing list