v3dv: implement vkBindBufferMemory

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
Iago Toral Quiroga 2019-12-09 10:40:32 +01:00 committed by Marge Bot
parent 5ee155043d
commit 582ebb040c
2 changed files with 27 additions and 0 deletions

View file

@ -1313,6 +1313,30 @@ v3dv_GetBufferMemoryRequirements(VkDevice _device,
align64(buffer->size, pMemoryRequirements->alignment);
}
VkResult
v3dv_BindBufferMemory(VkDevice _device,
VkBuffer _buffer,
VkDeviceMemory _memory,
VkDeviceSize memoryOffset)
{
V3DV_FROM_HANDLE(v3dv_device_memory, mem, _memory);
V3DV_FROM_HANDLE(v3dv_buffer, buffer, _buffer);
/* Valid usage:
*
* "memoryOffset must be an integer multiple of the alignment member of
* the VkMemoryRequirements structure returned from a call to
* vkGetBufferMemoryRequirements with buffer"
*/
assert(memoryOffset % buffer->alignment == 0);
assert(memoryOffset < mem->size);
buffer->mem = mem;
buffer->mem_offset = memoryOffset;
return VK_SUCCESS;
}
VkResult
v3dv_CreateBuffer(VkDevice _device,
const VkBufferCreateInfo *pCreateInfo,

View file

@ -299,6 +299,9 @@ struct v3dv_buffer {
VkDeviceSize size;
VkBufferUsageFlags usage;
uint32_t alignment;
struct v3dv_device_memory *mem;
VkDeviceSize mem_offset;
};
struct v3dv_shader_module {