Index · Object → RefCounted → OpenXRAPIExtension

OpenXRAPIExtension

Makes the OpenXR API available for GDExtension.

Class Description

OpenXRAPIExtension makes OpenXR available for GDExtension. It provides the OpenXR API to GDExtension through the 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.

Methods

func action_get_handle(action: RID) -> int

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

func begin_debug_label_region(label_name: String) -> void

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.

func can_render() -> bool

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

func end_debug_label_region() -> void

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

func find_action(name: String, action_set: RID) -> RID

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

func get_error_string(result: int) -> String

Returns an error string for the given XrResult.

func get_hand_tracker(hand_index: int) -> int

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

func get_instance() -> int

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

func get_instance_proc_addr(name: String) -> int

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).

func get_next_frame_time() -> int

Returns the predicted display timing for the next frame.

func get_openxr_version() -> int

Returns the version of OpenXR that was initialized. Only valid after the OpenXR instance has been created. See XR_MAKE_VERSION for how the version is calculated.

func get_play_space() -> int

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

func get_predicted_display_time() -> int

Returns the predicted display timing for the current frame.

func get_projection_layer() -> int

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

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

func get_render_state_z_far() -> float

Returns the far boundary value of the camera frustum.

Note: This is only accessible in the render thread.

func get_render_state_z_near() -> float

Returns the near boundary value of the camera frustum.

Note: This is only accessible in the render thread.

func get_session() -> int

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

func get_supported_swapchain_formats() -> PackedInt64Array

Returns an array of supported swapchain formats.

func get_swapchain_format_name(swapchain_format: int) -> String

Returns the name of the specified swapchain format.

func get_system_id() -> int

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

func get_view_configuration() -> int

Returns the view configuration type, which is an XrViewConfigurationType cast to an integer.

func get_view_count() -> int

Returns the number of views. It is usually two, one for each eye, but may differ with different view configurations.

func insert_debug_label(label_name: String) -> void

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

func is_environment_blend_mode_alpha_supported() -> OpenXRAPIExtension.OpenXRAlphaBlendModeSupport

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

func is_initialized() -> bool

Returns true if OpenXR is initialized.

func is_running() -> bool

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

func openxr_is_enabled(check_run_in_editor: bool) -> bool

Returns true if OpenXR is enabled.

func openxr_swapchain_acquire(swapchain: int) -> void

Acquires the image of the provided swapchain.

func openxr_swapchain_create(create_flags: int, usage_flags: int, swapchain_format: int, width: int, height: int, sample_count: int, array_size: int) -> int

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

func openxr_swapchain_free(swapchain: int) -> void

Destroys the provided swapchain and frees it from memory.

func openxr_swapchain_get_image(swapchain: int) -> RID

Returns the RID of the provided swapchain's image.

func openxr_swapchain_get_swapchain(swapchain: int) -> int

Returns the XrSwapchain handle of the provided swapchain.

func openxr_swapchain_release(swapchain: int) -> void

Releases the image of the provided swapchain.

func register_composition_layer_provider(extension: OpenXRExtensionWrapper) -> void

Registers the given extension as a composition layer provider.

Note: This cannot be called after the OpenXR session has started. However, it can be called in OpenXRExtensionWrapper._on_session_created().

func register_frame_info_extension(extension: OpenXRExtensionWrapper) -> void

Registers the given extension as modifying frame info via the OpenXRExtensionWrapper._set_frame_wait_info_and_get_next_pointer(), OpenXRExtensionWrapper._set_view_locate_info_and_get_next_pointer(), or OpenXRExtensionWrapper._set_frame_end_info_and_get_next_pointer() virtual methods.

Note: This cannot be called after the OpenXR session has started. However, it can be called in OpenXRExtensionWrapper._on_session_created().

func register_projection_layer_extension(extension: OpenXRExtensionWrapper) -> void

Registers the given extension as modifying XrCompositionLayerProjection via the OpenXRExtensionWrapper._set_projection_layer_and_get_next_pointer() virtual method.

Note: This cannot be called after the OpenXR session has started. However, it can be called in OpenXRExtensionWrapper._on_session_created().

func register_projection_views_extension(extension: OpenXRExtensionWrapper) -> void

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

Note: This cannot be called after the OpenXR session has started. However, it can be called in OpenXRExtensionWrapper._on_session_created().

func set_custom_play_space(space: const void*) -> void

Sets the reference space used by OpenXR to the given XrSpace (cast to a void *).

