sdlSetGpuSwapchainParameters function

bool sdlSetGpuSwapchainParameters(
  1. Pointer<SdlGpuDevice> device,
  2. Pointer<SdlWindow> window,
  3. int swapchainComposition,
  4. int presentMode,
)

Changes the swapchain parameters for the given claimed window.

This function will fail if the requested present mode or swapchain composition are unsupported by the device. Check if the parameters are supported via SDL_WindowSupportsGPUPresentMode / SDL_WindowSupportsGPUSwapchainComposition prior to calling this function.

SDL_GPU_PRESENTMODE_VSYNC and SDL_GPU_SWAPCHAINCOMPOSITION_SDR are always supported.

\param device a GPU context. \param window an SDL_Window that has been claimed. \param swapchain_composition the desired composition of the swapchain. \param present_mode the desired present mode for the swapchain. \returns true if successful, false on error; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

\sa SDL_WindowSupportsGPUPresentMode \sa SDL_WindowSupportsGPUSwapchainComposition

extern SDL_DECLSPEC bool SDLCALL SDL_SetGPUSwapchainParameters( SDL_GPUDevice *device, SDL_Window *window, SDL_GPUSwapchainComposition swapchain_composition, SDL_GPUPresentMode present_mode)

Implementation

bool sdlSetGpuSwapchainParameters(Pointer<SdlGpuDevice> device,
    Pointer<SdlWindow> window, int swapchainComposition, int presentMode) {
  final sdlSetGpuSwapchainParametersLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlGpuDevice> device, Pointer<SdlWindow> window,
          Int32 swapchainComposition, Int32 presentMode),
      int Function(
          Pointer<SdlGpuDevice> device,
          Pointer<SdlWindow> window,
          int swapchainComposition,
          int presentMode)>('SDL_SetGPUSwapchainParameters');
  return sdlSetGpuSwapchainParametersLookupFunction(
          device, window, swapchainComposition, presentMode) ==
      1;
}