SDL_Vulkan_DestroySurface(3)

πŸ’– SDL_Vulkan_DestroySurface πŸ’–

okay bestie, this one lives in the SDL3 FUNCTIONS section of the manual, and it's about one very specific little chore: destroying the Vulkan rendering surface of a window. yes that's the whole vibe. let's get into it πŸ¦‹


✨ NAME ✨

SDL_Vulkan_DestroySurface β€” Destroy the Vulkan rendering surface of a window.

like. it destroys it. it's in the name. πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_vulkan.h>

void SDL_Vulkan_DestroySurface(VkInstance instance,
                           VkSurfaceKHR surface,
                           const struct VkAllocationCallbacks *allocator);

look at her. three lil arguments. so tidy. so iconic. πŸ‘‘


πŸŽ€ DESCRIPTION πŸŽ€

okay so here's the tea, and this part actually matters, don't skip it:

This should be called before SDL_DestroyWindow, if SDL_Vulkan_CreateSurface was called after SDL_CreateWindow. order is literally everything here, bestie, don't do it backwards 😭

Also β€” and this is a requirement, not a suggestion β€” the instance must have been created with extensions returned by SDL_Vulkan_GetInstanceExtensions() enabled, and surface must have been created successfully by an SDL_Vulkan_CreateSurface() call. no shortcuts, no improvised instances, that's the rule fr fr 🫢

and about allocator: if it's NULL, Vulkan will use the system default allocator. this argument gets passed directly to Vulkan and isn't used by SDL itself at all β€” SDL is just the messenger, handing it over. πŸ’Œ


🌈 FUNCTION PARAMETERS 🌈

  • instance β€” the Vulkan instance handle. the main character of this parameter list, honestly. ✨
  • surface β€” the vkSurfaceKHR handle to destroy. this is the thing getting yeeted. πŸ’€
  • allocator β€” a VkAllocationCallbacks struct, which lets the app set the allocator that destroys the surface. Can be NULL. so like, optional bestie, no pressure. πŸŽ€

⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. so if you're on something older, no surface-destroying for you, sorry babe πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

iykyk β€” the create side and the extensions side. this destroy function is the third member of that little trio. 🌸


lowkey reminder: clean up your surfaces before you destroy the window, or the order police will come for you. no cap. 🚨

kisses, this page came to you from the Simple Directmedia Layer girlies, running SDL 3.4.18, and filed under SDL_Vulkan_DestroySurface(3) β€” mwah, go free your surfaces bestie πŸ’œβœ¨

πŸ“¦ where this page comes from