README.md 3.44 KB
Newer Older
1 2 3 4
This is an old version of xrgears kept for archival purposes.
The new OpenXR version can be found on the [Freedesktop Gitlab](https://gitlab.freedesktop.org/monado/demos/xrgears).


Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
5 6
![Screenshot](https://gitlab.com/lubosz/xrgears/raw/master/doc/screenshot.jpg "Screenshot")

7
# xrgears-legacy
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

xrgears is a stand alone VR demo using OpenHMD for tracking and Vulkan
with several window system back ends for rendering.

The demo is able to utilize full screen extended mode on XCB and 2 Wayland backends using different protocols.

Direct Mode is achieved through drm-lease utilizing `VK_EXT_direct_mode_display` and related extensions.

It can also run directly on KMS, which is currently just implemented for Intel and could be impossible on the current release due to regression issues in mesa. The KMS back end is taken from [vkcube](https://github.com/krh/vkcube).

This project is a highly modified fork of [Sascha Willem's excellent Vulkan Samples](https://github.com/SaschaWillems/Vulkan).

The Vulkan code is organized in a header only C++ library, which is named `vitamin-k`.

# Dependencies

OpenHMD, Vulkan, Assimp, GLM / GLI

## Platform libraries required for the various back ends

### XCB
xcb, xcb-keysyms, xcb-randr

### Wayland
wayland-client,wayland-scanner,wayland-protocols

### DRM
gbm, libdrm

# Clone

This repo needs to be cloned recursively

```
git clone --recursive URL
```

If you forgot that you can fetch the assets module like so

```
git submodule init
git submodule update
```

# Build

```
cmake .
make -j9
```

Meson build WIP.

# Commands

```
Options:
  -s, --size WxH           Size of the output window (default: 1280x720)
  -f, --fullscreen         Run fullscreen. Optinally specify display and mode.
  -d, --display D          Display to fullscreen on. (default: 0)
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
68
  -m, --mode M             Mode for fullscreen (used in wayland-shell only) (default: 0)
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
69
  -w, --window WS          Window system to use (default: auto)
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
70
                           [xcb, wayland, wayland-shell, kms, direct]
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
  -g, --gpu GPU            GPU to use (default: 0)
      --hmd HMD            HMD to use (default: 0)
      --format F           Color format to use (default: VK_FORMAT_B8G8R8A8_UNORM)
      --presentmode M      Present mode to use (default: VK_PRESENT_MODE_FIFO_KHR)

      --list-gpus          List available GPUs
      --list-displays      List available displays
      --list-hmds          List available HMDs
      --list-formats       List available color formats
      --list-presentmodes  List available present modes

      --disable-overlay    Disable text overlay
      --mouse-navigation   Use mouse instead of HMD for camera control.
      --distortion         HMD lens distortion (default: panotools)
                           [none, panotools, vive]
  -v, --validation         Run Vulkan validation
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
87
  -h, --help               Show this help
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
88 89 90 91 92 93
```

# Examples

### Run on XCB display 1 in full screen
```
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
94
./bin/xrgears -w xcb -d 1
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
95 96
```

Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
97
### Run on wayland, using VIVE1 distortion shader
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
98
```
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
99
./bin/xrgears -w wayland --distortion vive
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
100 101
```

Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
102
### Enumerate displays with XCB for direct backend
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
103 104

```
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
105
./bin/xrgears --list-displays --window direct
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
106 107
```

Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
108
### Run on first non-desktop output in direct mode with VIVE1 distortion.
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
109
```
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
110
./bin/xrgears --window direct --distortion vive
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
111 112 113 114 115 116 117 118 119 120 121 122 123
```

### Run cube example using the format VK_FORMAT_B8G8R8A8_SRGB
```
./bin/cube --format VK_FORMAT_B8G8R8A8_SRGB
```

### Enumerate available present modes
```
./bin/cube --list-presentmodes
```

# License
Lubosz Sarnecki's avatar
Lubosz Sarnecki committed
124
MIT