mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-03-03 21:26:36 +00:00
aux/util: switch blend mode to array
This commit is contained in:
parent
c53eba34d0
commit
36a48bd62b
src/xrt/auxiliary
|
@ -158,6 +158,7 @@ set(UTIL_SOURCE_FILES
|
|||
util/u_var.h
|
||||
util/u_config_json.c
|
||||
util/u_config_json.h
|
||||
util/u_verify.h
|
||||
)
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/util/u_git_tag.c.in" "${CMAKE_CURRENT_BINARY_DIR}/u_git_tag.c" @ONLY)
|
||||
|
|
|
@ -64,6 +64,7 @@ lib_aux_util = static_library(
|
|||
'util/u_var.h',
|
||||
'util/u_config_json.c',
|
||||
'util/u_config_json.h',
|
||||
'util/u_verify.h',
|
||||
) + [
|
||||
u_git_tag_c,
|
||||
],
|
||||
|
|
|
@ -149,7 +149,10 @@ u_device_setup_split_side_by_side(struct xrt_device *xdev, const struct u_device
|
|||
};
|
||||
|
||||
// Common
|
||||
xdev->hmd->blend_mode = XRT_BLEND_MODE_OPAQUE;
|
||||
size_t idx = 0;
|
||||
xdev->hmd->blend_modes[idx++] = XRT_BLEND_MODE_OPAQUE;
|
||||
xdev->hmd->num_blend_modes = idx;
|
||||
|
||||
if (xdev->hmd->distortion.models == 0) {
|
||||
xdev->hmd->distortion.models = XRT_DISTORTION_MODEL_NONE;
|
||||
xdev->hmd->distortion.preferred = XRT_DISTORTION_MODEL_NONE;
|
||||
|
|
|
@ -29,8 +29,10 @@ u_distortion_cardboard_calculate(const struct u_cardboard_distortion_arguments *
|
|||
uint32_t h_pixels = args->screen.h_pixels;
|
||||
|
||||
// Base assumption, the driver can change afterwards.
|
||||
if (parts->blend_mode == 0) {
|
||||
parts->blend_mode = XRT_BLEND_MODE_OPAQUE;
|
||||
if (parts->num_blend_modes == 0) {
|
||||
size_t idx = 0;
|
||||
parts->blend_modes[idx++] = XRT_BLEND_MODE_OPAQUE;
|
||||
parts->num_blend_modes = idx;
|
||||
}
|
||||
|
||||
// Use the full screen.
|
||||
|
|
32
src/xrt/auxiliary/util/u_verify.h
Normal file
32
src/xrt/auxiliary/util/u_verify.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Copyright 2021, Collabora, Ltd.
|
||||
// Copyright 2021, Moses Turner.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief Tiny file to verify things
|
||||
* @author Moses Turner <mosesturner@protonmail.com>
|
||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||
* @ingroup aux_util
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "xrt/xrt_defines.h"
|
||||
#include "xrt/xrt_device.h"
|
||||
|
||||
static inline bool
|
||||
u_verify_blend_mode_valid(enum xrt_blend_mode blend_mode)
|
||||
{
|
||||
return ((blend_mode == XRT_BLEND_MODE_OPAQUE) || (blend_mode == XRT_BLEND_MODE_ADDITIVE) ||
|
||||
(blend_mode == XRT_BLEND_MODE_ALPHA_BLEND));
|
||||
}
|
||||
|
||||
static inline bool
|
||||
u_verify_blend_mode_supported(struct xrt_device *xdev, enum xrt_blend_mode blend_mode)
|
||||
{
|
||||
for (size_t i = 0; i < xdev->hmd->num_blend_modes; i++) {
|
||||
if (xdev->hmd->blend_modes[i] == blend_mode) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
Loading…
Reference in a new issue