GPUSyncFence


@ExperimentalWebGpuApi
class GPUSyncFence : AutoCloseable


A unified abstraction for fence synchronization in WebGPU

This class is backed by a ParcelFileDescriptor representing a sync fence.

Summary

Public companion functions

GPUSyncFence
@RequiresApi(value = 33)
fromSyncFence(syncFence: SyncFence)

Creates a GPUSyncFence from a platform SyncFence by extracting its file descriptor.

Public functions

Boolean
await(timeoutMillis: Long)

Waits for the fence to signal.

open Unit

Extension functions

SyncFence?

Converts to an Android platform SyncFence.

Public companion functions

fromSyncFence

Added in 1.0.0-alpha06
@RequiresApi(value = 33)
fun fromSyncFence(syncFence: SyncFence): GPUSyncFence

Creates a GPUSyncFence from a platform SyncFence by extracting its file descriptor.

Public functions

await

Added in 1.0.0-alpha06
fun await(timeoutMillis: Long): Boolean

Waits for the fence to signal.

close

Added in 1.0.0-alpha06
open fun close(): Unit

Extension functions

GPUSyncFence.toSyncFence

@ExperimentalWebGpuApi
fun GPUSyncFence?.toSyncFence(): SyncFence?

Converts to an Android platform SyncFence.

Safely handles API level compatibility internally. On devices below Android T (API 33), this function will safely return null without requiring API version checks at the call site.