SDL_CancelGPUCommandBuffer(3)

πŸ’… SDL_CancelGPUCommandBuffer ✨

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where today's main character is literally just a little function named SDL_CancelGPUCommandBuffer πŸŽ€ β€” and yes, her whole job is cancelling a command buffer. no cap.


🌸 NAME 🌸

SDL_CancelGPUCommandBuffer β€” cancels a command buffer. that's it. that's the vibe. πŸ’–


✨ SYNOPSIS ✨

#include <SDL3/SDL_gpu.h>

bool SDL_CancelGPUCommandBuffer(
    SDL_GPUCommandBuffer *command_buffer);

like, you pull in <SDL3/SDL_gpu.h> and then you get to yeet a command buffer into the void. iconic. πŸ¦‹


πŸ’€ DESCRIPTION πŸ’€

okay so here's the tea, and it's actually important, so pay attention pookie πŸ™ˆ

None of the enqueued commands are executed. literally zero. all those commands you queued up? not happening. cancelled. ghosted. they're not even gonna show up. πŸ’…

it is an error to call this function after a swapchain texture has been acquired. so like, once you've got your hands on that swapchain texture, this door is closed, bestie. no going back. 😭

this must be called from the thread the command buffer was acquired on. same thread, no switching up on us. the command buffer knows where it came from and it will absolutely clock you if you try to play it any other way. 🫢

and the big one β€” you must not reference the command buffer after calling this function. not once. not a lil peek. not a "just to check." it's done. let her rest. ⭐


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • command_buffer β€” a command buffer. yeah that's the whole description, she's lowkey mysterious like that 🧚

🌈 RETURN VALUE 🌈

returns true on success, false on error. and if you get that false, don't just sit there spiralling β€” call SDL_GetError() for more information, she'll tell you what went wrong. πŸ’œ


πŸ”₯ AVAILABILITY πŸ”₯

this function is available since SDL 3.2.0. so if you're on anything older, sorry babes, she's not there yet πŸ“


πŸ‘‘ SEE ALSO πŸ‘‘

go read those next, iykyk πŸ’–


and that's the whole page, bestie β€” brought to you by the fine folks at Simple Directmedia Layer, running SDL 3.4.18, and dated right there in the corner as always. mwah πŸ’‹ periodt.

πŸ“¦ where this page comes from