table of contents
SDL_AcquireGPUSwapchainTexture(3) | SDL3 FUNCTIONS | SDL_AcquireGPUSwapchainTexture(3) |
NAME¶
SDL_AcquireGPUSwapchainTexture - Acquire a texture to use in presentation.
HEADER FILE¶
Defined in SDL3/SDL_gpu.h
SYNOPSIS¶
#include "SDL3/SDL.h"
bool SDL_AcquireGPUSwapchainTexture( SDL_GPUCommandBuffer *command_buffer, SDL_Window *window, SDL_GPUTexture **swapchain_texture, Uint32 *swapchain_texture_width, Uint32 *swapchain_texture_height);
DESCRIPTION¶
When a swapchain texture is acquired on a command buffer, it will automatically be submitted for presentation when the command buffer is submitted. The swapchain texture should only be referenced by the command buffer used to acquire it. The swapchain texture handle can be filled in with NULL under certain conditions. This is not necessarily an error. If this function returns false then there is an error.
The swapchain texture is managed by the implementation and must not be freed by the user. You MUST NOT call this function from any thread other than the one that created the window.
When using SDL_GPU_PRESENTMODE_VSYNC , this function will block if too many frames are in flight. Otherwise, this function will fill the swapchain texture handle with NULL if too many frames are in flight. The best practice is to call
SDL_CancelGPUCommandBuffer
if the swapchain texture handle is NULL to avoid enqueuing needless work on
the GPU.
FUNCTION PARAMETERS¶
- command_buffer
- a command buffer.
- window
- a window that has been claimed.
- swapchain_texture
- a pointer filled in with a swapchain texture handle.
- swapchain_texture_width
- a pointer filled in with the swapchain texture width, may be NULL.
- swapchain_texture_height
- a pointer filled in with the swapchain texture height, may be NULL.
RETURN VALUE¶
Returns true on success, false on error; call
SDL_GetError () for more information.
AVAILABILITY¶
This function is available since SDL 3.1.3.
SEE ALSO¶
•(3), SDL_GPUPresentMode(3type), •(3), SDL_ClaimWindowForGPUDevice(3), •(3), SDL_SubmitGPUCommandBuffer(3), •(3), SDL_SubmitGPUCommandBufferAndAcquireFence(3), •(3), SDL_CancelGPUCommandBuffer(3), •(3), SDL_GetWindowSizeInPixels(3)
SDL 3.1.6 | Simple Directmedia Layer |