FrontBufferSyncStrategy

public final class FrontBufferSyncStrategy implements SyncStrategy


SyncStrategy implementation that optimizes for front buffered rendering use cases. More specifically this attempts to avoid unnecessary synchronization overhead wherever possible.

This will always provide a fence if the corresponding layer transitions from an invisible to a visible state. If the layer is already visible and front buffer usage flags are support on the device, then no fence is provided. If this flag is not supported, then a fence is created to ensure contents are flushed to the single buffer.

Summary

Public constructors

FrontBufferSyncStrategy(long usageFlags)

Public methods

SyncFenceCompat

Creates a SyncFenceCompat based on various conditions.

final boolean

Tells whether the corresponding front buffer layer is visible in its current state or not.

final void
setVisible(boolean isVisible)

Tells whether the corresponding front buffer layer is visible in its current state or not.

Public constructors

FrontBufferSyncStrategy

Added in 1.0.0-beta01
public FrontBufferSyncStrategy(long usageFlags)
Parameters
long usageFlags

usage flags that describe the HardwareBuffer that is used as the destination for rendering content within FrameBufferRenderer. The usage flags can be obtained via HardwareBuffer.getUsage or by passing in the same flags from HardwareBuffer.create

Public methods

createSyncFence

Added in 1.0.0-beta01
public SyncFenceCompat createSyncFence(@NonNull EGLSpec eglSpec)

Creates a SyncFenceCompat based on various conditions. If the layer is changing from invisible to visible, a fence is provided. If the layer is already visible and front buffer usage flag is supported on the device, then no fence is provided. If front buffer usage is not supported, then a fence is created and destroyed to flush contents to screen.

isVisible

Added in 1.0.0-beta01
public final boolean isVisible()

Tells whether the corresponding front buffer layer is visible in its current state or not. Utilize this to dictate when a SyncFenceCompat will be created when using createSyncFence.

setVisible

Added in 1.0.0-beta01
public final void setVisible(boolean isVisible)

Tells whether the corresponding front buffer layer is visible in its current state or not. Utilize this to dictate when a SyncFenceCompat will be created when using createSyncFence.