diff options
author | Chia-I Wu <[email protected]> | 2019-01-10 11:51:39 -0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2019-03-11 10:01:41 -0700 |
commit | 992ecdd40ebc2e027b39f98a92bdab953eedd5d5 (patch) | |
tree | 04b06ffd6f4af78ab2b55d59d3bd52f397f74f36 | |
parent | ef49b07b83dc527dfdeb7ac9252c853cb67b086b (diff) |
turnip: preliminary support for tu_BindImageMemory2
-rw-r--r-- | src/freedreno/vulkan/tu_device.c | 19 | ||||
-rw-r--r-- | src/freedreno/vulkan/tu_private.h | 4 |
2 files changed, 20 insertions, 3 deletions
diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c index 0ace4f1a771..7360e58cd74 100644 --- a/src/freedreno/vulkan/tu_device.c +++ b/src/freedreno/vulkan/tu_device.c @@ -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, diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h index cce99181e26..4f593c9978f 100644 --- a/src/freedreno/vulkan/tu_private.h +++ b/src/freedreno/vulkan/tu_private.h @@ -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 |