The open source OpenXR runtime

ipc: fix 32bit alignment mismatch

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

+18 -2
+15 -2
src/xrt/include/xrt/xrt_defines.h
··· 15 15 #include "xrt/xrt_compiler.h" 16 16 #include "xrt/xrt_results.h" 17 17 18 + #include <assert.h> 18 19 #include <stdio.h> 19 20 20 21 #ifdef __cplusplus ··· 2019 2020 int64_t duration_ns; 2020 2021 }; 2021 2022 2023 + static_assert(sizeof(struct xrt_output_value_vibration) == 16, 2024 + "invalid structure size, maybe different 32/64 bits sizes or padding"); 2025 + 2022 2026 struct xrt_output_value_pcm_vibration 2023 2027 { 2024 2028 uint32_t buffer_size; 2025 - const float *buffer; 2026 - float sample_rate; 2029 + XRT_ALIGNAS(8) const float *buffer; 2030 + XRT_ALIGNAS(8) float sample_rate; 2027 2031 bool append; 2028 2032 uint32_t *samples_consumed; 2029 2033 }; 2030 2034 2035 + static_assert(sizeof(struct xrt_output_value_pcm_vibration) == 32, 2036 + "invalid structure size, maybe different 32/64 bits sizes or padding"); 2037 + 2031 2038 struct xrt_output_value_force_feedback 2032 2039 { 2033 2040 struct xrt_output_force_feedback force_feedback[5]; 2034 2041 uint64_t force_feedback_location_count; 2035 2042 }; 2043 + 2044 + static_assert(sizeof(struct xrt_output_value_force_feedback) == 48, 2045 + "invalid structure size, maybe different 32/64 bits sizes or padding"); 2036 2046 2037 2047 /*! 2038 2048 * A union of all output types. ··· 2050 2060 struct xrt_output_value_force_feedback force_feedback; 2051 2061 }; 2052 2062 }; 2063 + 2064 + static_assert(sizeof(struct xrt_output_value) == 56, 2065 + "invalid structure size, maybe different 32/64 bits sizes or padding"); 2053 2066 2054 2067 2055 2068 /*
+3
src/xrt/ipc/shared/ipc_protocol.h
··· 379 379 float sample_rate; 380 380 bool append; 381 381 }; 382 + 383 + static_assert(sizeof(struct ipc_pcm_haptic_buffer) == 12, 384 + "invalid structure size, maybe different 32/64 bits sizes or padding");