mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-04 06:06:17 +00:00
st/oxr: switch blend mode to array
This commit is contained in:
parent
6f93b4c718
commit
1062ef35fc
|
@ -25,6 +25,7 @@
|
|||
#include "util/u_debug.h"
|
||||
#include "util/u_misc.h"
|
||||
#include "util/u_time.h"
|
||||
#include "util/u_verify.h"
|
||||
|
||||
#include "math/m_api.h"
|
||||
#include "math/m_mathinclude.h"
|
||||
|
@ -1775,7 +1776,6 @@ oxr_session_frame_end(struct oxr_logger *log, struct oxr_session *sess, const Xr
|
|||
return oxr_session_success_result(sess);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Blend mode.
|
||||
* XR_ERROR_ENVIRONMENT_BLEND_MODE_UNSUPPORTED must always be reported,
|
||||
|
@ -1783,16 +1783,16 @@ oxr_session_frame_end(struct oxr_logger *log, struct oxr_session *sess, const Xr
|
|||
*/
|
||||
|
||||
enum xrt_blend_mode blend_mode = oxr_blend_mode_to_xrt(frameEndInfo->environmentBlendMode);
|
||||
struct xrt_device *xdev = GET_XDEV_BY_ROLE(sess->sys, head);
|
||||
|
||||
if (blend_mode == 0) {
|
||||
if (!u_verify_blend_mode_valid(blend_mode)) {
|
||||
return oxr_error(log, XR_ERROR_VALIDATION_FAILURE,
|
||||
"(frameEndInfo->environmentBlendMode == "
|
||||
"0x%08x) unknown environment blend mode",
|
||||
frameEndInfo->environmentBlendMode);
|
||||
}
|
||||
|
||||
struct xrt_device *xdev = GET_XDEV_BY_ROLE(sess->sys, head);
|
||||
if ((blend_mode & xdev->hmd->blend_mode) == 0) {
|
||||
if (!u_verify_blend_mode_supported(xdev, blend_mode)) {
|
||||
//! @todo Make integer print to string.
|
||||
return oxr_error(log, XR_ERROR_ENVIRONMENT_BLEND_MODE_UNSUPPORTED,
|
||||
"(frameEndInfo->environmentBlendMode == %u) "
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "xrt/xrt_device.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_verify.h"
|
||||
|
||||
#include "oxr_objects.h"
|
||||
#include "oxr_logger.h"
|
||||
|
@ -86,6 +87,8 @@ oxr_system_get_by_id(struct oxr_logger *log, struct oxr_instance *inst, XrSystem
|
|||
return XR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
XrResult
|
||||
oxr_system_fill_in(struct oxr_logger *log, struct oxr_instance *inst, XrSystemId systemId, struct oxr_system *sys)
|
||||
{
|
||||
|
@ -151,20 +154,16 @@ oxr_system_fill_in(struct oxr_logger *log, struct oxr_instance *inst, XrSystemId
|
|||
|
||||
struct xrt_device *head = GET_XDEV_BY_ROLE(sys, head);
|
||||
|
||||
uint32_t i = 0;
|
||||
if (head->hmd->blend_mode & XRT_BLEND_MODE_OPAQUE) {
|
||||
sys->blend_modes[i++] = XR_ENVIRONMENT_BLEND_MODE_OPAQUE;
|
||||
}
|
||||
if (head->hmd->blend_mode & XRT_BLEND_MODE_ADDITIVE) {
|
||||
sys->blend_modes[i++] = XR_ENVIRONMENT_BLEND_MODE_ADDITIVE;
|
||||
}
|
||||
if (head->hmd->blend_mode & XRT_BLEND_MODE_ALPHA_BLEND) {
|
||||
sys->blend_modes[i++] = XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND;
|
||||
}
|
||||
sys->num_blend_modes = i;
|
||||
assert(head->hmd->num_blend_modes <= XRT_MAX_DEVICE_BLEND_MODES);
|
||||
assert(head->hmd->num_blend_modes != 0);
|
||||
|
||||
assert(i < ARRAY_SIZE(sys->blend_modes));
|
||||
for (size_t i = 0; i < head->hmd->num_blend_modes; i++) {
|
||||
assert(u_verify_blend_mode_valid(head->hmd->blend_modes[i]));
|
||||
sys->blend_modes[i] = (XrEnvironmentBlendMode)head->hmd->blend_modes[i];
|
||||
}
|
||||
sys->num_blend_modes = (uint32_t)head->hmd->num_blend_modes;
|
||||
|
||||
assert(sys->num_blend_modes <= ARRAY_SIZE(sys->blend_modes));
|
||||
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue