Function SDL_WaitAndAcquireGPUSwapchainTexture

pub unsafe extern "C" fn SDL_WaitAndAcquireGPUSwapchainTexture(
    command_buffer: *mut SDL_GPUCommandBuffer,
    window: *mut SDL_Window,
    swapchain_texture: *mut *mut SDL_GPUTexture,
    swapchain_texture_width: *mut u32,
    swapchain_texture_height: *mut u32,
) -> bool
Available on crate feature dep_sdl3 only.
Expand description

Blocks the thread until a swapchain texture is available to be acquired, and then acquires it.

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. It is an error to call SDL_CancelGPUCommandBuffer() after a swapchain texture is acquired.

This function can fill the swapchain texture handle with NULL in certain cases, for example if the window is minimized. This is not an error. You should always make sure to check whether the pointer is NULL before actually using it.

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.

§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.

§Thread safety

This function should only be called from the thread that created the window.

§Availability

This function is available since SDL 3.2.0.

§See also