etnaviv: slim down etna_shader_key

The max number of exposed fragment samplers and views on any hardware is 16,
so there is no point in having arrays of 128 entries to track information
for the shadow sampler lowering in the shader key. Most of them will never
be used. Reduce the size of the arrays to what is actually necessary and add
a assert to make sure the sampler (view) limit isn't bumped without a
matching change in the shader key.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18968>
This commit is contained in:
Lucas Stach 2022-10-05 15:14:50 +02:00 committed by Marge Bot
parent 1964899c28
commit a1af7ae96a
2 changed files with 4 additions and 2 deletions

View file

@ -435,6 +435,8 @@ etna_shader_variant(struct etna_shader *shader, struct etna_shader_key key,
{
struct etna_shader_variant *v;
assert(shader->specs->fragment_sampler_count <= ARRAY_SIZE(key.tex_swizzle));
for (v = shader->variants; v; v = v->next)
if (etna_shader_key_equal(&key, &v->key))
return v;

View file

@ -59,8 +59,8 @@ struct etna_shader_key
};
int num_texture_states;
nir_lower_tex_shadow_swizzle tex_swizzle[PIPE_MAX_SHADER_SAMPLER_VIEWS];
enum compare_func tex_compare_func[PIPE_MAX_SHADER_SAMPLER_VIEWS];
nir_lower_tex_shadow_swizzle tex_swizzle[16];
enum compare_func tex_compare_func[16];
};
static inline bool