Commit 15a97422 authored by Jakob Bornecrantz's avatar Jakob Bornecrantz

xrt: Add all of Monado

parent 618c73f2
CMakeCache.txt
CMakeLists.txt.user
*CMakeFiles/
*Makefile
*cmake_install.cmake
*libopenxr_monado.so
CMakeDoxyfile.in
CMakeDoxygenDefaults.cmake
doc/Doxyfile
doc/html/
doc/latex/
openxr_monado-dev.json
openxr_monado.json
src/xrt/compositor/shaders/*.vert.h
src/xrt/compositor/shaders/*.frag.h
# Copyright 2018-2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
cmake_minimum_required(VERSION 3.10.0)
project(XRT VERSION 0.1.0)
# CMake 3.11 introduced CMP0072 - Prefer GLVND
if(POLICY CMP0072)
cmake_policy(SET CMP0072 NEW)
endif()
option(BUILD_TESTS "Build compile and runtime tests" ON)
option(OPENXR_USE_LOADER "Application uses loader" ON)
###
# Dependencies
###
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(CMakeDependentOption)
include(SPIR-V)
find_package(Eigen3 REQUIRED)
find_package(Vulkan REQUIRED)
find_package(OpenGL)
find_package(HIDAPI)
# Push into a FindOpenHMD.cmake file.
find_package(PkgConfig)
pkg_check_modules(OPENHMD openhmd)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(X11)
find_package(Wayland)
pkg_check_modules(XCB xcb xcb-randr)
endif()
cmake_dependent_option(BUILD_WITH_OPENHMD "Enable OpenHMD driver" ON "OPENHMD_FOUND" OFF)
cmake_dependent_option(BUILD_WITH_WAYLAND "Enable Wayland support" ON "WAYLAND_FOUND" OFF)
cmake_dependent_option(BUILD_WITH_XLIB "Enable xlib support" ON "X11_FOUND" OFF)
cmake_dependent_option(BUILD_WITH_OPENGL "Enable OpenGL Graphics API support?" ON "OPENGL_FOUND" OFF)
###
# Flags
###
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter")
###
# Decend into madness.
###
add_subdirectory(src)
add_subdirectory(doc)
# Contribution Guidelines
There are plenty of valid reasons why someone might not be able
to follow all of the guidelines in this section, and that's OK,
especially for new contributors or those new to open source entirely.
Just let us know and we'll figure out a way to help you get involved successfully.
> Important note: Unlike the guidelines here, the Code of Conduct,
> available at <https://www.freedesktop.org/wiki/CodeOfConduct/>,
> is **not** optional,
> and applies in its entirety to anyone involved in the project,
> for the safety and comfort of all.
> See the README for associated contacts.
## Pull/Merge Requests
- If you're considering starting work on a large change that you'd like to contribute,
it is recommended to first open an issue before you start,
to begin a discussion and help smooth the acceptance of your contribution.
- If you are able, please make sure to run clang-format
(ideally version 7 or newer) before each commit,
so that you only commit things that are cleanly styled.
Consistent, machine-performed formatting improves readability and makes it easier for others to contribute.
It also makes it easier to review changes.
If you can't run clang-format, just mention this fact in your request and we'd be happy to help,
either in a single "Clean up formatting." commit on top of your work,
or by "re-writing history" (with your permission and leaving your commit authorship intact),
revising each commit to apply formatting.
- Avoid including whitespace or other formatting changes to unrelated code when committing.
The `git add -p` command or the "stage selected lines/hunks" feature of various Git GUIs are
great ways of making sure you only stage and commit the changes that you mean to.
Relatedly, `git commit -v` (if you commit from the command line) can be a great help
in making sure you aren't committing things you don't mean to,
by showing the diff you're committing in your commit message editor.
(This can even be set system-wide in `git config --global commit.verbose true`
if you find it as life-changing as many others have - thanks
[@emilyst](https://twitter.com/emilyst/status/1039205453010362368).)
- If you can, before submitting a pull/merge request, try building with clang-tidy enabled,
and if you touched any code that has or should have documentation,
build and check the documentation and see if it looks OK.
- We work to keep the code free of warnings -
please help by making sure your changes build cleanly (and pass all tests).
When on compilers that take warning flags like gcc and clang do,
the build system automatically turns on quite a few of them.
If a warning stumps you, just mention it in the request so we can figure it out together.
### Issues
Constructive issues are a valued form of contribution.
Please try to include any relevant information
(whether it is a request for improvement or a bug report).
We'll try to respond promptly,
but there is no guarantee or warranty (as noted in the license),
absent any externally-arranged consulting or support contract.
Since this is a runtime/implementation of an API used by other applications,
bug reports should include:
- details about your build environment
- architecture
- compiler
- compiler version
- build flags (defines, configuration/feature flags)
- associated application code
- for logic/execution errors, a new (failing) test case is ideal,
otherwise a description of expected and actual behavior
- if you cannot disclose your code, or even if you can,
an "artificial", minimally-sized example can be very valuable.
---
## Copyright and License for this CONTRIBUTING.md file
For this file only:
> Copyright 2018-2019 Collabora, Ltd.
>
> SPDX-License-Identifier: CC-BY-4.0
# Monado - XR Runtime (XRT)
Monado is an open source XR runtime delivering immersive experiences such as VR
and AR on on mobile, PC/desktop, and any other device
(because gosh darn people
come up with a lot of weird hardware).
Monado aims to be a complete and conforming implementation
of the OpenXR API made by Khronos.
The project currently is being developed for GNU/Linux
and aims to support other operating systems in the near future.
"Monado" has no specific meaning and is just a name.
## Monado source tree
* `src/xrt/include` - headers that define the internal interfaces of Monado.
* `src/xrt/compositor` - code for doing distortion and driving the display hardware of a device.
* `src/xrt/auxiliary` - utilies and other larger components.
* `src/xrt/drivers` - hardware drivers.
* `src/xrt/state_trackers/oxr` - OpenXR API implementation.
* `src/xrt/targets` - glue code and build logic to produce final binaries.
* `src/external` - a small collection of external code and headers.
## Getting Started
Dependencies include:
* [CMake][] 3.10 or newer
* [OpenHMD](https://openhmd.net) (found using pkg-config)
* Vulkan headers
* Eigen3
* glslang
Optional (but recommended) dependencies:
* OpenGL headers for OpenGL graphics support
* libxcb and xcb-xrandr development packages
Truly optional dependencies:
* Doxygen
* Wayland development packages
* Xlib development pages
* libhidapi (for the HDK driver)
Tested distributions that are fully compatible,
on Intel and AMD graphics:
* Ubuntu 18.10 (18.04 does not work)
* Debian 10 `buster`
(currently the "testing" release -
current stable Stretch does not have new enough packages)
These distributions include recent-enough versions of all the
software to use direct mode,
without using any external, third-party, or backported
package sources.
See also [Status of DRM leases](https://haagch.frickel.club/#!drmlease.md)
for more details on specific packages, versions, and commits.
Build process is similar to other CMake builds,
so something like the following will build it.
Go into the source directory, create a build directory,
and change into it.
mkdir build
cd build
Then, invoke [CMake to generate a project][cmake-generate].
Feel free to change the build type or generator ("Ninja" is fast and parallel) as you see fit.
cmake .. -DCMAKE_BUILD_TYPE=Debug -G "Unix Makefiles"
If you plan to install the runtime,
append something like `-DCMAKE_INSTALL_PREFIX=~/.local`
to specify the root of the install directory.
(The default install prefix is `/usr/local`.)
To build, [the generic CMake build commands][cmake-build] below will work on all systems,
though you can manually invoke your build tool (`make`, `ninja`, etc.) if you prefer.
The first command builds the runtime and docs,
and the second, which is optional, installs the runtime under `${CMAKE_INSTALL_PREFIX}`.
cmake --build .
cmake --build . --target install
Alternately, if using Make, the following will build the runtime and docs, then install.
Replace `make` with `ninja` if you used the Ninja generator.
make
make install
Documentation can be browsed by opening `docs/html/index.html` in the build directory in a web browser.
## Getting started using OpenXR with Monado
This implements the [OpenXR](https://khronos.org/openxr) API,
so to do anything with it, you'll need an application
that uses OpenXR, along with the OpenXR loader.
The OpenXR loader is a glue library that connects OpenXR applications to OpenXR runtimes such as Monado
It determines which runtime to use by reading config file default `/usr/local/share/openxr/0/active_runtime.json`
and processes environment variables such as `XR_RUNTIME_JSON=/usr/share/openxr/0/openxr_monado.json`.
It can also insert OpenXR API Layers without the application or the runtime having to do it.
You can use the `hello_xr` sample provided with the
OpenXR loader and API layers.
The OpenXR loader can be pointed to a runtime json file in a nonstandard location with the environment variable `XR_RUNTIME_JSON`. Example:
XR_RUNTIME_JSON=~/monado/build/xrt_oopenxr_monado_dev.json ./openxr-example
For this reason this runtime creates two manifest files within the build directory:
* `openxr_monado.json` uses a relative path to the runtime, and is intended to be installed with `make install`.
* `openxr_monado_dev.json` uses an absolute path to the runtime in its build directory,
and is intended to be used for development without installing the runtime.
If Monado has been installed through a distribution package
and provides the "active runtime" file /usr/local/share/openxr/0/active_runtime.json,
then the loader will automatically use Monado when starting any OpenXR application.
If Monado has been compiled in a custom directory like ~/monado/build,
the OpenXR loader can be pointed to the runtime when starting an OpenXR application
by setting the environment variable XR_RUNTIME_JSON to the `openxr_monado_dev.json` manifest
that was generated by the build: see above.
Note that the loader can always find and load the runtime
if the path to the runtime library given in the json manifest is an absolute path,
but if a relative path like `libopenxr_monado.so.0` is given,
then `LD_LIBRARY_PATH` must include the directory that contains `libopenxr_monado.so.0`.
The absolute path in `openxr_monado_dev.json` takes care of this for you.
## Direct mode
Our direct mode code requires a connected HMD to have the `non-desktop` xrandr
property set to 1.
Only the most common HMDs have the needed quirks added to the linux kernel.
Just keep on reading for more info on how to work around that.
If you know that your HMD lacks the quirk you can run this command **before** or
after connecting the HMD and it will have it. Where `HDMI-A-0` is the xrandr
output name where you plug the HMD in.
```bash
xrandr --output HDMI-A-0 --prop --set non-desktop 1
```
You can verify that it stuck with the command.
```bash
xrand --prop
```
## Coding style and formatting
[clang-format][] is used,
and a `.clang-format` config file is present in the repo
to allow your editor to use them.
To manually apply clang-format to every non-external source file in the tree,
run this command in the source dir with a `sh`-compatible shell
(Git for Windows git-bash should be OK):
scripts/format-project.sh
You can optionally put something like `CLANG_FORMAT=clang-format-7` before that command
if your clang-format binary isn't named `clang-format`.
Note that you'll typically prefer to use something like `git clang-format`
to just re-format your changes, in case version differences in tools result in overall format changes.
[clang-format]: https://releases.llvm.org/7.0.0/tools/clang/docs/ClangFormat.html
[cmake-build]: https://cmake.org/cmake/help/v3.12/manual/cmake.1.html#build-tool-mode
[cmake-generate]: https://cmake.org/cmake/help/v3.12/manual/cmake.1.html
[CMake]: https://cmake.org
## Contributing, Code of Conduct
See `CONTRIBUTING.md` for details of contribution guidelines.
Please note that this project is released with a Contributor Code of Conduct.
By participating in this project you agree to abide by its terms.
We follow the standard freedesktop.org code of conduct,
available at <https://www.freedesktop.org/wiki/CodeOfConduct/>,
which is based on the [Contributor Covenant](https://www.contributor-covenant.org).
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting:
* First-line project contacts:
* Jakob Bornecrantz <jakob@collabora.com>
* Ryan Pavlik <ryan.pavlik@collabora.com>
* freedesktop.org contacts: see most recent list at <https://www.freedesktop.org/wiki/CodeOfConduct/>
## Copyright and License for this README.md file
For this file only:
> Copyright 2018-2019 Collabora, Ltd.
> Code of Conduct section: excerpt adapted from the [Contributor Covenant][https://www.contributor-covenant.org], version 1.4.1,
> available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>,
> and from the freedesktop.org-specific version of that code,
> available at <https://www.freedesktop.org/wiki/CodeOfConduct/>
>
>
> SPDX-License-Identifier: CC-BY-4.0
# - try to find HIDAPI library
# from http://www.signal11.us/oss/hidapi/
#
# Cache Variables: (probably not for direct use in your scripts)
# HIDAPI_INCLUDE_DIR
# HIDAPI_LIBRARY
#
# Non-cache variables you might use in your CMakeLists.txt:
# HIDAPI_FOUND
# HIDAPI_INCLUDE_DIRS
# HIDAPI_LIBRARIES
#
# Requires these CMake modules:
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
find_library(HIDAPI_LIBRARY
NAMES hidapi hidapi-libusb)
find_path(HIDAPI_INCLUDE_DIR
NAMES hidapi.h
PATH_SUFFIXES
hidapi)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HIDAPI
DEFAULT_MSG
HIDAPI_LIBRARY
HIDAPI_INCLUDE_DIR)
if(HIDAPI_FOUND)
set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARY}")
set(HIDAPI_INCLUDE_DIRS "${HIDAPI_INCLUDE_DIR}")
endif()
mark_as_advanced(HIDAPI_INCLUDE_DIR HIDAPI_LIBRARY)
# Try to find Wayland on a Unix system
#
# This will define:
#
# WAYLAND_FOUND - True if Wayland is found
# WAYLAND_LIBRARIES - Link these to use Wayland
# WAYLAND_INCLUDE_DIR - Include directory for Wayland
# WAYLAND_DEFINITIONS - Compiler flags for using Wayland
#
# In addition the following more fine grained variables will be defined:
#
# WAYLAND_CLIENT_FOUND WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES
# WAYLAND_SERVER_FOUND WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES
# WAYLAND_EGL_FOUND WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES
#
# Copyright (c) 2013 Martin Gräßlin <mgraesslin@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
IF (NOT WIN32)
IF (WAYLAND_INCLUDE_DIR AND WAYLAND_LIBRARIES)
# In the cache already
SET(WAYLAND_FIND_QUIETLY TRUE)
ENDIF ()
# Use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PKG_WAYLAND QUIET wayland-client wayland-server wayland-egl wayland-cursor)
SET(WAYLAND_DEFINITIONS ${PKG_WAYLAND_CFLAGS})
FIND_PATH(WAYLAND_CLIENT_INCLUDE_DIR NAMES wayland-client.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
FIND_PATH(WAYLAND_SERVER_INCLUDE_DIR NAMES wayland-server.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
FIND_PATH(WAYLAND_EGL_INCLUDE_DIR NAMES wayland-egl.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
FIND_PATH(WAYLAND_CURSOR_INCLUDE_DIR NAMES wayland-cursor.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
FIND_LIBRARY(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
FIND_LIBRARY(WAYLAND_SERVER_LIBRARIES NAMES wayland-server HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
FIND_LIBRARY(WAYLAND_EGL_LIBRARIES NAMES wayland-egl HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
FIND_LIBRARY(WAYLAND_CURSOR_LIBRARIES NAMES wayland-cursor HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
set(WAYLAND_INCLUDE_DIR ${WAYLAND_CLIENT_INCLUDE_DIR} ${WAYLAND_SERVER_INCLUDE_DIR} ${WAYLAND_EGL_INCLUDE_DIR} ${WAYLAND_CURSOR_INCLUDE_DIR})
set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES} ${WAYLAND_CURSOR_LIBRARIES})
list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CLIENT DEFAULT_MSG WAYLAND_CLIENT_LIBRARIES WAYLAND_CLIENT_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_SERVER DEFAULT_MSG WAYLAND_SERVER_LIBRARIES WAYLAND_SERVER_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_EGL DEFAULT_MSG WAYLAND_EGL_LIBRARIES WAYLAND_EGL_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CURSOR DEFAULT_MSG WAYLAND_CURSOR_LIBRARIES WAYLAND_CURSOR_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND DEFAULT_MSG WAYLAND_LIBRARIES WAYLAND_INCLUDE_DIR)
MARK_AS_ADVANCED(
WAYLAND_INCLUDE_DIR WAYLAND_LIBRARIES
WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES
WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES
WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES
WAYLAND_CURSOR_INCLUDE_DIR WAYLAND_CURSOR_LIBRARIES
)
ENDIF ()
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
find_program(GLSLANGVALIDATOR_COMMAND
glslangValidator)
if(NOT GLSLANGVALIDATOR_COMMAND)
message(FATAL_ERROR "glslangValidator required - source maintained at https://github.com/KhronosGroup/glslang")
endif()
#
# Generate a SPIR-V header file, with the given var name. Returns the header.
#
function(spirv_shader ret GLSL VAR)
set(HEADER "${CMAKE_CURRENT_BINARY_DIR}/${GLSL}.h")
set(GLSL "${CMAKE_CURRENT_SOURCE_DIR}/${GLSL}")
add_custom_command(
OUTPUT ${HEADER}
COMMAND ${GLSLANGVALIDATOR_COMMAND} -V ${GLSL} --vn ${VAR} -o ${HEADER}
DEPENDS ${GLSL})
set(${ret} "${HEADER}" PARENT_SCOPE)
endfunction(spirv_shader)
#
# Generate SPIR-V header files from the arguments. Returns a list of headers.
#
function(spirv_shaders ret)
foreach(GLSL ${ARGN})
string(MAKE_C_IDENTIFIER ${GLSL} IDENTIFIER)
spirv_shader(HEADER ${GLSL} ${IDENTIFIER})
list(APPEND HEADERS ${HEADER})
endforeach()
set(${ret} "${HEADERS}" PARENT_SCOPE)
endfunction(spirv_shaders)
# Copyright 2018-2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
# check if Doxygen is installed
find_package(Doxygen)
cmake_dependent_option(BUILD_DOC "Build documentation" ON "DOXYGEN_FOUND" OFF)
cmake_dependent_option(BUILD_DOC_WARN_UNDOCUMENTED "Warn on undocumented entities when building documentation" OFF "DOXYGEN_FOUND" OFF)
cmake_dependent_option(BUILD_DOC_EXTRACT_ALL "Extract all entities for documentation, not just documented ones (conflicts with BUILD_DOCS_WARN_UNDOCUMENTED)" ON "DOXYGEN_FOUND; NOT BUILD_DOCS_WARN_UNDOCUMENTED" OFF)
if(BUILD_DOC)
if(BUILD_DOC_WARN_UNDOCUMENTED)
set(DOXYGEN_WARN_UNDOCUMENTED YES)
else()
set(DOXYGEN_WARN_UNDOCUMENTED NO)
endif()
if(BUILD_DOC_EXTRACT_ALL)
set(DOXYGEN_EXTRACT_ALL YES)
else()
set(DOXYGEN_EXTRACT_ALL NO)
endif()
# set input and output files
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
# request to configure the file
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
# note the option ALL which allows to build the docs together with the application
add_custom_target(doc_doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM
)
endif()
This source diff could not be displayed because it is too large. You can view the blob instead.
# Roadmap
## Short term
* **aux/util**: Add mutex and threading wrappers.
* **aux/math**: Add kalman filter math black box.
* **aux/log**: Add a common logging framework that can be used to pipe messages
up into **st/oxr** from things like drivers and the compositor.
* **aux/log**: Make it possible to batch up longer messages into a single call,
useful for printing the entire mode list in a single go.
* **cmake**: Make a proper FindXCB.cmake file.
* **comp**: Do timing based of the display refresh-rate and display time.
* **comp**: Extend to support rotated views/displays. Should we just rotate the
display for the 3Glasses or make it a per-view thing?
* **comp**: See-through support for Vive headset.
* **st/oxr**: Locking, maybe we just have a single lock for the session.
We will need to figure out how to do wait properly.
* **st/oxr**: Make wait frame actually wait for the display time.
* **st/oxr**: Improve space functions.
* **st/oxr**: Add path functions.
* **st/oxr**: Add just enough of the action functions to not return errors.
## Long term
* **aux/beacon**: Complete and integrate Lighthouse tracking code.
* **comp**: Moving the compositor into it's own process.
* **comp**: Support quads layers.
* **comp**: Support other extensions layers.
* **doc**: Group Related code.
* **doc**: Lots of documentation for runtime.
* **drivers**: Port rest of OpenHMD drivers to our runtime.
* **st/oxr**: Complete action functions.
* **progs**: Settings and management daemon.
* **progs**: Systray status indicator for user to interact with daemon.
* **progs**: Room-scale setup program.
#!/bin/bash
# Copyright 2018-2019, Collabora, Ltd.
# Copyright 2016, Sensics, Inc.
# SPDX-License-Identifier: Apache-2.0
if [ ! "$CLANG_FORMAT" ]; then
for exe in clang-format-8 clang-format-7 clang-format-6.0 clang-format; do
if which $exe >/dev/null 2>&1; then
CLANG_FORMAT=$exe
break
fi
done
fi
if [ ! "$CLANG_FORMAT" ]; then
echo "Can't find clang-format - please set CLANG_FORMAT to a command or path" >&2
exit 1
fi
runClangFormatOnDir() {
find "$1" \( -name "*.c" -o -name "*.cpp" -o -name "*.h" \)| \
grep -v "\.boilerplate" | \
xargs ${CLANG_FORMAT} -style=file -i
}
(
cd $(dirname $0)/../src/xrt
runClangFormatOnDir .
)
# Copyright 2019, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
add_subdirectory(xrt)
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
// Copyright (c) 2017 The Khronos Group Inc.
// Copyright (c) 2017 Valve Corporation
// Copyright (c) 2017 LunarG, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Author: Mark Young <marky@lunarg.com>
//
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
// Forward declare.
typedef struct XrApiLayerCreateInfo XrApiLayerCreateInfo;
// Function pointer prototype for the xrCreateApiLayerInstance function used in place of xrCreateInstance.
// This function allows us to pass special API layer information to each layer during the process of creating an Instance.
typedef XrResult(XRAPI_PTR *PFN_xrCreateApiLayerInstance)(const XrInstanceCreateInfo *info,
const XrApiLayerCreateInfo *apiLayerInfo, XrInstance *instance);
// Loader/API Layer Interface versions
// 1 - First version, introduces negotiation structure and functions
#define XR_CURRENT_LOADER_API_LAYER_VERSION 1
// Loader/Runtime Interface versions
// 1 - First version, introduces negotiation structure and functions
#define XR_CURRENT_LOADER_RUNTIME_VERSION 1
// Version negotiation values
typedef enum XrLoaderInterfaceStructs {
XR_LOADER_INTERFACE_STRUCT_UNINTIALIZED = 0,
XR_LOADER_INTERFACE_STRUCT_LOADER_INFO,
XR_LOADER_INTERFACE_STRUCT_API_LAYER_REQUEST,
XR_LOADER_INTERFACE_STRUCT_RUNTIME_REQUEST,
XR_LOADER_INTERFACE_STRUCT_API_LAYER_CREATE_INFO,
XR_LOADER_INTERFACE_STRUCT_API_LAYER_NEXT_INFO,
} XrLoaderInterfaceStructs;
#define XR_LOADER_INFO_STRUCT_VERSION 1
typedef struct XrNegotiateLoaderInfo {
XrLoaderInterfaceStructs structType; // XR_LOADER_INTERFACE_STRUCT_LOADER_INFO
uint32_t structVersion; // XR_LOADER_INFO_STRUCT_VERSION
size_t structSize; // sizeof(XrNegotiateLoaderInfo)
uint32_t minInterfaceVersion;
uint32_t maxInterfaceVersion;
uint32_t minXrVersion;
uint32_t maxXrVersion;
} XrNegotiateLoaderInfo;
#define XR_API_LAYER_INFO_STRUCT_VERSION 1
typedef struct XrNegotiateApiLayerRequest {
XrLoaderInterfaceStructs structType; // XR_LOADER_INTERFACE_STRUCT_API_LAYER_REQUEST
uint32_t structVersion; // XR_API_LAYER_INFO_STRUCT_VERSION
size_t structSize; // sizeof(XrNegotiateApiLayerRequest)
uint32_t layerInterfaceVersion; // CURRENT_LOADER_API_LAYER_VERSION
uint32_t layerXrVersion;
PFN_xrGetInstanceProcAddr getInstanceProcAddr;
PFN_xrCreateApiLayerInstance createApiLayerInstance;
} XrNegotiateApiLayerRequest;
#define XR_RUNTIME_INFO_STRUCT_VERSION 1
typedef struct XrNegotiateRuntimeRequest {
XrLoaderInterfaceStructs structType; // XR_LOADER_INTERFACE_STRUCT_RUNTIME_REQUEST
uint32_t structVersion; // XR_RUNTIME_INFO_STRUCT_VERSION
size_t structSize; // sizeof(XrNegotiateRuntimeRequest)
uint32_t runtimeInterfaceVersion; // CURRENT_LOADER_RUNTIME_VERSION