Table of Contents

Class OpenXRAPIExtension

Makes the OpenXR API available for GDExtension.

Inheritance
OpenXRAPIExtension

Remarks

OpenXRAPIExtension makes OpenXR available for GDExtension. It provides the OpenXR API to GDExtension through the OpenXRAPIExtension.get_instance_proc_addr method, and the OpenXR instance through get_instance.

It also provides methods for querying the status of OpenXR initialization, and helper methods for ease of use of the API with GDExtension.

See Also

Methods

action_get_handle(RID)

Returns the corresponding XrAction OpenXR handle for the given action RID.

int action_get_handle(RID action)

Parameters

action RID

begin_debug_label_region(String)

Begins a new debug label region, this label will be reported in debug messages for any calls following this until end_debug_label_region is called. Debug labels can be stacked.

void begin_debug_label_region(String label_name)

Parameters

label_name String

can_render

Returns true if OpenXR is initialized for rendering with an XR viewport.

bool can_render

end_debug_label_region

Marks the end of a debug label region. Removes the latest debug label region added by calling OpenXRAPIExtension.begin_debug_label_region.

void end_debug_label_region

find_action(String, RID)

Returns the RID corresponding to an Action of a matching name, optionally limited to a specified action set.

RID find_action(String name, RID action_set)

Parameters

name String
action_set RID

get_error_string(int)

Returns an error string for the given XrResult.

String get_error_string(int result)

Parameters

result int

get_hand_tracker(int)

Returns the corresponding XRHandTrackerEXT handle for the given hand index value.

int get_hand_tracker(int hand_index)

Parameters

hand_index int

get_instance

Returns the XrInstance created during the initialization of the OpenXR API.

int get_instance

get_instance_proc_addr(String)

Returns the function pointer of the OpenXR function with the specified name, cast to an integer. If the function with the given name does not exist, the method returns 0.

Note: openxr/util.h contains utility macros for acquiring OpenXR functions, e.g. GDEXTENSION_INIT_XR_FUNC_V(xrCreateAction).

int get_instance_proc_addr(String name)

Parameters

name String

get_next_frame_time

Returns the predicted display timing for the next frame.

int get_next_frame_time

get_play_space

Returns the play space, which is an XrSpace cast to an integer.

int get_play_space

get_predicted_display_time

Returns the predicted display timing for the current frame.

int get_predicted_display_time

get_projection_layer

Returns a pointer to the render state's XrCompositionLayerProjection struct.

Note: This method should only be called from the rendering thread.

int get_projection_layer

get_render_state_z_far

Returns the far boundary value of the camera frustum.

Note: This is only accessible in the render thread.

float get_render_state_z_far

get_render_state_z_near

Returns the near boundary value of the camera frustum.

Note: This is only accessible in the render thread.

float get_render_state_z_near

get_session

Returns the OpenXR session, which is an XrSession cast to an integer.

int get_session

get_supported_swapchain_formats

Returns an array of supported swapchain formats.

PackedInt64Array get_supported_swapchain_formats

get_swapchain_format_name(int)

Returns the name of the specified swapchain format.

String get_swapchain_format_name(int swapchain_format)

Parameters

swapchain_format int

get_system_id

Returns the id of the system, which is a XrSystemId cast to an integer.

int get_system_id

insert_debug_label(String)

Inserts a debug label, this label is reported in any debug message resulting from the OpenXR calls that follows, until any of OpenXRAPIExtension.begin_debug_label_region, end_debug_label_region, or OpenXRAPIExtension.insert_debug_label is called.

void insert_debug_label(String label_name)

Parameters

label_name String

is_environment_blend_mode_alpha_supported

Returns OpenXRAlphaBlendModeSupport denoting if XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND is really supported, emulated or not supported at all.

int is_environment_blend_mode_alpha_supported

is_initialized

Returns true if OpenXR is initialized.

bool is_initialized

is_running

Returns true if OpenXR is running (xrBeginSession was successfully called and the swapchains were created).

bool is_running

openxr_is_enabled(bool)

Qualifiers: static

