mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
a/vk: Add helper to get buffer handle types
The image version of it was used for buffers as well.
This commit is contained in:
parent
115bf93487
commit
eeaaaf398b
|
@ -58,6 +58,20 @@ check_feature(VkFormat format,
|
|||
*
|
||||
*/
|
||||
|
||||
VkExternalMemoryHandleTypeFlags
|
||||
vk_cb_get_buffer_external_handle_type(struct vk_bundle *vk)
|
||||
{
|
||||
#if defined(XRT_GRAPHICS_BUFFER_HANDLE_IS_FD)
|
||||
return VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR;
|
||||
#elif defined(XRT_GRAPHICS_BUFFER_HANDLE_IS_AHARDWAREBUFFER)
|
||||
return VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID;
|
||||
#elif defined(XRT_GRAPHICS_BUFFER_HANDLE_IS_WIN32_HANDLE)
|
||||
return VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT;
|
||||
#else
|
||||
#error "need port"
|
||||
#endif
|
||||
}
|
||||
|
||||
VkAccessFlags
|
||||
vk_csci_get_barrier_access_mask(enum xrt_swapchain_usage_bits bits)
|
||||
{
|
||||
|
|
|
@ -1087,10 +1087,18 @@ vk_create_compute_pipeline(struct vk_bundle *vk,
|
|||
|
||||
/*
|
||||
*
|
||||
* Compositor swapchain image flags helpers, in the vk_compositor_flags.c file.
|
||||
* Compositor buffer and swapchain image flags helpers, in the vk_compositor_flags.c file.
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Return the extern handle type that a buffer should be created with.
|
||||
*
|
||||
* cb = Compositor Buffer.
|
||||
*/
|
||||
VkExternalMemoryHandleTypeFlags
|
||||
vk_cb_get_buffer_external_handle_type(struct vk_bundle *vk);
|
||||
|
||||
/*!
|
||||
* Helper for all of the supported formats to check support for.
|
||||
*
|
||||
|
@ -1217,6 +1225,7 @@ vk_csci_get_image_external_support(struct vk_bundle *vk,
|
|||
bool *out_importable,
|
||||
bool *out_exportable);
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Sync objects, in the vk_sync_objects.c file.
|
||||
|
|
|
@ -159,13 +159,13 @@ render_buffer_init_exportable(struct vk_bundle *vk,
|
|||
|
||||
VkExternalMemoryBufferCreateInfo export_create_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO,
|
||||
.handleTypes = vk_csci_get_image_external_handle_type(vk),
|
||||
.handleTypes = vk_cb_get_buffer_external_handle_type(vk),
|
||||
};
|
||||
|
||||
VkExportMemoryAllocateInfo export_alloc_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR,
|
||||
.pNext = NULL,
|
||||
.handleTypes = vk_csci_get_image_external_handle_type(vk),
|
||||
.handleTypes = vk_cb_get_buffer_external_handle_type(vk),
|
||||
};
|
||||
|
||||
ret = create_buffer(vk, //
|
||||
|
|
Loading…
Reference in a new issue