Skip to content

CAVE support: Add basic multi-GPU compatibility

This is a follow-up to MR t/sdl_test: Adapt to Windows (!1954).

Context:

In order to display the rendering of Monado apps in our CAVE on Windows 10 with Active Stereoscopy, we took the Vulkan/OpenGL interoperability route, as Vulkan (to our knowledge at least) doesn't provide any way to use Quad Buffered Stereo. The main idea is to let Monado render everything, and present the result with OpenGL (using the sdl_test target).

Our setup uses one single computer, with 2 GPUs and 3 channels per GPU (for a total of 6 video-projectors). NVidia SLI Mosaic is used to define one single OpenGL "virtual device" which covers the whole screen. By default Monado attaches to one physical GPU, and thus the rendered image buffer is only available on that GPU. As a result, when the OpenGL code reads the shared image of its "virtual device", only half of the whole virtual screen is filled.

To achieve displaying the result on all displays, we considered two approaches: make both GPUs do all the work (this requires explicit control of command buffers and such), or simply "share" the image in which the render is done, by allocating the memory on both GPUs. The latter approach is the one proposed here.

What this MR does:

- Adds support for Vulkan "Device groups" (both instance and device extensions),

- Adds support for Vulkan "Buffer device address" (device extension and feature) required to explicitely allocate the Vulkan/OpenGL "shared" swapchain image's memory on multiple physical devices of a device group,

- Extra checks on memory type for the swapchain images: specifically, the memory heap requires the VK_MEMORY_HEAP_MULTI_INSTANCE_BIT bit to be set in order to allocate memory on all physical devices of a device group (source: Vulkan manual).

Current state:

The implementation works in our CAVE, using MR t/sdl_test: Adapt to Windows (!1954) to run the sdl_test target on Windows.

Target needs to set the features "use_device_group" and "buffer_device_address" to true, and currently requires an instance version of 1.1 to run as expected (I believe due to the function vkEnumeratePhysicalDeviceGroups).

Merge request reports