Skip to content

Supporting MONO rendering

Meng Jiao requested to merge gin-c/monado-fork:feature_view_count into main

Windows

Run: SIMULATED_VIEW_COUNT=1 ./monado-service

20231219-175402 20231219-175344

Android

d->base.hmd->view_count = 2; android_stereo d->base.hmd->view_count = 1; android_mono

auxiliary

u/file: Changed file open mode from "r" to "rb" to ensure binary mode is used for reading the file. This resolves an issue where file size and read size were inconsistent on the Windows platform.

u/u_config_json: Added a new parameter uint32_t *out_view_count to the function u_config_json_get_remote_settings to provide the ability to retrieve the view count from the remote settings.

u/device: Added a new function u_device_setup_one_eye.

u/u_distortion: Modified the function u_distortion_cardboard_calculate to accept a new parameter struct xrt_device *xdev for retrieving the view_count from the device. This view_count is then used for parameter settings, enhancing the functionality and flexibility of the distortion calculation.

compositor

xrt_layer_type: Renamed the XRT_LAYER_STEREO_PROJECTION to XRT_LAYER_PROJECTION in the xrt_layer_type enumeration to support both mono and stereo projection layers. This change provides a more inclusive and versatile categorization of projection layers within the XRT framework, accommodating a wider range of use cases.

multi_layer_entry: Updated the array length of xscs within multi_layer_entry from 4 to 2 * XRT_MAX_VIEWS to accommodate a variable number of views.

swapchain: Changed struct xrt_swapchain *l_xsc, struct xrt_swapchain *r_xsc to struct xrt_swapchain *xsc[XRT_MAX_VIEWS], in order to support multiple views' swapchains. When iterating, use xrt_layer_data.proj.view_count.

render: render_resources now has a view_count field, which is set to 1 for mono and 2 for stereo. This is used to iterate over the views in the render function.

render: Use the XRT_MAX_VIEWS macro to calculate the length of a series of arrays.

xrt

xrt_defines: Added a new define XRT_MAX_VIEWS to define the maximum number of views supported by the system. This is used to define the maximum number of views supported by the distortion calculation.

xrt_device: Added a new function xrt_device_get_view_configuration to get the view configuration for a device. The array size is determined by XRT_MAX_VIEWS.

Edited by Meng Jiao

Merge request reports