From 481df13f2726afd6ff9cbe4043d006023162be34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Pi=C3=B1eiro?= Date: Thu, 10 Mar 2022 12:34:45 +0100 Subject: [PATCH] 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 Part-of: --- 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; }