From 62ca99747615c3d4c9d4e9e87851721eef31a8f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Pi=C3=B1eiro?= Date: Mon, 16 Dec 2019 12:11:37 +0100 Subject: [PATCH] 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 Part-of: --- src/broadcom/compiler/v3d_compiler.h | 1 + src/gallium/drivers/v3d/v3d_program.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h index 05591f9eb48..5b837eadf5f 100644 --- a/src/broadcom/compiler/v3d_compiler.h +++ b/src/broadcom/compiler/v3d_compiler.h @@ -343,6 +343,7 @@ struct v3d_key { 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 3a431de56bf..7780bc52f56 100644 --- a/src/gallium/drivers/v3d/v3d_program.c +++ b/src/gallium/drivers/v3d/v3d_program.c @@ -445,6 +445,7 @@ v3d_setup_shared_key(struct v3d_context *v3d, struct v3d_key *key, { 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 @@ v3d_setup_shared_precompile_key(struct v3d_uncompiled_shader *uncompiled, { 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;