pvr: fix use of uninitialised value when setting up tex info swizzle

Resolves the following valgrind issue when running GLES CTS:

  ==8318== Conditional jump or move depends on uninitialised value(s)
  ==8318==    at 0x72AE91C: vk_format_to_pipe_format (vk_format.c:263)
  ==8318==    by 0x7051EE7: vk_format_description (vk_format.h:176)
  ==8318==    by 0x7052CFB: pvr_get_format_swizzle (pvr_formats.c:701)
  ==8318==    by 0x708CC2F: pvr_init_tex_info (pvr_query_compute.c:454)
  ==8318==    by 0x708D887: pvr_add_query_program (pvr_query_compute.c:663)
  ==8318==    by 0x708B9BB: pvr_CmdCopyQueryPoolResults (pvr_query.c:535)
  ==8318==    by 0x607E68F: copy_pool_results_to_buffer (zink_query.c:782)
  ==8318==    by 0x607EB37: update_qbo (zink_query.c:853)
  ==8318==    by 0x607FA17: zink_get_query_result (zink_query.c:1145)
  ==8318==    by 0x5E82987: tc_get_query_result (u_threaded_context.c:1283)
  ==8318==    by 0x59A7543: get_query_result (queryobj.c:297)
  ==8318==    by 0x59A78A7: _mesa_check_query (queryobj.c:388)

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31679>
This commit is contained in:
Frank Binns 2024-06-20 15:02:14 +01:00 committed by Marge Bot
parent 1b67637fa0
commit fa889ffec7

View file

@ -451,12 +451,13 @@ static void pvr_init_tex_info(const struct pvr_device_info *dev_info,
uint32_t width,
pvr_dev_addr_t addr)
{
const uint8_t *swizzle_arr = pvr_get_format_swizzle(tex_info->format);
const VkFormat vk_format = VK_FORMAT_R32_UINT;
const uint8_t *swizzle_arr = pvr_get_format_swizzle(vk_format);
bool is_view_1d = !PVR_HAS_FEATURE(dev_info, tpu_extended_integer_lookup) &&
!PVR_HAS_FEATURE(dev_info, tpu_image_state_v2);
*tex_info = (struct pvr_texture_state_info){
.format = VK_FORMAT_R32_UINT,
.format = vk_format,
.mem_layout = PVR_MEMLAYOUT_LINEAR,
.flags = PVR_TEXFLAGS_INDEX_LOOKUP,
.type = is_view_1d ? VK_IMAGE_VIEW_TYPE_1D : VK_IMAGE_VIEW_TYPE_2D,