sdlxWaitForGpuFences function gpu

bool sdlxWaitForGpuFences(
  1. Pointer<SdlGpuDevice> device,
  2. List<Pointer<SdlGpuFence>> fences, {
  3. bool waitAll = true,
})

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)

See also:

Implementation

bool sdlxWaitForGpuFences(
  Pointer<SdlGpuDevice> device,
  List<Pointer<SdlGpuFence>> fences, {
  bool waitAll = true,
}) {
  bool result;
  final pointer = ffi.calloc<Pointer<SdlGpuFence>>(fences.length);
  for (var i = 0; i < fences.length; i++) {
    pointer[i] = fences[i];
  }
  result = sdlWaitForGpuFences(device, waitAll, pointer, fences.length);
  pointer.callocFree();
  return result;
}