diff --git a/src/xrt/include/xrt/xrt_handles.h b/src/xrt/include/xrt/xrt_handles.h index 27523e60b..4d8c91c2b 100644 --- a/src/xrt/include/xrt/xrt_handles.h +++ b/src/xrt/include/xrt/xrt_handles.h @@ -205,6 +205,15 @@ typedef AHardwareBuffer *xrt_graphics_buffer_handle_t; */ #define XRT_GRAPHICS_BUFFER_HANDLE_IS_AHARDWAREBUFFER 1 +/*! + * Defined to indicate that the graphics buffer has a reference added by the import into Vulkan, + * and is not consumed nor does it need to be kept alive until destruction of the imported image. + * + * @relates xrt_graphics_buffer_handle_t + * @see XRT_GRAPHICS_BUFFER_HANDLE_CONSUMED_BY_VULKAN_IMPORT + */ +#define XRT_GRAPHICS_BUFFER_HANDLE_REFERENCE_ADDED_BY_VULKAN_IMPORT 1 + /*! * Check whether a graphics buffer handle is valid. * @@ -243,6 +252,14 @@ typedef int xrt_graphics_buffer_handle_t; */ #define XRT_GRAPHICS_BUFFER_HANDLE_IS_FD 1 +/*! + * Defined to indicate that the graphics buffer is consumed by the import into Vulkan + * + * @relates xrt_graphics_buffer_handle_t + * @see XRT_GRAPHICS_BUFFER_HANDLE_REFERENCE_ADDED_BY_VULKAN_IMPORT + */ +#define XRT_GRAPHICS_BUFFER_HANDLE_CONSUMED_BY_VULKAN_IMPORT 1 + /*! * Check whether a graphics buffer handle is valid. * @@ -281,6 +298,14 @@ typedef HANDLE xrt_graphics_buffer_handle_t; */ #define XRT_GRAPHICS_BUFFER_HANDLE_IS_WIN32_HANDLE 1 +/*! + * Defined to indicate that the graphics buffer is consumed by the import into Vulkan + * + * @relates xrt_graphics_buffer_handle_t + * @see XRT_GRAPHICS_BUFFER_HANDLE_REFERENCE_ADDED_BY_VULKAN_IMPORT + */ +#define XRT_GRAPHICS_BUFFER_HANDLE_CONSUMED_BY_VULKAN_IMPORT 1 + /*! * Check whether a graphics buffer handle is valid. * @@ -390,6 +415,12 @@ xrt_graphics_sync_handle_is_valid(xrt_graphics_sync_handle_t handle) #endif +#if (!defined(XRT_GRAPHICS_BUFFER_HANDLE_REFERENCE_ADDED_BY_VULKAN_IMPORT)) && \ + (!defined(XRT_GRAPHICS_BUFFER_HANDLE_CONSUMED_BY_VULKAN_IMPORT)) +// Exactly one of these must be defined in each platform. +#error "Needs port: Must define a macro indicating the Vulkan image import buffer behavior" +#endif + #ifdef __cplusplus } #endif