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 21b0a4c80c for more info.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16986>
This commit is contained in:
Alejandro Piñeiro 2022-03-10 12:34:45 +01:00 committed by Marge Bot
parent d364d445ad
commit 481df13f27
1 changed files with 5 additions and 1 deletions

View File

@ -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;
}