v3dv: fix assigned value is garbage or undefined

This is actually a false positive detected by static analyzer, because
it assumes that `device->instance->meta_cache_enabled` can change
between two execution points.

In order to instruct static analyzer this is not the case, we assing it
to a local variable, and do the checks based on that.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32819>
This commit is contained in:
Juan A. Suarez Romero
2024-12-30 16:54:26 +01:00
committed by Marge Bot
parent 0d14e129bc
commit 69d3d7288e

View File

@@ -950,7 +950,9 @@ get_depth_clear_pipeline(struct v3dv_cmd_buffer *cmd_buffer,
assert(vk_format_is_depth_or_stencil(format));
uint64_t key;
if (device->instance->meta_cache_enabled) {
bool meta_cache_enabled = device->instance->meta_cache_enabled;
if (meta_cache_enabled) {
key = get_depth_clear_pipeline_cache_key(aspects, format, samples,
is_layered, has_multiview);
mtx_lock(&device->meta.mtx);
@@ -982,7 +984,7 @@ get_depth_clear_pipeline(struct v3dv_cmd_buffer *cmd_buffer,
if (result != VK_SUCCESS)
goto fail;
if (device->instance->meta_cache_enabled) {
if (meta_cache_enabled) {
(*pipeline)->key = key;
_mesa_hash_table_insert(device->meta.depth_clear.cache,
&(*pipeline)->key, *pipeline);