v3d/compiler: num_tex_used on v3d_key

We would need on OpenGL to update values for all the textures used. On
OpenGL that value can be always took from the context or the nir
shader, but there are cases on Vulkan that it is not the case, or
would force up to recompute it.

Acked-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h
index 05591f9..5b837ea 100644
--- a/src/broadcom/compiler/v3d_compiler.h
+++ b/src/broadcom/compiler/v3d_compiler.h
@@ -343,6 +343,7 @@
                 bool clamp_t:1;
                 bool clamp_r:1;
         } tex[V3D_MAX_TEXTURE_SAMPLERS];
+        uint8_t num_tex_used;
         uint8_t ucp_enables;
         bool is_last_geometry_stage;
 };
diff --git a/src/gallium/drivers/v3d/v3d_program.c b/src/gallium/drivers/v3d/v3d_program.c
index 3a431de..7780bc5 100644
--- a/src/gallium/drivers/v3d/v3d_program.c
+++ b/src/gallium/drivers/v3d/v3d_program.c
@@ -445,6 +445,7 @@
 {
         const struct v3d_device_info *devinfo = &v3d->screen->devinfo;
 
+        key->num_tex_used = texstate->num_textures;
         for (int i = 0; i < texstate->num_textures; i++) {
                 struct pipe_sampler_view *sampler = texstate->textures[i];
                 struct v3d_sampler_view *v3d_sampler = v3d_sampler_view(sampler);
@@ -504,6 +505,7 @@
 {
         nir_shader *s = uncompiled->base.ir.nir;
 
+        key->num_tex_used = s->info.num_textures;
         for (int i = 0; i < s->info.num_textures; i++) {
                 key->tex[i].return_size = 16;
                 key->tex[i].return_channels = 2;