Monado OpenXR Runtime
Loading...
Searching...
No Matches
openvr_compositor_vulkan.cpp File Reference

Implementation of Vulkan-specific compositor functionality for OpenVR. More...

#include "xrt/xrt_config_build.h"
#include "xrt/xrt_gfx_vk.h"
#include "util/u_pretty_print.h"
#include "util/u_debug.h"
#include "vk/vk_format.h"
#include "vk/vk_cmd.h"
#include "client/comp_vk_client.h"
#include "render/render_interface.h"
#include "common/openvr_error.hpp"
#include "openvr_compositor.hpp"
#include <vector>
Include dependency graph for openvr_compositor_vulkan.cpp:

Macros

#define P2_DIVIDE_ROUND_UP(v, div)   ((v + (div - 1)) / div)
 
#define GET_PROC(INST, NAME)   PFN_vk##NAME loaded_##NAME = (PFN_vk##NAME)vulkanGetInstanceProcAddr(INST, "vk" #NAME)
 
#define UUID_STR_SIZE   (XRT_UUID_SIZE * 3 + 1)
 
#define GET_PROC(INST, NAME)   PFN_vk##NAME loaded_##NAME = (PFN_vk##NAME)vulkanGetInstanceProcAddr(INST, "vk" #NAME)
 

Functions

static vr::EColorSpace xrt::state_trackers::openvr::determine_color_space (VkFormat format)
 When dealing with an Auto colour space, pick the correct one to use based on the format.
 
static vr::EColorSpace xrt::state_trackers::openvr::resolve_color_space (VkFormat format, vr::EColorSpace color_space)
 
static VkFormat xrt::state_trackers::openvr::resolve_swapchain_sample_format (VkFormat format, vr::EColorSpace color_space)
 
static VkFormat xrt::state_trackers::openvr::resolve_swapchain_storage_format (VkFormat source_format, VkFormat sample_format)
 Given the format that the compositor will later sample with, return the storage-compatible format to write into.
 
static std::optional< render_compute_blit_resolve_color_mode > xrt::state_trackers::openvr::determine_blit_resolve_color_mode (VkFormat format, vr::EColorSpace color_space)
 
static void xrt::state_trackers::openvr::calc_dispatch_dims (const VkExtent2D extent, uint32_t *out_w, uint32_t *out_h)
 
static uint32_t xrt::state_trackers::openvr::get_blit_pipeline_id (render_compute_blit_resolve_color_mode color_mode)
 
static void xrt::state_trackers::openvr::snprint_uuid (char *str, size_t size, const xrt_uuid_t *uuid)
 
static void xrt::state_trackers::openvr::snprint_luid (char *str, size_t size, xrt_luid_t *luid)
 

Detailed Description

Implementation of Vulkan-specific compositor functionality for OpenVR.

Author
Beyley Cardellio ep1cm.nosp@m.1n10.nosp@m.n123@.nosp@m.gmai.nosp@m.l.com

Function Documentation

◆ determine_color_space()

static vr::EColorSpace xrt::state_trackers::openvr::determine_color_space ( VkFormat  format)
static

When dealing with an Auto colour space, pick the correct one to use based on the format.

According to the OpenVR documentation, all 8-bit per component formats are sRGB/Gamma

References xrt::state_trackers::openvr::determine_color_space().

Referenced by xrt::state_trackers::openvr::determine_color_space().

◆ resolve_swapchain_storage_format()

static VkFormat xrt::state_trackers::openvr::resolve_swapchain_storage_format ( VkFormat  source_format,
VkFormat  sample_format 
)
static

Given the format that the compositor will later sample with, return the storage-compatible format to write into.

References xrt::state_trackers::openvr::resolve_swapchain_storage_format(), and vk_format_convert_srgb_to_unorm().

Referenced by xrt::state_trackers::openvr::resolve_swapchain_storage_format().