Ver Fonte

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

Katelyn Gadd há 4 meses atrás
pai
commit
9479ac039c
1 ficheiros alterados com 4 adições e 1 exclusões
  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,
             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;