Monado OpenXR Runtime
|
Wraps the real compositor providing a D3D11 based interface. More...
Public Member Functions | |
struct xrt_compositor_d3d11 * | client_d3d11_compositor_create (struct xrt_compositor_native *xcn, ID3D11Device *device) |
Create a new client_d3d11_compositor. More... | |
Data Fields | |
struct xrt_compositor_d3d11 | base = {} |
struct xrt_compositor_native * | xcn {nullptr} |
Owning reference to the backing native compositor. More... | |
xrt::auxiliary::util::ComGuard | com_guard |
Just keeps COM alive while we keep references to COM things. More... | |
enum u_logging_level | log_level = U_LOGGING_INFO |
Logging level. More... | |
wil::com_ptr< ID3D11Device5 > | app_device |
Device we got from the app. More... | |
wil::com_ptr< ID3D11DeviceContext3 > | app_context |
Immediate context for app_device. More... | |
wil::com_ptr< ID3D11Device5 > | comp_device |
A similar device we created on the same adapter. More... | |
wil::com_ptr< ID3D11DeviceContext4 > | comp_context |
Immediate context for comp_device. More... | |
wil::com_ptr< ID3D11Device5 > | fence_device |
Device used for the fence, currently the app_device. More... | |
wil::com_ptr< ID3D11DeviceContext4 > | fence_context |
Immediate context for fence_device. More... | |
unique_compositor_semaphore_ref | timeline_semaphore |
A timeline semaphore made by the native compositor and imported by us. More... | |
wil::com_ptr< ID3D11Fence > | fence |
A fence (timeline semaphore) object, owned by fence_device. More... | |
wil::unique_event_nothrow | local_wait_event |
Event used for blocking in layer_commit if required (if timeline_semaphore is null/invalid) More... | |
uint64_t | timeline_semaphore_value = 0 |
The value most recently signaled on the timeline semaphore. More... | |
Data Fields inherited from xrt_compositor_d3d11 | |
struct xrt_compositor | base |
Base. More... | |
Data Fields inherited from xrt_compositor | |
struct xrt_compositor_info | info |
Capabilities and recommended values information. More... | |
xrt_result_t(* | get_swapchain_create_properties )(struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain_create_properties *xsccp) |
For a given xrt_swapchain_create_info struct returns a filled out xrt_swapchain_create_properties. More... | |
xrt_result_t(* | create_passthrough )(struct xrt_compositor *xc, const struct xrt_passthrough_create_info *info) |
Create a passthrough. More... | |
xrt_result_t(* | create_passthrough_layer )(struct xrt_compositor *xc, const struct xrt_passthrough_layer_create_info *info) |
Create a passthrough layer. More... | |
xrt_result_t(* | destroy_passthrough )(struct xrt_compositor *xc) |
Destroy a passthrough. More... | |
xrt_result_t(* | set_performance_level )(struct xrt_compositor *xc, enum xrt_perf_domain domain, enum xrt_perf_set_level level) |
Set CPU/GPU performance level. More... | |
xrt_result_t(* | get_reference_bounds_rect )(struct xrt_compositor *xc, enum xrt_reference_space_type reference_space_type, struct xrt_vec2 *bounds) |
Get the extents of the reference space's bounds rectangle. More... | |
void(* | destroy )(struct xrt_compositor *xc) |
Teardown the compositor. More... | |
xrt_result_t(* | create_swapchain )(struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain **out_xsc) |
Create a swapchain with a set of images. More... | |
xrt_result_t(* | import_swapchain )(struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_image_native *native_images, uint32_t image_count, struct xrt_swapchain **out_xsc) |
Create a swapchain from a set of native images. More... | |
xrt_result_t(* | import_fence )(struct xrt_compositor *xc, xrt_graphics_sync_handle_t handle, struct xrt_compositor_fence **out_xcf) |
Create a compositor fence from a native sync handle. More... | |
xrt_result_t(* | create_semaphore )(struct xrt_compositor *xc, xrt_graphics_sync_handle_t *out_handle, struct xrt_compositor_semaphore **out_xcsem) |
Create a compositor semaphore, also returns a native handle. More... | |
xrt_result_t(* | begin_session )(struct xrt_compositor *xc, const struct xrt_begin_session_info *info) |
See xrBeginSession. More... | |
xrt_result_t(* | end_session )(struct xrt_compositor *xc) |
See xrEndSession, unlike the OpenXR one the state tracker is responsible to call discard frame before calling this function. More... | |
xrt_result_t(* | predict_frame )(struct xrt_compositor *xc, int64_t *out_frame_id, int64_t *out_wake_time_ns, int64_t *out_predicted_gpu_time_ns, int64_t *out_predicted_display_time_ns, int64_t *out_predicted_display_period_ns) |
This function and mark_frame function calls are a alternative to wait_frame. More... | |
xrt_result_t(* | mark_frame )(struct xrt_compositor *xc, int64_t frame_id, enum xrt_compositor_frame_point point, int64_t when_ns) |
This function and predict_frame function calls are a alternative to wait_frame. More... | |
xrt_result_t(* | wait_frame )(struct xrt_compositor *xc, int64_t *out_frame_id, int64_t *out_predicted_display_time, int64_t *out_predicted_display_period) |
See xrWaitFrame. More... | |
xrt_result_t(* | begin_frame )(struct xrt_compositor *xc, int64_t frame_id) |
See xrBeginFrame. More... | |
xrt_result_t(* | discard_frame )(struct xrt_compositor *xc, int64_t frame_id) |
Explicitly discard a frame. More... | |
xrt_result_t(* | layer_begin )(struct xrt_compositor *xc, const struct xrt_layer_frame_data *data) |
Begins layer submission. More... | |
xrt_result_t(* | layer_projection )(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc[XRT_MAX_VIEWS], const struct xrt_layer_data *data) |
Adds a projection layer for submissions. More... | |
xrt_result_t(* | layer_projection_depth )(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc[XRT_MAX_VIEWS], struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS], const struct xrt_layer_data *data) |
Adds a projection layer for submission, has depth information. More... | |
xrt_result_t(* | layer_quad )(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data) |
Adds a quad layer for submission, the center of the quad is specified by the pose and extends outwards from it. More... | |
xrt_result_t(* | layer_cube )(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data) |
Adds a cube layer for submission. More... | |
xrt_result_t(* | layer_cylinder )(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data) |
Adds a cylinder layer for submission. More... | |
xrt_result_t(* | layer_equirect1 )(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data) |
Adds a equirect1 layer for submission. More... | |
xrt_result_t(* | layer_equirect2 )(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data) |
Adds a equirect2 layer for submission. More... | |
xrt_result_t(* | layer_passthrough )(struct xrt_compositor *xc, struct xrt_device *xdev, const struct xrt_layer_data *data) |
Adds a passthrough layer for submission. More... | |
xrt_result_t(* | layer_commit )(struct xrt_compositor *xc, xrt_graphics_sync_handle_t sync_handle) |
Commits all of the submitted layers. More... | |
xrt_result_t(* | layer_commit_with_semaphore )(struct xrt_compositor *xc, struct xrt_compositor_semaphore *xcsem, uint64_t value) |
Commits all of the submitted layers, with a semaphore. More... | |
xrt_result_t(* | get_display_refresh_rate )(struct xrt_compositor *xc, float *out_display_refresh_rate_hz) |
Get the current display refresh rate. More... | |
xrt_result_t(* | request_display_refresh_rate )(struct xrt_compositor *xc, float display_refresh_rate_hz) |
Request system to change the display refresh rate to the requested value. More... | |
xrt_result_t(* | set_thread_hint )(struct xrt_compositor *xc, enum xrt_thread_hint hint, uint32_t thread_id) |
Set thread attributes according to thread type. More... | |
Related Functions | |
(Note that these are not member functions.) | |
#define | D3D_SPEW(c, ...) U_LOG_IFL_T(c->log_level, __VA_ARGS__); |
Spew level logging. More... | |
#define | D3D_DEBUG(c, ...) U_LOG_IFL_D(c->log_level, __VA_ARGS__); |
Debug level logging. More... | |
#define | D3D_INFO(c, ...) U_LOG_IFL_I(c->log_level, __VA_ARGS__); |
Info level logging. More... | |
#define | D3D_WARN(c, ...) U_LOG_IFL_W(c->log_level, __VA_ARGS__); |
Warn level logging. More... | |
#define | D3D_ERROR(c, ...) U_LOG_IFL_E(c->log_level, __VA_ARGS__); |
Error level logging. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from xrt_compositor | |
static xrt_result_t | xrt_comp_get_swapchain_create_properties (struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain_create_properties *xsccp) |
For a given xrt_swapchain_create_info struct returns a filled out xrt_swapchain_create_properties. More... | |
static xrt_result_t | xrt_comp_create_passthrough (struct xrt_compositor *xc, const struct xrt_passthrough_create_info *info) |
Create a passthrough. More... | |
static xrt_result_t | xrt_comp_create_passthrough_layer (struct xrt_compositor *xc, const struct xrt_passthrough_layer_create_info *info) |
Create a passthrough layer. More... | |
static xrt_result_t | xrt_comp_destroy_passthrough (struct xrt_compositor *xc) |
Destroy a passthrough. More... | |
static xrt_result_t | xrt_comp_get_display_refresh_rate (struct xrt_compositor *xc, float *out_display_refresh_rate_hz) |
Get the current display refresh rate. More... | |
static xrt_result_t | xrt_comp_request_display_refresh_rate (struct xrt_compositor *xc, float display_refresh_rate_hz) |
Request system to change the display refresh rate to the requested value. More... | |
static xrt_result_t | xrt_comp_set_performance_level (struct xrt_compositor *xc, enum xrt_perf_domain domain, enum xrt_perf_set_level level) |
Set CPU/GPU performance level. More... | |
static xrt_result_t | xrt_comp_get_reference_bounds_rect (struct xrt_compositor *xc, enum xrt_reference_space_type reference_space_type, struct xrt_vec2 *bounds) |
Get the extents of the reference space's bounds rectangle. More... | |
static void | xrt_comp_destroy (struct xrt_compositor **xc_ptr) |
Teardown the compositor. More... | |
static xrt_result_t | xrt_comp_create_swapchain (struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain **out_xsc) |
Create a swapchain with a set of images. More... | |
static xrt_result_t | xrt_comp_import_swapchain (struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_image_native *native_images, uint32_t image_count, struct xrt_swapchain **out_xsc) |
Create a swapchain from a set of native images. More... | |
static xrt_result_t | xrt_comp_import_fence (struct xrt_compositor *xc, xrt_graphics_sync_handle_t handle, struct xrt_compositor_fence **out_xcf) |
Create a compositor fence from a native sync handle. More... | |
static xrt_result_t | xrt_comp_create_semaphore (struct xrt_compositor *xc, xrt_graphics_sync_handle_t *out_handle, struct xrt_compositor_semaphore **out_xcsem) |
Create a compositor semaphore, also returns a native handle. More... | |
static xrt_result_t | xrt_comp_begin_session (struct xrt_compositor *xc, const struct xrt_begin_session_info *info) |
See xrBeginSession. More... | |
static xrt_result_t | xrt_comp_end_session (struct xrt_compositor *xc) |
See xrEndSession, unlike the OpenXR one the state tracker is responsible to call discard frame before calling this function. More... | |
static xrt_result_t | xrt_comp_predict_frame (struct xrt_compositor *xc, int64_t *out_frame_id, int64_t *out_wake_time_ns, int64_t *out_predicted_gpu_time_ns, int64_t *out_predicted_display_time_ns, int64_t *out_predicted_display_period_ns) |
This function and mark_frame function calls are a alternative to wait_frame. More... | |
static xrt_result_t | xrt_comp_mark_frame (struct xrt_compositor *xc, int64_t frame_id, enum xrt_compositor_frame_point point, int64_t when_ns) |
This function and predict_frame function calls are a alternative to wait_frame. More... | |
static xrt_result_t | xrt_comp_wait_frame (struct xrt_compositor *xc, int64_t *out_frame_id, int64_t *out_predicted_display_time, int64_t *out_predicted_display_period) |
See xrWaitFrame. More... | |
static xrt_result_t | xrt_comp_begin_frame (struct xrt_compositor *xc, int64_t frame_id) |
See xrBeginFrame. More... | |
static xrt_result_t | xrt_comp_discard_frame (struct xrt_compositor *xc, int64_t frame_id) |
Explicitly discard a frame. More... | |
static xrt_result_t | xrt_comp_layer_begin (struct xrt_compositor *xc, const struct xrt_layer_frame_data *data) |
Begins layer submission. More... | |
static xrt_result_t | xrt_comp_layer_projection (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc[XRT_MAX_VIEWS], const struct xrt_layer_data *data) |
Adds a projection layer for submissions. More... | |
static xrt_result_t | xrt_comp_layer_projection_depth (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc[XRT_MAX_VIEWS], struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS], const struct xrt_layer_data *data) |
Adds a projection layer for submission, has depth information. More... | |
static xrt_result_t | xrt_comp_layer_quad (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data) |
Adds a quad layer for submission, the center of the quad is specified by the pose and extends outwards from it. More... | |
static xrt_result_t | xrt_comp_layer_cube (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data) |
Adds a cube layer for submission. More... | |
static xrt_result_t | xrt_comp_layer_cylinder (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data) |
Adds a cylinder layer for submission. More... | |
static xrt_result_t | xrt_comp_layer_equirect1 (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data) |
Adds a equirect1 layer for submission. More... | |
static xrt_result_t | xrt_comp_layer_equirect2 (struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data) |
Adds a equirect2 layer for submission. More... | |
static xrt_result_t | xrt_comp_layer_passthrough (struct xrt_compositor *xc, struct xrt_device *xdev, const struct xrt_layer_data *data) |
Adds a passthrough layer for submission. More... | |
static xrt_result_t | xrt_comp_layer_commit (struct xrt_compositor *xc, xrt_graphics_sync_handle_t sync_handle) |
Commits all of the submitted layers. More... | |
static xrt_result_t | xrt_comp_layer_commit_with_semaphore (struct xrt_compositor *xc, struct xrt_compositor_semaphore *xcsem, uint64_t value) |
Commits all of the submitted layers, with a semaphore. More... | |
Wraps the real compositor providing a D3D11 based interface.
struct xrt_compositor_d3d11 * client_d3d11_compositor_create | ( | struct xrt_compositor_native * | xcn, |
ID3D11Device * | device | ||
) |
Create a new client_d3d11_compositor.
Takes ownership of provided xcn.
References U_LOG_E.
Referenced by xrt_compositor_native::xrt_gfx_d3d11_provider_create().
|
related |
Debug level logging.
|
related |
Error level logging.
Referenced by client_d3d11_create_swapchain(), and client_d3d12_create_swapchain().
|
related |
Info level logging.
|
related |
Spew level logging.
|
related |
Warn level logging.
Referenced by client_d3d11_create_swapchain(), and client_d3d12_create_swapchain().
wil::com_ptr<ID3D11DeviceContext3> client_d3d11_compositor::app_context |
Immediate context for app_device.
wil::com_ptr<ID3D11Device5> client_d3d11_compositor::app_device |
Device we got from the app.
xrt::auxiliary::util::ComGuard client_d3d11_compositor::com_guard |
Just keeps COM alive while we keep references to COM things.
wil::com_ptr<ID3D11DeviceContext4> client_d3d11_compositor::comp_context |
Immediate context for comp_device.
wil::com_ptr<ID3D11Device5> client_d3d11_compositor::comp_device |
A similar device we created on the same adapter.
wil::com_ptr<ID3D11Fence> client_d3d11_compositor::fence |
A fence (timeline semaphore) object, owned by fence_device.
Signal using fence_context if this is not null.
Wait on it in layer_commit
if timeline_semaphore is null/invalid.
wil::com_ptr<ID3D11DeviceContext4> client_d3d11_compositor::fence_context |
Immediate context for fence_device.
wil::com_ptr<ID3D11Device5> client_d3d11_compositor::fence_device |
Device used for the fence, currently the app_device.
wil::unique_event_nothrow client_d3d11_compositor::local_wait_event |
Event used for blocking in layer_commit
if required (if timeline_semaphore is null/invalid)
enum u_logging_level client_d3d11_compositor::log_level = U_LOGGING_INFO |
Logging level.
unique_compositor_semaphore_ref client_d3d11_compositor::timeline_semaphore |
A timeline semaphore made by the native compositor and imported by us.
When this is valid, we should use xrt_compositor::layer_commit_with_semaphone: it means the native compositor knows about timeline semaphores, and we can import its semaphores, so we can pass timeline_semaphore instead of blocking locally.
uint64_t client_d3d11_compositor::timeline_semaphore_value = 0 |
The value most recently signaled on the timeline semaphore.
struct xrt_compositor_native* client_d3d11_compositor::xcn {nullptr} |
Owning reference to the backing native compositor.