sdlAddVulkanRenderSemaphores function

bool sdlAddVulkanRenderSemaphores(
  1. Pointer<SdlRenderer> renderer,
  2. int waitStageMask,
  3. int waitSemaphore,
  4. int signalSemaphore,
)

Add a set of synchronization semaphores for the current frame.

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.

\param renderer the rendering context. \param wait_stage_mask the VkPipelineStageFlags for the wait. \param wait_semaphore a VkSempahore to wait on before rendering the current frame, or 0 if not needed. \param signal_semaphore a VkSempahore that SDL will signal when rendering for the current frame is complete, or 0 if not needed. \returns true on success or false on failure; call SDL_GetError() for more information.

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

\since This function is available since SDL 3.1.3.

extern SDL_DECLSPEC bool SDLCALL SDL_AddVulkanRenderSemaphores(SDL_Renderer *renderer, Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore)

Implementation

bool sdlAddVulkanRenderSemaphores(Pointer<SdlRenderer> renderer,
    int waitStageMask, int waitSemaphore, int signalSemaphore) {
  final sdlAddVulkanRenderSemaphoresLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlRenderer> renderer, Uint32 waitStageMask,
          Int64 waitSemaphore, Int64 signalSemaphore),
      int Function(
          Pointer<SdlRenderer> renderer,
          int waitStageMask,
          int waitSemaphore,
          int signalSemaphore)>('SDL_AddVulkanRenderSemaphores');
  return sdlAddVulkanRenderSemaphoresLookupFunction(
          renderer, waitStageMask, waitSemaphore, signalSemaphore) ==
      1;
}