The open source OpenXR runtime

xrt: Improve output defines

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2633>

authored by

Jakob Bornecrantz and committed by
Marge Bot
6b283c41 2f0d747e

+35 -2
+35 -2
src/xrt/include/xrt/xrt_defines.h
··· 1481 1481 #define XRT_OUTPUT_TYPE_BITMASK 0xffu 1482 1482 1483 1483 /*! 1484 + * @brief Create an enum value for xrt_output_name that packs an ID and output 1485 + * type. 1486 + * 1487 + * @param id an integer 1488 + * @param type The suffix of an xrt_output_type value name: `XRT_OUTPUT_TYPE_` is 1489 + * prepended automatically. 1490 + * 1491 + * @see xrt_output_name 1492 + * @ingroup xrt_iface 1493 + */ 1494 + #define XRT_OUTPUT_NAME(id, type) ((UINT32_C(id) << XRT_OUTPUT_TYPE_BITWIDTH) | (uint32_t)XRT_OUTPUT_TYPE_##type) 1495 + 1496 + /*! 1497 + * @brief Extract the xrt_output_type from an xrt_output_name. 1498 + * 1499 + * @param name An xrt_output_name value 1500 + * 1501 + * @relates xrt_output_name 1502 + * @returns @ref xrt_output_type 1503 + * @ingroup xrt_iface 1504 + */ 1505 + #define XRT_GET_OUTPUT_TYPE(name) ((enum xrt_output_type)(name & XRT_OUTPUT_TYPE_BITMASK)) 1506 + 1507 + /*! 1508 + * @brief Extract the xrt_output_name id from an xrt_output_name. 1509 + * 1510 + * @param name An xrt_output_name value 1511 + * 1512 + * @relates xrt_output_name 1513 + * @returns The extracted id. 1514 + * @ingroup xrt_iface 1515 + */ 1516 + #define XRT_GET_OUTPUT_ID(name) ((uint32_t)(name >> XRT_OUTPUT_TYPE_BITWIDTH)) 1517 + 1518 + /*! 1484 1519 * Base type of this output. 1485 1520 * 1486 1521 * @ingroup xrt_iface ··· 1492 1527 XRT_OUTPUT_TYPE_FORCE_FEEDBACK = 0x01, 1493 1528 // clang-format on 1494 1529 }; 1495 - 1496 - #define XRT_OUTPUT_NAME(id, type) ((UINT32_C(id) << XRT_OUTPUT_TYPE_BITWIDTH) | (uint32_t)XRT_OUTPUT_TYPE_##type) 1497 1530 1498 1531 enum xrt_face_expression2_fb 1499 1532 {