turnip: preliminary support for tu_BindImageMemory2
authorChia-I Wu <olvaffe@gmail.com>
Thu, 10 Jan 2019 19:51:39 +0000 (11:51 -0800)
committerChia-I Wu <olvaffe@gmail.com>
Mon, 11 Mar 2019 17:01:41 +0000 (10:01 -0700)
src/freedreno/vulkan/tu_device.c
src/freedreno/vulkan/tu_private.h

index 0ace4f1a771ff7952dfd55b20fea4742a6a100f0..7360e58cd74aa95911d363a6d69841bf6f8dc2c7 100644 (file)
@@ -1552,8 +1552,21 @@ tu_BindBufferMemory(VkDevice device,
 VkResult
 tu_BindImageMemory2(VkDevice device,
                     uint32_t bindInfoCount,
-                    const VkBindImageMemoryInfoKHR *pBindInfos)
-{
+                    const VkBindImageMemoryInfo *pBindInfos)
+{
+   for (uint32_t i = 0; i < bindInfoCount; ++i) {
+      TU_FROM_HANDLE(tu_image, image, pBindInfos[i].image);
+      TU_FROM_HANDLE(tu_device_memory, mem, pBindInfos[i].memory);
+
+      if (mem) {
+         image->bo = &mem->bo;
+         image->bo_offset = pBindInfos[i].memoryOffset;
+      } else {
+         image->bo = NULL;
+         image->bo_offset = 0;
+      }
+   }
+
    return VK_SUCCESS;
 }
 
@@ -1563,7 +1576,7 @@ tu_BindImageMemory(VkDevice device,
                    VkDeviceMemory memory,
                    VkDeviceSize memoryOffset)
 {
-   const VkBindImageMemoryInfoKHR info = {
+   const VkBindImageMemoryInfo info = {
       .sType = VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR,
       .image = image,
       .memory = memory,
index cce99181e266c82417c8fb6b01144f2ad8cb1669..4f593c9978fd4a5d320ea2e1448939193fed60be 100644 (file)
@@ -956,6 +956,10 @@ struct tu_image
 
    /* For VK_ANDROID_native_buffer, the WSI image owns the memory, */
    VkDeviceMemory owned_memory;
+
+   /* Set when bound */
+   const struct tu_bo *bo;
+   VkDeviceSize bo_offset;
 };
 
 unsigned