The open source OpenXR runtime
0
fork

Configure Feed

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

xrt: use __declspec(align) instead of alignas on MSVC

some older versions of MSVC don't support alignas (idk why), use
a macro instead with the normal alignas on linux, but using
__declspec(align) on MSVC.

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

Alex Niemi 2c8a7fe3 f202b042

+12 -13
+6 -1
src/xrt/include/xrt/xrt_compiler.h
··· 22 22 #include <intrin.h> 23 23 // for atomic intrinsics 24 24 #include "xrt_windows.h" 25 - #endif // _MSC_VER 25 + // Older MSVC versions do not have stdalign.h, define it manually using __declspec(align). 26 + #define XRT_ALIGNAS(n) __declspec(align(n)) 27 + #else // _MSC_VER 28 + #include <stdalign.h> 29 + #define XRT_ALIGNAS(align) alignas(align) 30 + #endif 26 31 27 32 #if (defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN) || \ 28 33 (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) || \
+4 -6
src/xrt/include/xrt/xrt_compositor.h
··· 20 20 #include "xrt/xrt_config_have.h" 21 21 #include "xrt/xrt_windows.h" 22 22 23 - #include <stdalign.h> 24 - 25 23 #if defined(XRT_HAVE_D3D11) 26 24 #include <d3d11.h> 27 25 #elif defined(XRT_DOXYGEN) ··· 412 410 * 413 411 * alignas for 32 bit client support, 414 412 */ 415 - alignas(8) int64_t timestamp; 413 + XRT_ALIGNAS(8) int64_t timestamp; 416 414 417 415 /*! 418 416 * Composition flags ··· 481 479 struct xrt_layer_frame_data 482 480 { 483 481 //! alignas for 32 bit client support, see @ref ipc-design 484 - alignas(8) int64_t frame_id; 482 + XRT_ALIGNAS(8) int64_t frame_id; 485 483 int64_t display_time_ns; 486 484 enum xrt_blend_mode env_blend_mode; 487 485 }; ··· 935 933 { 936 934 bool is_overlay; 937 935 //! alignas for 32 bit client support, see @ref ipc-design 938 - alignas(8) uint64_t flags; 936 + XRT_ALIGNAS(8) uint64_t flags; 939 937 uint32_t z_order; 940 938 }; 941 939 ··· 953 951 * Supported formats, never changes. 954 952 * alignas for 32 bit client support, see @ref ipc-design 955 953 */ 956 - alignas(8) int64_t formats[XRT_MAX_SWAPCHAIN_FORMATS]; 954 + XRT_ALIGNAS(8) int64_t formats[XRT_MAX_SWAPCHAIN_FORMATS]; 957 955 958 956 //! Max texture size that GPU supports (size of a single dimension), zero means any size. 959 957 uint32_t max_texture_size;
+1 -3
src/xrt/include/xrt/xrt_device.h
··· 17 17 #include "xrt/xrt_visibility_mask.h" 18 18 #include "xrt/xrt_limits.h" 19 19 20 - #include <stdalign.h> 21 - 22 20 #ifdef __cplusplus 23 21 extern "C" { 24 22 #endif ··· 167 165 bool active; 168 166 169 167 //! alignas for 32 bit client support, see @ref ipc-design 170 - alignas(8) int64_t timestamp; 168 + XRT_ALIGNAS(8) int64_t timestamp; 171 169 172 170 enum xrt_input_name name; 173 171
+1 -3
src/xrt/include/xrt/xrt_system.h
··· 15 15 #include "xrt/xrt_defines.h" 16 16 #include "xrt/xrt_device.h" 17 17 18 - #include <stdalign.h> 19 - 20 18 #ifdef __cplusplus 21 19 extern "C" { 22 20 #endif ··· 172 170 * 173 171 * alignas for 32 bit client support, see @ref ipc-design 174 172 */ 175 - alignas(8) uint64_t generation_id; 173 + XRT_ALIGNAS(8) uint64_t generation_id; 176 174 177 175 /*! 178 176 * Index in @ref xrt_system_devices::xdevs for the user's left