Back to Filament

setupFrame

docs/android/dokka/filament-android/com.google.android.filament.android/-frame-pacer/setup-frame.md

1.75.02.6 KB
Original Source

//filament-android/com.google.android.filament.android/FramePacer/setupFrame

setupFrame

[main]
open fun setupFrame(frameTimeNanos: Long, vsyncPeriodNanos: Long): FramePacer.FrameStatus

Prepares and evaluates the frame pacing state for the upcoming frame cycle.

This must be called at the very beginning of the host display platform's VSYNC interrupt loop (e.g., within Android's Choreographer callback). It evaluates whether the CPU rendering thread is ahead of the hardware pulse cadence or backlogged.

Return

FrameStatus::ACCEPTED if approved, or the specific SKIPPED reason.

Parameters

main

frameTimeNanosIncoming hardware base VSYNC timestamp in nanoseconds.
vsyncPeriodNanosPhysical display VSYNC refresh period in nanoseconds.

[main]
open fun setupFrame(frameTimeNanos: Long): FramePacer.FrameStatus

Prepares and evaluates the frame pacing state for the upcoming frame cycle.

This must be called at the very beginning of the host display platform's VSYNC interrupt loop (e.g., within Android's Choreographer callback). It evaluates whether the CPU rendering thread is ahead of the hardware pulse cadence or backlogged.

Return

FrameStatus::ACCEPTED if approved, or the specific SKIPPED reason.

Parameters

main

frameTimeNanosIncoming hardware base VSYNC timestamp in nanoseconds.

[main]
open fun setupFrame(frameData: FrameData, vsyncPeriodNanos: Long): FramePacer.FrameStatus

Prepares and evaluates the frame pacing state for the upcoming frame cycle using Android 13+ FrameData.

This must be called at the very beginning of the host display platform's VSYNC interrupt loop (e.g., within Android's Choreographer callback). It evaluates whether the CPU rendering thread is ahead of the hardware pulse cadence or backlogged.

Return

FrameStatus::ACCEPTED if approved, or the specific SKIPPED reason.

Parameters

main

frameDataNative VSYNC telemetry object received in an Android 13+ Choreographer.VsyncCallback.
vsyncPeriodNanosPhysical display VSYNC refresh period in nanoseconds.