turnip: Add buffer memory binding.
authorBas Nieuwenhuizen <basni@chromium.org>
Tue, 15 Jan 2019 21:54:15 +0000 (22:54 +0100)
committerChia-I Wu <olvaffe@gmail.com>
Mon, 11 Mar 2019 17:02:13 +0000 (10:02 -0700)
src/freedreno/vulkan/tu_device.c
src/freedreno/vulkan/tu_private.h

index 15bd924afe54d35b566445f95a3a9926ca4b39ad..598ed537fa3dc3f10ce0114f7ae9c29c005687a6 100644 (file)
@@ -1586,6 +1586,17 @@ tu_BindBufferMemory2(VkDevice device,
                      uint32_t bindInfoCount,
                      const VkBindBufferMemoryInfoKHR *pBindInfos)
 {
+   for (uint32_t i = 0; i < bindInfoCount; ++i) {
+      TU_FROM_HANDLE(tu_device_memory, mem, pBindInfos[i].memory);
+      TU_FROM_HANDLE(tu_buffer, buffer, pBindInfos[i].buffer);
+
+      if (mem) {
+         buffer->bo = &mem->bo;
+         buffer->bo_offset = pBindInfos[i].memoryOffset;
+      } else {
+         buffer->bo = NULL;
+      }
+   }
    return VK_SUCCESS;
 }
 
index 9b179f666cfa78eb509de1c17164bcef9e9aa038..c64d4ce49571092abb3f0ee4504b5e1136812e49 100644 (file)
@@ -632,6 +632,9 @@ struct tu_buffer
 
    VkBufferUsageFlags usage;
    VkBufferCreateFlags flags;
+
+   struct tu_bo *bo;
+   VkDeviceSize bo_offset;
 };
 
 enum tu_dynamic_state_bits