nvk: add bind buffer memory

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
Dave Airlie 2022-05-29 08:14:51 +10:00 committed by Marge Bot
parent 12e8ea2630
commit 787fbe85b9
2 changed files with 19 additions and 0 deletions

View file

@ -1,6 +1,7 @@
#include "nvk_buffer.h"
#include "nvk_device.h"
#include "nvk_device_memory.h"
#include "nvk_physical_device.h"
VKAPI_ATTR VkResult VKAPI_CALL nvk_CreateBuffer(VkDevice _device,
@ -55,3 +56,17 @@ VKAPI_ATTR void VKAPI_CALL nvk_GetBufferMemoryRequirements2(
}
}
}
VKAPI_ATTR VkResult VKAPI_CALL
nvk_BindBufferMemory2(VkDevice _device, uint32_t bindInfoCount,
const VkBindBufferMemoryInfo *pBindInfos)
{
for (uint32_t i = 0; i < bindInfoCount; ++i) {
VK_FROM_HANDLE(nvk_device_memory, mem, pBindInfos[i].memory);
VK_FROM_HANDLE(nvk_buffer, buffer, pBindInfos[i].buffer);
buffer->mem = mem;
buffer->offset = pBindInfos[i].memoryOffset;
}
return VK_SUCCESS;
}

View file

@ -5,8 +5,12 @@
#include "vulkan/runtime/vk_buffer.h"
struct nvk_device_memory;
struct nvk_buffer {
struct vk_buffer vk;
struct nvk_device_memory *mem;
VkDeviceSize offset;
};
VK_DEFINE_HANDLE_CASTS(nvk_buffer, vk.base, VkBuffer, VK_OBJECT_TYPE_BUFFER)