Class ILLIXR::stereo_renderer
ClassList > ILLIXR > stereo_renderer
Stereo video renderer for Quest 3 — Vulkan backend. More...
#include <stereo_renderer.hpp>
Public Functions
| Type | Name |
|---|---|
| void | cleanup () |
| bool | has_frame () const |
| bool | initialize (VkInstance instance, VkPhysicalDevice physical_device, VkDevice device, VkQueue queue, uint32_t queue_family, VkFormat swapchain_format) Initialize Vulkan rendering resources. |
| bool | is_initialized () const |
| stereo_renderer & | operator= (const stereo_renderer &) = delete |
| void | receive_frame (const data_format::dual_frames & frame) Import AHardwareBuffer handles from a decoded frame into Vulkan. |
| bool | render_eye (int eye, VkImage swapchain_image, uint32_t swapchain_width, uint32_t swapchain_height, VkSemaphore signal_semaphore=VK_NULL_HANDLE) Record and submit a command buffer that renders one eye's color. |
| bool | render_eye_depth (int eye, VkImage depth_swapchain_image, VkFormat depth_format, uint32_t swapchain_width, uint32_t swapchain_height) Record and submit a command buffer that renders one eye's depth. |
| bool | render_eye_motion_vec (int eye, VkImage mv_swapchain_image, uint32_t swapchain_width, uint32_t swapchain_height) Record and submit a command buffer that renders one eye's motion-vector data into an App Spacewarp swapchain image. |
| void | set_crop_region (int original_width, int original_height, int padded_width, int padded_height) |
| stereo_renderer () = default |
|
| stereo_renderer (const stereo_renderer &) = delete |
|
| void | wait_idle () Wait for all in-flight rendering to complete. |
| ~stereo_renderer () |
Detailed Description
Replaces the previous OpenGL ES / SurfaceTexture path entirely. No EGL context is needed; this class operates purely on Vulkan objects.
Typical per-frame usage (called from the render thread in oxr_interface):
renderer_->receive_frame(frame); // import AHardwareBuffers for (int eye = 0; eye < 2; eye++) { renderer_->render_eye(eye, // record + submit command buffer swapchain_image, swapchain_width, swapchain_height, signal_semaphore);
if (frame.has_valid_depth()) { renderer_->render_eye_depth(eye, ...); // depth swapchain image }
if (frame.has_valid_motion_vectors()) { renderer_->render_eye_motion_vec(eye, …); // spacewarp MV swapchain } }
Public Functions Documentation
function cleanup
void ILLIXR::stereo_renderer::cleanup ()
function has_frame
inline bool ILLIXR::stereo_renderer::has_frame () const
function initialize
Initialize Vulkan rendering resources.
bool ILLIXR::stereo_renderer::initialize (
VkInstance instance,
VkPhysicalDevice physical_device,
VkDevice device,
VkQueue queue,
uint32_t queue_family,
VkFormat swapchain_format
)
Must be called once after the OpenXR Vulkan session has been created.
Parameters:
instanceVulkan instance (created via xrCreateVulkanInstanceKHR).physical_devicePhysical device selected by OpenXR.deviceLogical device (created via xrCreateVulkanDeviceKHR).queueGraphics queue used for rendering submissions.queue_familyQueue family index for the graphics queue.swapchain_formatVkFormat of the OpenXR swapchain images.
Returns:
true on success.
function is_initialized
inline bool ILLIXR::stereo_renderer::is_initialized () const
function operator=
stereo_renderer & ILLIXR::stereo_renderer::operator= (
const stereo_renderer &
) = delete
function receive_frame
Import AHardwareBuffer handles from a decoded frame into Vulkan.
void ILLIXR::stereo_renderer::receive_frame (
const data_format::dual_frames & frame
)
Call this once per frame before any render_eye* calls. For hardware_buffer format: caches imported images keyed by buffer pointer. For nv12 format: uploads pixel data to internal textures.
function render_eye
Record and submit a command buffer that renders one eye's color.
bool ILLIXR::stereo_renderer::render_eye (
int eye,
VkImage swapchain_image,
uint32_t swapchain_width,
uint32_t swapchain_height,
VkSemaphore signal_semaphore=VK_NULL_HANDLE
)
Parameters:
eye0 = left, 1 = right.swapchain_imageThe VkImage from xrAcquireSwapchainImage.swapchain_widthSwapchain image width.swapchain_heightSwapchain image height.signal_semaphoreVkSemaphore to signal when GPU work is complete (pass VK_NULL_HANDLE if not needed).
Returns:
true on success.
function render_eye_depth
Record and submit a command buffer that renders one eye's depth.
bool ILLIXR::stereo_renderer::render_eye_depth (
int eye,
VkImage depth_swapchain_image,
VkFormat depth_format,
uint32_t swapchain_width,
uint32_t swapchain_height
)
Samples the decoded depth AHardwareBuffer (RG-packed 16-bit depth) and writes the reconstructed normalised depth values into the OpenXR depth swapchain image. Must only be called when has_frame() is true and the frame has has_valid_depth() == true.
Parameters:
eye0 = left, 1 = right.depth_swapchain_imageThe VkImage from the depth XrSwapchain.depth_formatVkFormat of the depth swapchain (e.g. VK_FORMAT_D32_SFLOAT).swapchain_widthImage width.swapchain_heightImage height.
Returns:
true on success.
function render_eye_motion_vec
Record and submit a command buffer that renders one eye's motion-vector data into an App Spacewarp swapchain image.
bool ILLIXR::stereo_renderer::render_eye_motion_vec (
int eye,
VkImage mv_swapchain_image,
uint32_t swapchain_width,
uint32_t swapchain_height
)
Samples the decoded motion-vector AHardwareBuffer (HEVC 10-bit, two-component screen-space motion packed into Y/Cb planes) and converts it to VK_FORMAT_R16G16B16A16_SFLOAT for submission via XrCompositionLayerSpaceWarpInfoFB::motionVectorSubImage.
Must only be called when has_frame() is true and the frame has has_valid_motion_vectors() == true.
Parameters:
eye0 = left, 1 = right.mv_swapchain_imageThe VkImage from the motion-vector XrSwapchain.swapchain_widthImage width (typically 432).swapchain_heightImage height (typically 432).
Returns:
true on success.
function set_crop_region
void ILLIXR::stereo_renderer::set_crop_region (
int original_width,
int original_height,
int padded_width,
int padded_height
)
function stereo_renderer [1/2]
ILLIXR::stereo_renderer::stereo_renderer () = default
function stereo_renderer [2/2]
ILLIXR::stereo_renderer::stereo_renderer (
const stereo_renderer &
) = delete
function wait_idle
Wait for all in-flight rendering to complete.
void ILLIXR::stereo_renderer::wait_idle ()
Call before releasing AHardwareBuffers from the previous frame.
function ~stereo_renderer
ILLIXR::stereo_renderer::~stereo_renderer ()
The documentation for this class was generated from the following file /home/friedel/devel/ILLIXR/illixr_release/ILLIXR/plugins/openxr_interface/stereo_renderer.hpp