if (result != VK_SUCCESS)
return result;
+ if (wsi->set_memory_ownership) {
+ VkDeviceMemory mem = swapchain->get_wsi_image(swapchain, *pImageIndex)->memory;
+ wsi->set_memory_ownership(swapchain->device, mem, true);
+ }
+
if (pAcquireInfo->semaphore != VK_NULL_HANDLE &&
wsi->signal_semaphore_for_memory != NULL) {
struct wsi_image *image =
if (result != VK_SUCCESS)
goto fail_present;
+ if (wsi->set_memory_ownership) {
+ VkDeviceMemory mem = swapchain->get_wsi_image(swapchain, image_index)->memory;
+ wsi->set_memory_ownership(swapchain->device, mem, false);
+ }
+
fail_present:
if (pPresentInfo->pResults != NULL)
pPresentInfo->pResults[i] = result;
VkFence fence,
VkDeviceMemory memory);
+ /*
+ * This sets the ownership for a WSI memory object:
+ *
+ * The ownership is true if and only if the application is allowed to submit
+ * command buffers that reference the buffer.
+ *
+ * This can be used to prune BO lists without too many adverse affects on
+ * implicit sync.
+ *
+ * Side note: care needs to be taken for internally delayed submissions wrt
+ * timeline semaphores.
+ */
+ void (*set_memory_ownership)(VkDevice device,
+ VkDeviceMemory memory,
+ VkBool32 ownership);
+
#define WSI_CB(cb) PFN_vk##cb cb
WSI_CB(AllocateMemory);
WSI_CB(AllocateCommandBuffers);