Skip to main content
Version: 20 Mar 2024

NativeBindings

Public Methods

delegate void AcquireNextAvailableBufferDelegate

Delegate signature for the callback invoked by the native rendering plugin, requesting a new native buffer handle.

public delegate void AcquireNextAvailableBufferDelegate(
ref bool success,
ref ulong nativeBufferHandle,
IntPtr context
)

Parameters

TypeNameDescription
ref boolsuccessWhether a new native buffer handle was acquired
ref ulongnativeBufferHandleAcquired native buffer handle
IntPtrcontextUser context passed during instance creation

delegate void AcquireNextAvailableHwBufferDelegate

Delegate signature for the callback invoked by the native rendering plugin, requesting a new AHardwareBuffer.

public delegate void AcquireNextAvailableHwBufferDelegate(
ref bool success,
ref IntPtr hwBuffer,
IntPtr context
)

Parameters

TypeNameDescription
ref boolsuccessWhether a new native buffer handle was acquired
ref IntPtrhwBufferAcquired native buffer handle
IntPtrcontextUser context passed during instance creation

delegate void GetFrameTransformMatrixDelegate

Delegate signature for the callback invoked by the native rendering plugin, requesting the frame transform matrix for the last acquired native buffer handle.

public delegate void GetFrameTransformMatrixDelegate(
ref bool success,
ref Native.MagicLeapNativeBindings.MLMat4f frameMat,
IntPtr context
)

Parameters

TypeNameDescription
ref boolsuccessWhether a valid frame transform matrix was provided
ref Native.MagicLeapNativeBindings.MLMat4fframeMatFrame transform matrix
IntPtrcontextUser context passed during instance creation

delegate void IsNewFrameAvailableDelegate

public delegate void IsNewFrameAvailableDelegate(
ref bool success,
IntPtr context
)

Parameters

TypeNameDescription
ref boolsuccess
IntPtrcontext

MLResult.Code MLYcbcrRendererCreate

Create an instance of the YcbcrRenderer.

public MLResult.Code MLYcbcrRendererCreate(
ref CreateInfo createInfo,
out ulong handle
)

Parameters

TypeNameDescription
ref CreateInfocreateInfoInfo used to create the instance
out ulonghandleHandle to the instance

Returns: MLResult.Code.Ok if instance was created successfully.

MLResult.Code.InvalidParam if one of params was null.

MLResult.Code.MediaGenericNoInit if func was called before Unity graphics was initialized.


IntPtr MLYcbcrRendererGetCallbackForPluginEvent

Get the callback function pointer to be used in CommandBuffer.IssuePluginEvent() for a given rendering plugin event.

public IntPtr MLYcbcrRendererGetCallbackForPluginEvent(
PluginEvent pluginEvent
)

Parameters

TypeNameDescription
PluginEventpluginEventRendering plugin event to get the callback function pointer for

Returns: Callback function pointer


int MLYcbcrRendererGetEventIdForPluginEvent

Get the event id to be used in CommandBuffer.IssuePluginEvent() for a given rendering plugin event.

public int MLYcbcrRendererGetEventIdForPluginEvent(
PluginEvent pluginEvent
)

Parameters

TypeNameDescription
PluginEventpluginEventRendering plugin event to get the id for

Returns: Event Id


delegate void OnCleanupCompleteDelegate

public delegate void OnCleanupCompleteDelegate(
IntPtr context
)

Parameters

TypeNameDescription
IntPtrcontext

delegate void OnFirstFrameRenderedDelegate

public delegate void OnFirstFrameRenderedDelegate(
IntPtr context
)

Parameters

TypeNameDescription
IntPtrcontext

delegate void OverrideYcbcrConversionSamplerDelegate

public delegate void OverrideYcbcrConversionSamplerDelegate(
ref VkAndroidHardwareBufferFormatPropertiesANDROID hwBufferFormatProperties,
ref bool samplerChanged,
ref VkSamplerYcbcrConversionCreateInfo sampler,
IntPtr context
)

Parameters

TypeNameDescription
ref VkAndroidHardwareBufferFormatPropertiesANDROIDhwBufferFormatProperties
ref boolsamplerChanged
ref VkSamplerYcbcrConversionCreateInfosampler
IntPtrcontext

delegate void ReleaseBufferDelegate

Delegate signature for the callback invoked by the native rendering plugin, requesting the given native buffer to be released.

public delegate void ReleaseBufferDelegate(
ulong nativeBufferHandle,
IntPtr context
)

Parameters

TypeNameDescription
ulongnativeBufferHandleNative buffer handle to be released
IntPtrcontextUser context passed during instance creation

delegate void ReleaseHwBufferDelegate

Delegate signature for the callback invoked by the native rendering plugin, requesting the given AHardwareBuffer to be released.

public delegate void ReleaseHwBufferDelegate(
IntPtr hwBuffer,
IntPtr context
)

Parameters

TypeNameDescription
IntPtrnativeBufferHandleNative buffer handle to be released
IntPtrcontextUser context passed during instance creation

Public Enums

ColorSpace

Color spaces supported by the native rendering plugin

EnumeratorValueDescription
Linear
Gamma

PluginEvent

Plugin events supported by the native rendering plugin

EnumeratorValueDescription
SetTexturePass a unity texture and its width, height to the native rendering plugin
DrawDraw the latest native buffer onto the unity texture
CleanupDestroy all resources and the renderer instance
AccessTexture