diff options
author | Jason Ekstrand <[email protected]> | 2017-07-18 09:02:53 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-09-18 07:33:59 -0700 |
commit | 52a89fedf2a2811ca5a06199eb171dea94a579e8 (patch) | |
tree | d34fe52b772cc80266700da28962a91651dd5ebc /src/intel/vulkan/anv_image.c | |
parent | c302f8fa7c7b8219118eb73099da5540df49b775 (diff) |
anv: Implement VK_KHR_bind_memory2
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_image.c')
-rw-r--r-- | src/intel/vulkan/anv_image.c | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 492b341303a..982461c82c8 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -421,23 +421,48 @@ anv_DestroyImage(VkDevice _device, VkImage _image, vk_free2(&device->alloc, pAllocator, image); } -VkResult anv_BindImageMemory( - VkDevice _device, - VkImage _image, - VkDeviceMemory _memory, - VkDeviceSize memoryOffset) +static void +anv_bind_image_memory(const VkBindImageMemoryInfoKHR *pBindInfo) { - ANV_FROM_HANDLE(anv_device_memory, mem, _memory); - ANV_FROM_HANDLE(anv_image, image, _image); + ANV_FROM_HANDLE(anv_device_memory, mem, pBindInfo->memory); + ANV_FROM_HANDLE(anv_image, image, pBindInfo->image); + + assert(pBindInfo->sType == VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR); if (mem == NULL) { image->bo = NULL; image->offset = 0; - return VK_SUCCESS; + return; } image->bo = mem->bo; - image->offset = memoryOffset; + image->offset = pBindInfo->memoryOffset; +} + +VkResult anv_BindImageMemory( + VkDevice device, + VkImage image, + VkDeviceMemory memory, + VkDeviceSize memoryOffset) +{ + anv_bind_image_memory( + &(VkBindImageMemoryInfoKHR) { + .sType = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR, + .image = image, + .memory = memory, + .memoryOffset = memoryOffset, + }); + + return VK_SUCCESS; +} + +VkResult anv_BindImageMemory2KHR( + VkDevice device, + uint32_t bindInfoCount, + const VkBindImageMemoryInfoKHR* pBindInfos) +{ + for (uint32_t i = 0; i < bindInfoCount; i++) + anv_bind_image_memory(&pBindInfos[i]); return VK_SUCCESS; } |