Returns true if OpenXR is enabled.

bool openxr_is_enabled(bool check_run_in_editor)

Parameters

check_run_in_editor bool

openxr_swapchain_acquire(int)

Acquires the image of the provided swapchain.

void openxr_swapchain_acquire(int swapchain)

Parameters

swapchain int

openxr_swapchain_create(int, int, int, int, int, int, int)

Returns a pointer to a new swapchain created using the provided parameters.

int openxr_swapchain_create(int create_flags, int usage_flags, int swapchain_format, int width, int height, int sample_count, int array_size)

Parameters

create_flags int
usage_flags int
swapchain_format int
width int
height int
sample_count int
array_size int

openxr_swapchain_free(int)

Destroys the provided swapchain and frees it from memory.

void openxr_swapchain_free(int swapchain)

Parameters

swapchain int

openxr_swapchain_get_image(int)

Returns the RID of the provided swapchain's image.

RID openxr_swapchain_get_image(int swapchain)

Parameters

swapchain int

openxr_swapchain_get_swapchain(int)

Returns the XrSwapchain handle of the provided swapchain.

int openxr_swapchain_get_swapchain(int swapchain)

Parameters

swapchain int

openxr_swapchain_release(int)

Releases the image of the provided swapchain.

void openxr_swapchain_release(int swapchain)

Parameters

swapchain int

register_composition_layer_provider(OpenXRExtensionWrapperExtension)

Registers the given extension as a composition layer provider.

void register_composition_layer_provider(OpenXRExtensionWrapperExtension extension)

Parameters

extension OpenXRExtensionWrapperExtension

register_projection_views_extension(OpenXRExtensionWrapperExtension)

Registers the given extension as a provider of additional data structures to projections views.

void register_projection_views_extension(OpenXRExtensionWrapperExtension extension)

Parameters

extension OpenXRExtensionWrapperExtension

set_emulate_environment_blend_mode_alpha_blend(bool)

If set to true, an OpenXR extension is loaded which is capable of emulating the XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND blend mode.

void set_emulate_environment_blend_mode_alpha_blend(bool enabled)

Parameters

enabled bool

set_object_name(int, int, String)

Set the object name of an OpenXR object, used for debug output. object_type must be a valid OpenXR XrObjectType enum and object_handle must be a valid OpenXR object handle.

void set_object_name(int object_type, int object_handle, String object_name)

Parameters

object_type int
object_handle int
object_name String

set_render_region(Rect2i)

Sets the render region to render_region, overriding the normal render target's rect.

void set_render_region(Rect2i render_region)

Parameters

render_region Rect2i

set_velocity_depth_texture(RID)

Sets the render target of the velocity depth texture.

void set_velocity_depth_texture(RID render_target)

Parameters

render_target RID

set_velocity_target_size(Vector2i)

Sets the target size of the velocity and velocity depth textures.

void set_velocity_target_size(Vector2i target_size)

Parameters

target_size Vector2i

set_velocity_texture(RID)

Sets the render target of the velocity texture.

void set_velocity_texture(RID render_target)

Parameters

render_target RID

transform_from_pose(const void*)

Creates a Transform3D from an XrPosef.

Transform3D transform_from_pose(const void* pose)

Parameters

pose const void*

unregister_composition_layer_provider(OpenXRExtensionWrapperExtension)

Unregisters the given extension as a composition layer provider.

void unregister_composition_layer_provider(OpenXRExtensionWrapperExtension extension)

Parameters

extension OpenXRExtensionWrapperExtension

unregister_projection_views_extension(OpenXRExtensionWrapperExtension)

Unregisters the given extension as a provider of additional data structures to projections views.

void unregister_projection_views_extension(OpenXRExtensionWrapperExtension extension)

Parameters

extension OpenXRExtensionWrapperExtension

xr_result(int, String, Array)

Returns true if the provided XrResult (cast to an integer) is successful. Otherwise returns false and prints the XrResult converted to a string, with the specified additional information.

bool xr_result(int result, String format, Array args)

Parameters

result int
format String
args Array