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_device.c | |
parent | c302f8fa7c7b8219118eb73099da5540df49b775 (diff) |
anv: Implement VK_KHR_bind_memory2
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_device.c')
-rw-r--r-- | src/intel/vulkan/anv_device.c | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 8e2ed9eac45..233dd39015b 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -1863,23 +1863,48 @@ void anv_GetDeviceMemoryCommitment( *pCommittedMemoryInBytes = 0; } -VkResult anv_BindBufferMemory( - VkDevice device, - VkBuffer _buffer, - VkDeviceMemory _memory, - VkDeviceSize memoryOffset) +static void +anv_bind_buffer_memory(const VkBindBufferMemoryInfoKHR *pBindInfo) { - ANV_FROM_HANDLE(anv_device_memory, mem, _memory); - ANV_FROM_HANDLE(anv_buffer, buffer, _buffer); + ANV_FROM_HANDLE(anv_device_memory, mem, pBindInfo->memory); + ANV_FROM_HANDLE(anv_buffer, buffer, pBindInfo->buffer); + + assert(pBindInfo->sType == VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR); if (mem) { assert((buffer->usage & mem->type->valid_buffer_usage) == buffer->usage); buffer->bo = mem->bo; - buffer->offset = memoryOffset; + buffer->offset = pBindInfo->memoryOffset; } else { buffer->bo = NULL; buffer->offset = 0; } +} + +VkResult anv_BindBufferMemory( + VkDevice device, + VkBuffer buffer, + VkDeviceMemory memory, + VkDeviceSize memoryOffset) +{ + anv_bind_buffer_memory( + &(VkBindBufferMemoryInfoKHR) { + .sType = VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR, + .buffer = buffer, + .memory = memory, + .memoryOffset = memoryOffset, + }); + + return VK_SUCCESS; +} + +VkResult anv_BindBufferMemory2KHR( + VkDevice device, + uint32_t bindInfoCount, + const VkBindBufferMemoryInfoKHR* pBindInfos) +{ + for (uint32_t i = 0; i < bindInfoCount; i++) + anv_bind_buffer_memory(&pBindInfos[i]); return VK_SUCCESS; } |