mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-28 15:39:10 +00:00
Added SDL_AddVulkanRenderSemaphores() for external synchronization with SDL rendering
This commit is contained in:
parent
504d8c2fc0
commit
48471f7dbd
7 changed files with 129 additions and 5 deletions
|
@ -407,6 +407,7 @@ extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_Rend
|
|||
* family index used for rendering
|
||||
* - `SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER`: the queue
|
||||
* family index used for presentation
|
||||
* - `SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER`: the number of swapchain images, or potential frames in flight, used by the Vulkan renderer
|
||||
*
|
||||
* \param renderer the rendering context
|
||||
* \returns a valid property ID on success or 0 on failure; call
|
||||
|
@ -436,6 +437,7 @@ extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetRendererProperties(SDL_Renderer
|
|||
#define SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER "SDL.renderer.vulkan.device"
|
||||
#define SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER "SDL.renderer.vulkan.graphics_queue_family_index"
|
||||
#define SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER "SDL.renderer.vulkan.present_queue_family_index"
|
||||
#define SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER "SDL.renderer.vulkan.swapchain_image_count"
|
||||
|
||||
/**
|
||||
* Get the output size in pixels of a rendering context.
|
||||
|
@ -2104,6 +2106,25 @@ extern DECLSPEC void *SDLCALL SDL_GetRenderMetalLayer(SDL_Renderer *renderer);
|
|||
*/
|
||||
extern DECLSPEC void *SDLCALL SDL_GetRenderMetalCommandEncoder(SDL_Renderer *renderer);
|
||||
|
||||
|
||||
/**
|
||||
* 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 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_AddVulkanRenderSemaphores(SDL_Renderer *renderer, Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore);
|
||||
|
||||
/**
|
||||
* Toggle VSync of the given renderer.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue