sdlWaitAndAcquireGpuSwapchainTexture function

bool sdlWaitAndAcquireGpuSwapchainTexture(
  1. Pointer<SdlGpuCommandBuffer> commandBuffer,
  2. Pointer<SdlWindow> window,
  3. Pointer<Pointer<SdlGpuTexture>> swapchainTexture,
  4. Pointer<Uint32> swapchainTextureWidth,
  5. Pointer<Uint32> swapchainTextureHeight,
)

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.

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.

\param command_buffer a command buffer. \param window a window that has been claimed. \param swapchain_texture a pointer filled in with a swapchain texture handle. \param swapchain_texture_width a pointer filled in with the swapchain texture width, may be NULL. \param swapchain_texture_height a pointer filled in with the swapchain texture height, may be NULL. \returns true on success, false on error; call SDL_GetError() for more information.

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

\since This function is available since SDL 3.2.0.

\sa SDL_SubmitGPUCommandBuffer \sa SDL_SubmitGPUCommandBufferAndAcquireFence

extern SDL_DECLSPEC bool SDLCALL SDL_WaitAndAcquireGPUSwapchainTexture( SDL_GPUCommandBuffer *command_buffer, SDL_Window *window, SDL_GPUTexture **swapchain_texture, Uint32 *swapchain_texture_width, Uint32 *swapchain_texture_height)

Implementation

bool sdlWaitAndAcquireGpuSwapchainTexture(
    Pointer<SdlGpuCommandBuffer> commandBuffer,
    Pointer<SdlWindow> window,
    Pointer<Pointer<SdlGpuTexture>> swapchainTexture,
    Pointer<Uint32> swapchainTextureWidth,
    Pointer<Uint32> swapchainTextureHeight) {
  final sdlWaitAndAcquireGpuSwapchainTextureLookupFunction =
      libSdl3.lookupFunction<
              Uint8 Function(
                  Pointer<SdlGpuCommandBuffer> commandBuffer,
                  Pointer<SdlWindow> window,
                  Pointer<Pointer<SdlGpuTexture>> swapchainTexture,
                  Pointer<Uint32> swapchainTextureWidth,
                  Pointer<Uint32> swapchainTextureHeight),
              int Function(
                  Pointer<SdlGpuCommandBuffer> commandBuffer,
                  Pointer<SdlWindow> window,
                  Pointer<Pointer<SdlGpuTexture>> swapchainTexture,
                  Pointer<Uint32> swapchainTextureWidth,
                  Pointer<Uint32> swapchainTextureHeight)>(
          'SDL_WaitAndAcquireGPUSwapchainTexture');
  return sdlWaitAndAcquireGpuSwapchainTextureLookupFunction(
          commandBuffer,
          window,
          swapchainTexture,
          swapchainTextureWidth,
          swapchainTextureHeight) ==
      1;
}