Home

XrInstance

XrInstance is the top-level handle in the OpenXR API that represents a connection between an application and an OpenXR runtime. An application creates an XrInstance by calling xrCreateInstance and later destroys it with xrDestroyInstance. The instance owns runtime configuration, available extensions, and validation layers used during the lifetime of the application’s OpenXR usage. A single application may create multiple instances, though typically one per process.

Creation and configuration are performed by supplying an XrInstanceCreateInfo structure. This includes applicationInfo, which identifies the

Instances expose runtime properties through calls such as xrGetInstanceProperties and xrEnumerateInstanceExtensionProperties. These allow an application to

XrSession creation depends on the chosen system and is performed with xrCreateSession. An application may create

Error handling during creation and usage covers common OpenXR error codes, such as initialization or availability

application
(name,
version)
and
the
engine
or
middleware
(name,
version);
enabledExtensionNames
to
opt
into
runtime
extensions;
and
enabledApiLayerNames
to
request
validation
or
other
API
layers.
The
runtime
may
refuse
creation
if
required
extensions
or
layers
are
unavailable,
or
if
the
system
does
not
support
OpenXR
in
the
current
context.
discover
the
runtime
name
and
version,
as
well
as
the
set
of
supported
extensions.
The
instance
is
also
used
to
obtain
an
XrSystemId
for
a
given
form
factor
via
xrGetSystem,
which
is
required
to
create
sessions.
and
manage
multiple
sessions
under
a
single
XrInstance.
The
instance
remains
valid
for
the
duration
of
the
application’s
OpenXR
usage
and
is
destroyed
after
all
sessions
are
ended
and
the
runtime
is
no
longer
needed.
failures.