mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
tu: Move tu_BindImageMemory2() to tu_image.cc
To match ANV, RADV and NVK. Signed-off-by: Valentine Burley <valentine.burley@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28307>
This commit is contained in:
parent
295fa01db8
commit
06d277c1bd
2 changed files with 41 additions and 41 deletions
|
|
@ -2977,47 +2977,6 @@ tu_BindBufferMemory2(VkDevice device,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
tu_BindImageMemory2(VkDevice _device,
|
||||
uint32_t bindInfoCount,
|
||||
const VkBindImageMemoryInfo *pBindInfos)
|
||||
{
|
||||
TU_FROM_HANDLE(tu_device, device, _device);
|
||||
|
||||
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->iova = mem->bo->iova + pBindInfos[i].memoryOffset;
|
||||
|
||||
if (image->vk.usage & VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT) {
|
||||
if (!mem->bo->map) {
|
||||
VkResult result = tu_bo_map(device, mem->bo);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
}
|
||||
|
||||
image->map = (char *)mem->bo->map + pBindInfos[i].memoryOffset;
|
||||
} else {
|
||||
image->map = NULL;
|
||||
}
|
||||
#ifdef HAVE_PERFETTO
|
||||
tu_perfetto_log_bind_image(device, image);
|
||||
#endif
|
||||
} else {
|
||||
image->bo = NULL;
|
||||
image->map = NULL;
|
||||
image->iova = 0;
|
||||
}
|
||||
|
||||
TU_RMV(image_bind, device, image);
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
tu_QueueBindSparse(VkQueue _queue,
|
||||
uint32_t bindInfoCount,
|
||||
|
|
|
|||
|
|
@ -774,6 +774,47 @@ tu_DestroyImage(VkDevice _device,
|
|||
vk_object_free(&device->vk, pAllocator, image);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
tu_BindImageMemory2(VkDevice _device,
|
||||
uint32_t bindInfoCount,
|
||||
const VkBindImageMemoryInfo *pBindInfos)
|
||||
{
|
||||
TU_FROM_HANDLE(tu_device, device, _device);
|
||||
|
||||
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->iova = mem->bo->iova + pBindInfos[i].memoryOffset;
|
||||
|
||||
if (image->vk.usage & VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT) {
|
||||
if (!mem->bo->map) {
|
||||
VkResult result = tu_bo_map(device, mem->bo);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
}
|
||||
|
||||
image->map = (char *)mem->bo->map + pBindInfos[i].memoryOffset;
|
||||
} else {
|
||||
image->map = NULL;
|
||||
}
|
||||
#ifdef HAVE_PERFETTO
|
||||
tu_perfetto_log_bind_image(device, image);
|
||||
#endif
|
||||
} else {
|
||||
image->bo = NULL;
|
||||
image->map = NULL;
|
||||
image->iova = 0;
|
||||
}
|
||||
|
||||
TU_RMV(image_bind, device, image);
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
tu_get_image_memory_requirements(struct tu_device *dev, struct tu_image *image,
|
||||
VkMemoryRequirements2 *pMemoryRequirements)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue