The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

aux/util: switch blend mode to array

+42 -3
+1
src/xrt/auxiliary/CMakeLists.txt
··· 158 158 util/u_var.h 159 159 util/u_config_json.c 160 160 util/u_config_json.h 161 + util/u_verify.h 161 162 ) 162 163 163 164 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/util/u_git_tag.c.in" "${CMAKE_CURRENT_BINARY_DIR}/u_git_tag.c" @ONLY)
+1
src/xrt/auxiliary/meson.build
··· 64 64 'util/u_var.h', 65 65 'util/u_config_json.c', 66 66 'util/u_config_json.h', 67 + 'util/u_verify.h', 67 68 ) + [ 68 69 u_git_tag_c, 69 70 ],
+4 -1
src/xrt/auxiliary/util/u_device.c
··· 149 149 }; 150 150 151 151 // Common 152 - xdev->hmd->blend_mode = XRT_BLEND_MODE_OPAQUE; 152 + size_t idx = 0; 153 + xdev->hmd->blend_modes[idx++] = XRT_BLEND_MODE_OPAQUE; 154 + xdev->hmd->num_blend_modes = idx; 155 + 153 156 if (xdev->hmd->distortion.models == 0) { 154 157 xdev->hmd->distortion.models = XRT_DISTORTION_MODEL_NONE; 155 158 xdev->hmd->distortion.preferred = XRT_DISTORTION_MODEL_NONE;
+4 -2
src/xrt/auxiliary/util/u_distortion.c
··· 29 29 uint32_t h_pixels = args->screen.h_pixels; 30 30 31 31 // Base assumption, the driver can change afterwards. 32 - if (parts->blend_mode == 0) { 33 - parts->blend_mode = XRT_BLEND_MODE_OPAQUE; 32 + if (parts->num_blend_modes == 0) { 33 + size_t idx = 0; 34 + parts->blend_modes[idx++] = XRT_BLEND_MODE_OPAQUE; 35 + parts->num_blend_modes = idx; 34 36 } 35 37 36 38 // Use the full screen.
+32
src/xrt/auxiliary/util/u_verify.h
··· 1 + // Copyright 2021, Collabora, Ltd. 2 + // Copyright 2021, Moses Turner. 3 + // SPDX-License-Identifier: BSL-1.0 4 + /*! 5 + * @file 6 + * @brief Tiny file to verify things 7 + * @author Moses Turner <mosesturner@protonmail.com> 8 + * @author Jakob Bornecrantz <jakob@collabora.com> 9 + * @ingroup aux_util 10 + */ 11 + 12 + #pragma once 13 + #include "xrt/xrt_defines.h" 14 + #include "xrt/xrt_device.h" 15 + 16 + static inline bool 17 + u_verify_blend_mode_valid(enum xrt_blend_mode blend_mode) 18 + { 19 + return ((blend_mode == XRT_BLEND_MODE_OPAQUE) || (blend_mode == XRT_BLEND_MODE_ADDITIVE) || 20 + (blend_mode == XRT_BLEND_MODE_ALPHA_BLEND)); 21 + } 22 + 23 + static inline bool 24 + u_verify_blend_mode_supported(struct xrt_device *xdev, enum xrt_blend_mode blend_mode) 25 + { 26 + for (size_t i = 0; i < xdev->hmd->num_blend_modes; i++) { 27 + if (xdev->hmd->blend_modes[i] == blend_mode) { 28 + return true; 29 + } 30 + } 31 + return false; 32 + }