Mesa (main): nir: get res binding using component 0, instead of asssumig an uint

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 14 13:37:35 UTC 2022


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

Author: Alejandro Piñeiro <apinheiro at igalia.com>
Date:   Thu Mar 10 12:34:45 2022 +0100

nir: get res binding using component 0, instead of asssumig an uint

Needed to be able to call nir_opt_gcm on the v3dv driver. This change
is needed as on v3dv we honor vulkan resource index returning a vec2.

See commit 21b0a4c80c5f8dd9cdfac7e6b591d6912ba18cf5 for more info.

Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16986>

---

 src/compiler/nir/nir.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 657de0b9d41..0f181e89120 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -2861,7 +2861,11 @@ nir_binding nir_chase_binding(nir_src rsrc)
    if (nir_src_is_const(rsrc)) {
       /* GL binding model after deref lowering */
       res.success = true;
-      res.binding = nir_src_as_uint(rsrc);
+      /* Can't use just nir_src_as_uint. Vulkan resource index produces a
+       * vec2. Some drivers lower it to vec1 (to handle get_ssbo_size for
+       * example) but others just keep it around as a vec2 (v3dv).
+       */
+      res.binding = nir_src_comp_as_uint(rsrc, 0);
       return res;
    }
 



More information about the mesa-commit mailing list