|
Monado OpenXR Runtime
|
Internal header for SDL XR system. More...
#include "xrt/xrt_system.h"#include "xrt/xrt_device.h"#include "xrt/xrt_instance.h"#include "xrt/xrt_tracking.h"#include "xrt/xrt_compositor.h"#include "util/u_pacing.h"#include "util/u_logging.h"#include "util/comp_base.h"#include "util/comp_swapchain.h"#include "SDL2/SDL.h"#include "ogl/ogl_api.h"
Go to the source code of this file.
Data Structures | |
| struct | sdl_swapchain |
| Sub-class of comp_swapchain, used to do OpenGL rendering. More... | |
| struct | sdl_comp_frame |
| Tracking frame state. More... | |
| struct | sdl_compositor |
| Split out for convenience. More... | |
| struct | sdl_program |
| C base class for the SDL program. More... | |
Macros | |
| #define | CHECK_GL() |
| Check for OpenGL errors, context needs to be current. | |
Functions | |
| static struct sdl_program * | from_xinst (struct xrt_instance *xinst) |
| static struct sdl_program * | from_xsysd (struct xrt_system_devices *xsysd) |
| static struct sdl_program * | from_xdev (struct xrt_device *xdev) |
| static struct sdl_program * | from_comp (struct xrt_compositor *xc) |
| static void | sdl_make_current (struct sdl_program *sp) |
| Makes the OpenGL context current in this thread, takes lock. | |
| static void | sdl_make_uncurrent (struct sdl_program *sp) |
| Unmakes the any OpenGL context current in this thread, releases the lock. | |
| void | sdl_device_init (struct sdl_program *sp) |
| Init the xrt_device sub struct. | |
| xrt_result_t | sdl_swapchain_create (struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain **out_xsc) |
| Implementation of xrt_compositor::create_swapchain. | |
| xrt_result_t | sdl_swapchain_import (struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_image_native *native_images, uint32_t native_image_count, struct xrt_swapchain **out_xsc) |
| Implementation of xrt_compositor::import_swapchain. | |
| void | sdl_compositor_init (struct sdl_program *sp) |
| Initializes the compositor part of the SDL program. | |
| xrt_result_t | sdl_compositor_create_system (struct sdl_program *sp, struct xrt_system_compositor **out_xsysc) |
| Creates the system compositor that wraps the native compositor. | |
| void | sdl_system_init (struct sdl_program *sp) |
| Init the xrt_system (and u_system) struct. | |
| void | sdl_system_devices_init (struct sdl_program *sp) |
| Init the xrt_system_devices sub struct. | |
| void | sdl_instance_init (struct sdl_program *sp) |
| Init the xrt_instance sub struct. | |
| struct sdl_program * | sdl_program_plus_create (void) |
| Create the SDL program. | |
| void | sdl_program_plus_render (struct sdl_program_plus *spp) |
| Render a frame, called by the compositor when layers have been committed. | |
| void | sdl_program_plus_destroy (struct sdl_program_plus *spp) |
| Destroy the SDL program. | |
Internal header for SDL XR system.
| #define CHECK_GL | ( | ) |
Check for OpenGL errors, context needs to be current.
| xrt_result_t sdl_compositor_create_system | ( | struct sdl_program * | sp, |
| struct xrt_system_compositor ** | out_xsysc | ||
| ) |
Creates the system compositor that wraps the native compositor.
References comp_base::base, sdl_compositor::base, sdl_program::c, comp_multi_create_system_compositor(), u_pa_factory_create(), and XRT_SUCCESS.
| void sdl_compositor_init | ( | struct sdl_program * | sp | ) |
Initializes the compositor part of the SDL program.
References comp_base::base, xrt_compositor_native::base, sdl_compositor::base, xrt_compositor::begin_frame, xrt_compositor::begin_session, sdl_program::c, xrt_compositor::create_swapchain, xrt_compositor::destroy, xrt_compositor::discard_frame, xrt_compositor::end_session, sdl_compositor::frame, sdl_compositor::frame_interval_ns, xrt_compositor::import_swapchain, xrt_compositor::layer_commit, sdl_program::log_level, xrt_compositor::mark_frame, xrt_compositor::predict_frame, sdl_swapchain_create(), sdl_swapchain_import(), U_TIME_1S_IN_NS, comp_base::vk, and sdl_program::xdev_base.
Referenced by sdl_program_plus_create().
| void sdl_device_init | ( | struct sdl_program * | sp | ) |
Init the xrt_device sub struct.
In sdl_device.c
References xrt_input::active, ARRAY_SIZE, xrt_hmd_parts::blend_modes, xrt_device::destroy, xrt_device::get_tracked_pose, xrt_device::get_view_poses, xrt_device::hmd, sdl_program::hmd, xrt_tracking_origin::initial_offset, xrt_device::input_count, xrt_device::inputs, sdl_program::inputs, xrt_device::name, xrt_tracking_origin::name, xrt_hmd_parts::nominal_frame_interval_ns, sdl_program::origin, xrt_hmd_parts::screens, xrt_device::serial, xrt_device::str, time_s_to_ns(), xrt_device::tracking_origin, xrt_tracking_origin::type, u_device_get_view_poses(), u_device_noop_update_inputs(), u_device_setup_split_side_by_side(), u_distortion_mesh_set_none(), U_LOG_E, xrt_device::update_inputs, sdl_program::xdev_base, XRT_INPUT_GENERIC_HEAD_POSE, xrt_pose::XRT_POSE_IDENTITY, and XRT_TRACKING_TYPE_OTHER.
Referenced by sdl_program_plus_create().
| void sdl_instance_init | ( | struct sdl_program * | sp | ) |
Init the xrt_instance sub struct.
References xrt_instance::create_system, xrt_instance::destroy, xrt_instance::get_prober, and sdl_program::xinst_base.
Referenced by sdl_program_plus_create().
|
inlinestatic |
Makes the OpenGL context current in this thread, takes lock.
References sdl_program::ctx, sdl_program::current_mutex, and sdl_program::win.
Referenced by sdl_program_plus_render().
|
inlinestatic |
Unmakes the any OpenGL context current in this thread, releases the lock.
References sdl_program::current_mutex.
Referenced by sdl_program_plus_render().
| struct sdl_program * sdl_program_plus_create | ( | void | ) |
Create the SDL program.
References sdl_program::current_mutex, sdl_program::log_level, sdl_program::pose, sdl_compositor_init(), sdl_device_init(), sdl_instance_init(), sdl_system_devices_init(), sdl_system_init(), sdl_program::spp, and U_LOGGING_INFO.
| void sdl_program_plus_destroy | ( | struct sdl_program_plus * | spp | ) |
Destroy the SDL program.
References sdl_program::current_mutex, and sdl_program::spp.
| void sdl_program_plus_render | ( | struct sdl_program_plus * | spp | ) |
Render a frame, called by the compositor when layers have been committed.
References sdl_compositor::base, sdl_program::c, CHECK_GL, comp_layer::data, comp_base::layer_accum, comp_layer_accum::layer_count, comp_layer_accum::layers, comp_layer::sc_array, sdl_make_current(), sdl_make_uncurrent(), sdl_program::spp, xrt_layer_data::type, and sdl_program::win.
| xrt_result_t sdl_swapchain_create | ( | struct xrt_compositor * | xc, |
| const struct xrt_swapchain_create_info * | info, | ||
| struct xrt_swapchain ** | out_xsc | ||
| ) |
Implementation of xrt_compositor::create_swapchain.
References xrt_swapchain_native::base, sdl_compositor::base, sdl_program::c, comp_swapchain_create_init(), comp_base::cscs, really_destroy(), sdl_swapchain::sp, U_TYPED_CALLOC, comp_base::vk, and XRT_SUCCESS.
Referenced by sdl_compositor_init().
| xrt_result_t sdl_swapchain_import | ( | struct xrt_compositor * | xc, |
| const struct xrt_swapchain_create_info * | info, | ||
| struct xrt_image_native * | native_images, | ||
| uint32_t | native_image_count, | ||
| struct xrt_swapchain ** | out_xsc | ||
| ) |
Implementation of xrt_compositor::import_swapchain.
References xrt_swapchain_native::base, sdl_compositor::base, sdl_program::c, comp_swapchain_import_init(), comp_base::cscs, really_destroy(), sdl_swapchain::sp, U_TYPED_CALLOC, comp_base::vk, and XRT_SUCCESS.
Referenced by sdl_compositor_init().
| void sdl_system_devices_init | ( | struct sdl_program * | sp | ) |
Init the xrt_system_devices sub struct.
References u_system::broadcast, xrt_system_devices::destroy, xrt_system_devices::get_roles, xrt_system_devices::head, simulated_hmd_create(), xrt_system_devices::static_roles, u_builder_create_space_overseer_legacy(), sdl_program::usys, sdl_program::xdev_base, xrt_system_devices::xdev_count, xrt_system_devices::xdevs, xrt_pose::XRT_POSE_IDENTITY, sdl_program::xso, and sdl_program::xsysd_base.
Referenced by sdl_program_plus_create().
| void sdl_system_init | ( | struct sdl_program * | sp | ) |
Init the xrt_system (and u_system) struct.
References u_system::u_system_create(), and sdl_program::usys.
Referenced by sdl_program_plus_create().