func set_emulate_environment_blend_mode_alpha_blend(enabled: bool) -> void

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

func set_object_name(object_type: int, object_handle: int, object_name: String) -> void

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.

func set_render_region(render_region: Rect2i) -> void

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

func set_velocity_depth_texture(render_target: RID) -> void

Sets the render target of the velocity depth texture.

func set_velocity_target_size(target_size: Vector2i) -> void

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

func set_velocity_texture(render_target: RID) -> void

Sets the render target of the velocity texture.

func transform_from_pose(pose: const void*) -> Transform3D

Creates a Transform3D from an XrPosef.

func unregister_composition_layer_provider(extension: OpenXRExtensionWrapper) -> void

Unregisters the given extension as a composition layer provider.

Note: This cannot be called while the OpenXR session is still running.

func unregister_frame_info_extension(extension: OpenXRExtensionWrapper) -> void

Unregisters the given extension as modifying frame info.

Note: This cannot be called while the OpenXR session is still running.

func unregister_projection_layer_extension(extension: OpenXRExtensionWrapper) -> void

Unregisters the given extension as modifying XrCompositionLayerProjection.

Note: This cannot be called while the OpenXR session is still running.

func unregister_projection_views_extension(extension: OpenXRExtensionWrapper) -> void

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

Note: This cannot be called while the OpenXR session is still running.

func update_main_swapchain_size() -> void

Request the recommended resolution from the OpenXR runtime and update the main swapchain size if it has changed.

func xr_result(result: int, format: String, args: Array) -> bool

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.

Inherited from RefCounted (4)
func init_ref() -> bool
func reference() -> bool
func unreference() -> bool
Inherited from Object (62)
func _get(property: StringName) -> Variant
func _get_property_list() -> Dictionary[]
func _init() -> void
func _iter_get(iter: Variant) -> Variant
func _iter_init(iter: Array) -> bool
func _iter_next(iter: Array) -> bool
func _notification(what: int) -> void
func _set(property: StringName, value: Variant) -> bool
func _to_string() -> String
func _validate_property(property: Dictionary) -> void
func add_user_signal(signal: String, arguments: Array = []) -> void
func call(method: StringName) -> Variant
func callv(method: StringName, arg_array: Array) -> Variant
func cancel_free() -> void
func connect(signal: StringName, callable: Callable, flags: int = 0) -> Error
func disconnect(signal: StringName, callable: Callable) -> void
func emit_signal(signal: StringName) -> Error
func free() -> void
func get(property: StringName) -> Variant
func get_class() -> String
func get_incoming_connections() -> Dictionary[]
func get_indexed(property_path: NodePath) -> Variant
func get_meta(name: StringName, default: Variant = null) -> Variant
func get_meta_list() -> StringName[]
func get_method_list() -> Dictionary[]
func get_property_list() -> Dictionary[]
func get_signal_connection_list(signal: StringName) -> Dictionary[]
func get_signal_list() -> Dictionary[]
func has_meta(name: StringName) -> bool
func has_method(method: StringName) -> bool
func has_signal(signal: StringName) -> bool
func is_class(class: StringName) -> bool
func is_connected(signal: StringName, callable: Callable) -> bool
func notification(what: int, reversed: bool = false) -> void
func remove_meta(name: StringName) -> void
func remove_user_signal(signal: StringName) -> void
func set(property: StringName, value: Variant) -> void
func set_block_signals(enable: bool) -> void
func set_deferred(property: StringName, value: Variant) -> void
func set_indexed(property_path: NodePath, value: Variant) -> void
func set_message_translation(enable: bool) -> void
func set_meta(name: StringName, value: Variant) -> void
func set_script(script: Variant) -> void
func set_translation_domain(domain: StringName) -> void
func to_string() -> String
func tr(message: StringName, context: StringName = &"") -> String
func tr_n(message: StringName, plural_message: StringName, n: int, context: StringName = &"") -> String

Signals

Inherited from Object (2)

Enums & Constants

enum OpenXRAlphaBlendModeSupport
OPENXR_ALPHA_BLEND_MODE_SUPPORT_NONE = 0

Means that XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND isn't supported at all.

OPENXR_ALPHA_BLEND_MODE_SUPPORT_REAL = 1

Means that XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND is really supported.

OPENXR_ALPHA_BLEND_MODE_SUPPORT_EMULATING = 2

Means that XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND is emulated.