Graphics Utilities
Optional graphics utility functionality. More...
Classes
Name | |
---|---|
struct | MLGraphicsImportedMediaSurface Handles to and information about an imported surface. |
struct | MLMeshingVirtualCameraBufferInfo Per virtual camera information needed to render depth. |
struct | MLMeshingDepthBufferInfo To be passed to PopulateDepth. |
Types
Name | |
---|---|
typedef struct MLGraphicsImportedMediaSurface | MLGraphicsImportedMediaSurface Handles to and information about an imported surface. |
typedef struct MLMeshingVirtualCameraBufferInfo | MLMeshingVirtualCameraBufferInfo Per virtual camera information needed to render depth. |
typedef struct MLMeshingDepthBufferInfo | MLMeshingDepthBufferInfo To be passed to PopulateDepth. |
Enums
Functions
Name | |
---|---|
MLResult | MLGraphicsEnumerateRequiredVkDeviceExtensionsForMediaHandleImport(VkExtensionProperties out_required_extension_properties, uint32_t out_extension_property_count) Returns a list of required VkDevice extension names. |
MLResult | MLGraphicsImportVkImageFromMediaHandle(const VkDevice vulkan_logical_device, uint64_t media_handle, MLGraphicsImportedMediaSurface * out_imported_surface_info) Import a surface as a VkImage from a media api handle. |
MLResult | MLMeshingPopulateDepth(MLHandle client_handle, const MLMeshingDepthBufferInfo info, const MLMeshingMesh meshes) Populates the depth buffer (passed as a Texture2D array) with the meshes given by a user. It has to be called after MLGraphicsBeginFrame which provides the handles for the depth/color buffers. |
Detailed Description
Optional graphics utility functionality.
EXPERIMENTAL.
Shared Object:
graphics_utils.magicleap*
The graphics utility library is not necessary to create an application using the ML SDK. It contains a collection of useful code that can optionally be used to make development easier.
Enums Documentation
MLMeshingPopulateDepthFlags
Enumerator | Value | Description |
---|---|---|
MLMeshingPopulateDepthFlags_None | None. | |
MLMeshingPopulateDepthFlags_EnableVisualization | If set, will fill the color buffer. | |
MLMeshingPopulateDepthFlags_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
Flags for MLMeshingDepthBufferInfo.
Deprecated since 1.2.0. Scheduled for removal.
Types Documentation
MLGraphicsImportedMediaSurface
typedef struct MLGraphicsImportedMediaSurface MLGraphicsImportedMediaSurface;
Handles to and information about an imported surface.
Populated by MLGraphicsImportVkImageFromMediaHandle. Provides all information, necessary for creating a VkImageView and VkSampler for the imported surface.
Refer to the Vulkan specification's equivalent parameters in VkAndroidHardwareBufferFormatPropertiesANDROID. Also refer to usage of VkExternalFormatANDROID and VkSamplerYcbcrConversionCreateInfo.
MLMeshingVirtualCameraBufferInfo
typedef struct MLMeshingVirtualCameraBufferInfo MLMeshingVirtualCameraBufferInfo;
Per virtual camera information needed to render depth.
Deprecated since 1.2.0. Scheduled for removal.
MLMeshingDepthBufferInfo
typedef struct MLMeshingDepthBufferInfo MLMeshingDepthBufferInfo;
To be passed to PopulateDepth.
Deprecated since 1.2.0. Scheduled for removal.
Functions Documentation
MLGraphicsEnumerateRequiredVkDeviceExtensionsForMediaHandleImport
MLResult MLGraphicsEnumerateRequiredVkDeviceExtensionsForMediaHandleImport(
VkExtensionProperties * out_required_extension_properties,
uint32_t * out_extension_property_count
)
Returns a list of required VkDevice extension names.
Parameters
VkExtensionProperties * | out_required_extension_properties | Either NULL or a pointer to an array of VkExtensionProperties. |
uint32_t * | out_extension_property_count | A pointer to an integer related to the number of extensions required or queried. |
Returns
MLResult | MLResult_InvalidParam | The query failed due to an invalid parameter. |
MLResult | MLResult_Ok | The list of extensions or number of required extensions was returned successfully. |
Required Permissions:
- None
If out_required_extension_properties is NULL then the number of required extension is returned in out_extension_property_count. Otherwise, out_extension_property_count must point to a variable set to the number of elements in the out_required_extension_properties array, and on return the variable is overwritten with the number of strings actually written to out_required_extension_properties.
MLGraphicsImportVkImageFromMediaHandle
MLResult MLGraphicsImportVkImageFromMediaHandle(
const VkDevice vulkan_logical_device,
uint64_t media_handle,
MLGraphicsImportedMediaSurface * out_imported_surface_info
)
Import a surface as a VkImage from a media api handle.
Parameters
const VkDevice | vulkan_logical_device | The Vulkan logical device to use for resource creation. |
uint64_t | media_handle | The media api handle referring to the surface to import. |
MLGraphicsImportedMediaSurface * | out_imported_surface_info | A struct containing the resulting resource handles and information for sampler creation. |
Returns
MLResult | MLResult_InvalidParam | Import was not performed due to an invalid parameter. |
MLResult | MLResult_Ok | Surface was imported successfully. |
MLResult | MLResult_UnspecifiedFailure | Import was not performed due to an unknown error. |
Required Permissions:
- None
Creates VkImage and VkDeviceMemory objects refrencing a surface referred to by a handle obtained from a media API. The resulting image will be owned by the VkDevice provided.This VkDevice must be created with the extensions specified by MLGraphicsEnumerateRequiredVkDeviceExtensionsForMediaHandleImport enabled. This call does not depend on a Graphics Client and can be used independent of other graphics APIs.
MLMeshingPopulateDepth
MLResult MLMeshingPopulateDepth(
MLHandle client_handle,
const MLMeshingDepthBufferInfo * info,
const MLMeshingMesh * meshes
)
Populates the depth buffer (passed as a Texture2D array) with the meshes given by a user. It has to be called after MLGraphicsBeginFrame which provides the handles for the depth/color buffers.
Parameters
MLHandle | client_handle | The handle to the created client. |
const MLMeshingDepthBufferInfo * | info | The per virtual camera info for rendering depth. |
const MLMeshingMesh * | meshes | The meshes for which the depth info needs to be populated. |
Returns
MLResult | MLResult_InvalidParam | Depth buffers were not populated due to an invalid parameter. |
MLResult | MLResult_Ok | Depth buffer was populated successfully. |
Required Permissions:
- None
Deprecated since 1.2.0. Scheduled for removal.