logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SDL_AcquireGPUSwapchainTexture - Acquire a texture to use in presentation.

Availability

       This function is available since SDL 3.2.0.

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.

       This function will fill the swapchain texture handle with NULL if too many frames are in flight. This  is
       not an error.

       If  you  use this function, it is possible to create a situation where many command buffers are allocated
       while the rendering context waits for the GPU to catch up, which will cause memory  usage  to  grow.  You
       should use

       SDL_WaitAndAcquireGPUSwapchainTexture () unless you know what you are doing with timing.

       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.

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.

Header File

       Defined in SDL3/SDL_gpu.h

Name

       SDL_AcquireGPUSwapchainTexture - Acquire a texture to use in presentation.

Return Value

       Returns true on success, false on error; call

       SDL_GetError () for more information.

See Also

(3),       SDL_ClaimWindowForGPUDevice(3),       (3),       SDL_SubmitGPUCommandBuffer(3),        (3),
       SDL_SubmitGPUCommandBufferAndAcquireFence(3),       (3),       SDL_CancelGPUCommandBuffer(3),      (3),
       SDL_GetWindowSizeInPixels(3),             (3),             SDL_WaitForGPUSwapchain(3),             (3),
       SDL_WaitAndAcquireGPUSwapchainTexture(3), (3), SDL_SetGPUAllowedFramesInFlight(3)

Simple Directmedia Layer                           SDL 3.2.10                  SDL_AcquireGPUSwapchainTexture(3)

Synopsis

#include"SDL3/SDL.h"boolSDL_AcquireGPUSwapchainTexture(SDL_GPUCommandBuffer*command_buffer,SDL_Window*window,SDL_GPUTexture**swapchain_texture,Uint32*swapchain_texture_width,Uint32*swapchain_texture_height);

Thread Safety

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

See Also