mirror of
https://github.com/libretro/RetroArch
synced 2025-01-28 06:35:23 +00:00
Automatically mark buffer/images/memory with names.
This commit is contained in:
parent
d9088dd2a9
commit
d6413f2a43
@ -377,19 +377,19 @@ static void vulkan_debug_mark_object(VkDevice device,
|
||||
void vulkan_debug_mark_buffer(VkDevice device, VkBuffer buffer)
|
||||
{
|
||||
static unsigned object_count;
|
||||
vulkan_debug_mark_object(device, VK_OBJECT_TYPE_BUFFER, (uint64_t)buffer, "marked buffer", ++object_count);
|
||||
vulkan_debug_mark_object(device, VK_OBJECT_TYPE_BUFFER, (uint64_t)buffer, "RetroArch buffer", ++object_count);
|
||||
}
|
||||
|
||||
void vulkan_debug_mark_image(VkDevice device, VkImage image)
|
||||
{
|
||||
static unsigned object_count;
|
||||
vulkan_debug_mark_object(device, VK_OBJECT_TYPE_IMAGE, (uint64_t)image, "marked image", ++object_count);
|
||||
vulkan_debug_mark_object(device, VK_OBJECT_TYPE_IMAGE, (uint64_t)image, "RetroArch image", ++object_count);
|
||||
}
|
||||
|
||||
void vulkan_debug_mark_memory(VkDevice device, VkDeviceMemory memory)
|
||||
{
|
||||
static unsigned object_count;
|
||||
vulkan_debug_mark_object(device, VK_OBJECT_TYPE_DEVICE_MEMORY, (uint64_t)memory, "marked memory", ++object_count);
|
||||
vulkan_debug_mark_object(device, VK_OBJECT_TYPE_DEVICE_MEMORY, (uint64_t)memory, "RetroArch memory", ++object_count);
|
||||
}
|
||||
|
||||
struct vk_texture vulkan_create_texture(vk_t *vk,
|
||||
@ -493,6 +493,7 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
|
||||
if (type != VULKAN_TEXTURE_STAGING && type != VULKAN_TEXTURE_READBACK)
|
||||
{
|
||||
vkCreateImage(device, &info, NULL, &tex.image);
|
||||
vulkan_debug_mark_image(device, tex.image);
|
||||
#if 0
|
||||
vulkan_track_alloc(tex.image);
|
||||
#endif
|
||||
@ -503,6 +504,7 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
|
||||
/* Linear staging textures are not guaranteed to be supported,
|
||||
* use buffers instead. */
|
||||
vkCreateBuffer(device, &buffer_info, NULL, &tex.buffer);
|
||||
vulkan_debug_mark_buffer(device, tex.buffer);
|
||||
vkGetBufferMemoryRequirements(device, tex.buffer, &mem_reqs);
|
||||
}
|
||||
alloc.allocationSize = mem_reqs.size;
|
||||
@ -548,6 +550,7 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
|
||||
|
||||
buffer_info.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
|
||||
vkCreateBuffer(device, &buffer_info, NULL, &tex.buffer);
|
||||
vulkan_debug_mark_buffer(device, tex.buffer);
|
||||
vkGetBufferMemoryRequirements(device, tex.buffer, &mem_reqs);
|
||||
|
||||
alloc.allocationSize = mem_reqs.size;
|
||||
@ -596,6 +599,7 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
|
||||
else
|
||||
{
|
||||
vkAllocateMemory(device, &alloc, NULL, &tex.memory);
|
||||
vulkan_debug_mark_memory(device, tex.memory);
|
||||
tex.memory_size = alloc.allocationSize;
|
||||
tex.memory_type = alloc.memoryTypeIndex;
|
||||
}
|
||||
@ -1173,6 +1177,7 @@ struct vk_buffer vulkan_create_buffer(
|
||||
info.queueFamilyIndexCount = 0;
|
||||
info.pQueueFamilyIndices = NULL;
|
||||
vkCreateBuffer(context->device, &info, NULL, &buffer.buffer);
|
||||
vulkan_debug_mark_buffer(context->device, buffer.buffer);
|
||||
|
||||
vkGetBufferMemoryRequirements(context->device, buffer.buffer, &mem_reqs);
|
||||
|
||||
@ -1185,6 +1190,7 @@ struct vk_buffer vulkan_create_buffer(
|
||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
|
||||
| VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
|
||||
vkAllocateMemory(context->device, &alloc, NULL, &buffer.memory);
|
||||
vulkan_debug_mark_memory(context->device, buffer.memory);
|
||||
vkBindBufferMemory(context->device, buffer.buffer, buffer.memory, 0);
|
||||
|
||||
buffer.size = size;
|
||||
|
@ -2816,6 +2816,7 @@ static bool vulkan_frame(void *data, const void *frame,
|
||||
image_info.initialLayout = VK_IMAGE_LAYOUT_GENERAL; /* VK_IMAGE_LAYOUT_UNDEFINED; */
|
||||
|
||||
vkCreateImage(vk->context->device, &image_info, NULL, &vk->main_buffer.image);
|
||||
vulkan_debug_mark_image(vk->context->device, vk->main_buffer.image);
|
||||
vkGetImageMemoryRequirements(vk->context->device, vk->main_buffer.image, &mem_reqs);
|
||||
alloc.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
|
||||
alloc.pNext = NULL;
|
||||
@ -2826,6 +2827,7 @@ static bool vulkan_frame(void *data, const void *frame,
|
||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
|
||||
|
||||
vkAllocateMemory(vk->context->device, &alloc, NULL, &vk->main_buffer.memory);
|
||||
vulkan_debug_mark_memory(vk->context->device, vk->main_buffer.memory);
|
||||
|
||||
vkBindImageMemory(vk->context->device, vk->main_buffer.image, vk->main_buffer.memory, 0);
|
||||
|
||||
|
@ -845,6 +845,7 @@ static std::unique_ptr<StaticTexture> vulkan_filter_chain_load_lut(
|
||||
image_info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
|
||||
vkCreateImage(info->device, &image_info, nullptr, &tex);
|
||||
vulkan_debug_mark_image(info->device, tex);
|
||||
vkGetImageMemoryRequirements(info->device, tex, &mem_reqs);
|
||||
|
||||
alloc.allocationSize = mem_reqs.size;
|
||||
@ -856,6 +857,7 @@ static std::unique_ptr<StaticTexture> vulkan_filter_chain_load_lut(
|
||||
if (vkAllocateMemory(info->device, &alloc, nullptr, &memory) != VK_SUCCESS)
|
||||
goto error;
|
||||
|
||||
vulkan_debug_mark_memory(info->device, memory);
|
||||
vkBindImageMemory(info->device, tex, memory, 0);
|
||||
|
||||
view_info.image = tex;
|
||||
@ -1703,6 +1705,7 @@ Buffer::Buffer(VkDevice device,
|
||||
| VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
|
||||
|
||||
vkAllocateMemory(device, &alloc, NULL, &memory);
|
||||
vulkan_debug_mark_memory(device, memory);
|
||||
vkBindBufferMemory(device, buffer, memory, 0);
|
||||
}
|
||||
|
||||
@ -2706,6 +2709,7 @@ void Framebuffer::init(DeferredDisposer *disposer)
|
||||
levels = info.mipLevels;
|
||||
|
||||
vkCreateImage(device, &info, nullptr, &image);
|
||||
vulkan_debug_mark_image(device, image);
|
||||
|
||||
vkGetImageMemoryRequirements(device, image, &mem_reqs);
|
||||
|
||||
@ -2731,6 +2735,7 @@ void Framebuffer::init(DeferredDisposer *disposer)
|
||||
memory.size = mem_reqs.size;
|
||||
|
||||
vkAllocateMemory(device, &alloc, nullptr, &memory.memory);
|
||||
vulkan_debug_mark_memory(device, memory.memory);
|
||||
}
|
||||
|
||||
vkBindImageMemory(device, image, memory.memory, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user