Parcourir la source

If VULKAN_Submit fails during VULKAN_INTERNAL_CreateTexture, destroy the texture and return NULL

Katelyn Gadd il y a 4 mois
Parent
commit
9479ac039c
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 4 1
      src/gpu/vulkan/SDL_gpu_vulkan.c

+ 4 - 1
src/gpu/vulkan/SDL_gpu_vulkan.c

@@ -5886,7 +5886,10 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture(
             VULKAN_TEXTURE_USAGE_MODE_UNINITIALIZED,
             VULKAN_TEXTURE_USAGE_MODE_UNINITIALIZED,
             texture);
             texture);
         VULKAN_INTERNAL_TrackTexture(barrierCommandBuffer, texture);
         VULKAN_INTERNAL_TrackTexture(barrierCommandBuffer, texture);
-        VULKAN_Submit((SDL_GPUCommandBuffer *)barrierCommandBuffer);
+        if (!VULKAN_Submit((SDL_GPUCommandBuffer *)barrierCommandBuffer)) {
+            VULKAN_INTERNAL_DestroyTexture(renderer, texture);
+            return NULL;
+        }
     }
     }
 
 
     return texture;
     return texture;