pvr: Don't allocate/upload 0 size coeff programs
authorJarred Davies <jarred.davies@imgtec.com>
Mon, 6 Mar 2023 00:08:04 +0000 (00:08 +0000)
committerMarge Bot <emma+marge@anholt.net>
Wed, 22 Mar 2023 04:15:57 +0000 (04:15 +0000)
Fixes assert seen in dEQP-Vk.api.smoke.triangle

Signed-off-by: Jarred Davies <jarred.davies@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22051>

src/imagination/vulkan/pvr_pipeline.c

index 89962d9..806249e 100644 (file)
@@ -78,6 +78,14 @@ static VkResult pvr_pds_coeff_program_create_and_upload(
    /* Get the size of the program and then allocate that much memory. */
    pvr_pds_coefficient_loading(&program, NULL, PDS_GENERATE_SIZES);
 
+   if (!program.code_size) {
+      pds_upload_out->pvr_bo = NULL;
+      pds_upload_out->code_size = 0;
+      pds_upload_out->data_size = 0;
+
+      return VK_SUCCESS;
+   }
+
    staging_buffer_size =
       (program.code_size + program.data_size) * sizeof(*staging_buffer);