sdlWaitForGpuFences function gpu

bool sdlWaitForGpuFences(
  1. Pointer<SdlGpuDevice> device,
  2. bool waitAll,
  3. Pointer<Pointer<SdlGpuFence>> fences,
  4. int numFences,
)

Blocks the thread until the given fences are signaled.

\param device a GPU context. \param wait_all if 0, wait for any fence to be signaled, if 1, wait for all fences to be signaled. \param fences an array of fences to wait on. \param num_fences the number of fences in the fences array. \returns true on success, false on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.2.0.

\sa SDL_SubmitGPUCommandBufferAndAcquireFence \sa SDL_WaitForGPUIdle

extern SDL_DECLSPEC bool SDLCALL SDL_WaitForGPUFences( SDL_GPUDevice *device, bool wait_all, SDL_GPUFence *const *fences, Uint32 num_fences)

Implementation

bool sdlWaitForGpuFences(
  Pointer<SdlGpuDevice> device,
  bool waitAll,
  Pointer<Pointer<SdlGpuFence>> fences,
  int numFences,
) {
  final sdlWaitForGpuFencesLookupFunction = _libSdl
      .lookupFunction<
        Uint8 Function(
          Pointer<SdlGpuDevice> device,
          Uint8 waitAll,
          Pointer<Pointer<SdlGpuFence>> fences,
          Uint32 numFences,
        ),
        int Function(
          Pointer<SdlGpuDevice> device,
          int waitAll,
          Pointer<Pointer<SdlGpuFence>> fences,
          int numFences,
        )
      >('SDL_WaitForGPUFences');
  return sdlWaitForGpuFencesLookupFunction(
        device,
        waitAll ? 1 : 0,
        fences,
        numFences,
      ) ==
      1;
}