SDL Wiki
(This is the documentation for SDL3, which is under heavy development and the API is changing! SDL2 is the current stable version!)


Add a set of synchronization semaphores for the current frame.

Header File

Defined in <SDL3/SDL_render.h>


int SDL_AddVulkanRenderSemaphores(SDL_Renderer *renderer, Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore);

Function Parameters

SDL_Renderer * renderer the rendering context.
Uint32 wait_stage_mask the VkPipelineStageFlags for the wait.
Sint64 wait_semaphore a VkSempahore to wait on before rendering the current frame, or 0 if not needed.
Sint64 signal_semaphore a VkSempahore that SDL will signal when rendering for the current frame is complete, or 0 if not needed.

Return Value

(int) Returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.


The Vulkan renderer will wait for wait_semaphore before submitting rendering commands and signal signal_semaphore after rendering commands are complete for this frame.

This should be called each frame that you want semaphore synchronization. The Vulkan renderer may have multiple frames in flight on the GPU, so you should have multiple semaphores that are used for synchronization. Querying SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER will give you the maximum number of semaphores you'll need.

Thread Safety

It is NOT safe to call this function from two threads at once.


This function is available since SDL 3.0.0.

CategoryAPI, CategoryAPIFunction, CategoryRender

[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.