From c75db6047804c4e2df5b5f569d7b6e7885432c14 Mon Sep 17 00:00:00 2001 From: Simon Zeni Date: Fri, 3 Nov 2023 09:57:06 -0400 Subject: [PATCH] c/main: Name Vulkan objects --- .../compositor/main/comp_mirror_to_debug_gui.c | 18 ++++++++++++++++++ .../compositor/main/comp_target_swapchain.c | 10 ++++++++++ src/xrt/compositor/main/comp_window_android.c | 1 + src/xrt/compositor/main/comp_window_direct.c | 1 + src/xrt/compositor/main/comp_window_mswin.c | 1 + src/xrt/compositor/main/comp_window_peek.c | 4 ++++ src/xrt/compositor/main/comp_window_wayland.c | 1 + src/xrt/compositor/main/comp_window_xcb.c | 1 + 8 files changed, 37 insertions(+) diff --git a/src/xrt/compositor/main/comp_mirror_to_debug_gui.c b/src/xrt/compositor/main/comp_mirror_to_debug_gui.c index 5990a6d85..b535e0998 100644 --- a/src/xrt/compositor/main/comp_mirror_to_debug_gui.c +++ b/src/xrt/compositor/main/comp_mirror_to_debug_gui.c @@ -184,6 +184,8 @@ ensure_scratch(struct comp_mirror_to_debug_gui *m, struct vk_bundle *vk) return false; } + VK_NAME_OBJECT(vk, IMAGE_VIEW, m->bounce.unorm_view, "comp_mirror_debug_to_gui image view bounce.unorm_view"); + return true; } @@ -297,6 +299,8 @@ comp_mirror_init(struct comp_mirror_to_debug_gui *m, return ret; } + VK_NAME_OBJECT(vk, COMMAND_POOL, m->cmd_pool.pool, "comp_mirror_to_debug_gui command pool"); + struct vk_descriptor_pool_info blit_pool_info = { .uniform_per_descriptor_count = 0, .sampler_per_descriptor_count = 1, @@ -311,16 +315,24 @@ comp_mirror_init(struct comp_mirror_to_debug_gui *m, &blit_pool_info, // info &m->blit.descriptor_pool)); // out_descriptor_pool + VK_NAME_OBJECT(vk, DESCRIPTOR_POOL, m->blit.descriptor_pool, "comp_mirror_to_debug_ui blit descriptor pool"); C(vk_create_pipeline_cache(vk, &m->blit.pipeline_cache)); + VK_NAME_OBJECT(vk, PIPELINE_CACHE, m->blit.pipeline_cache, "comp_mirror_to_debug_ui blit pipeline cache"); + C(create_blit_descriptor_set_layout(vk, &m->blit.descriptor_set_layout)); + VK_NAME_OBJECT(vk, DESCRIPTOR_SET_LAYOUT, m->blit.descriptor_set_layout, + "comp_mirror_to_debug_ui blit descriptor set layout"); + C(create_blit_pipeline_layout( // vk, // vk_bundle m->blit.descriptor_set_layout, // descriptor_set_layout &m->blit.pipeline_layout)); // out_pipeline_layout + VK_NAME_OBJECT(vk, PIPELINE_LAYOUT, m->blit.pipeline_layout, "comp_mirror_to_debug_ui blit pipeline layout"); + C(vk_create_compute_pipeline( // vk, // vk_bundle m->blit.pipeline_cache, // pipeline_cache @@ -329,6 +341,8 @@ comp_mirror_init(struct comp_mirror_to_debug_gui *m, NULL, // specialization_info &m->blit.pipeline)); // out_compute_pipeline + VK_NAME_OBJECT(vk, PIPELINE, m->blit.pipeline, "comp_mirror_to_debug_ui blit pipeline"); + return VK_SUCCESS; } @@ -432,6 +446,8 @@ comp_mirror_do_blit(struct comp_mirror_to_debug_gui *m, return; } + VK_NAME_OBJECT(vk, DESCRIPTOR_SET, descriptor_set, "comp_mirror_to_debug_ui blit descriptor set"); + struct vk_cmd_pool *pool = &m->cmd_pool; // For writing and submitting commands. @@ -445,6 +461,8 @@ comp_mirror_do_blit(struct comp_mirror_to_debug_gui *m, return; } + VK_NAME_OBJECT(vk, COMMAND_BUFFER, cmd, "comp_mirror_to_debug_ui command buffer"); + // Barrier arguments. VkImageSubresourceRange first_color_level_subresource_range = { .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, diff --git a/src/xrt/compositor/main/comp_target_swapchain.c b/src/xrt/compositor/main/comp_target_swapchain.c index 643a30674..7c9cfcd85 100644 --- a/src/xrt/compositor/main/comp_target_swapchain.c +++ b/src/xrt/compositor/main/comp_target_swapchain.c @@ -129,6 +129,9 @@ create_image_views(struct comp_target_swapchain *cts) cts->surface.format.format, // format subresource_range, // subresource_range &cts->base.images[i].view); // out_view + + + VK_NAME_OBJECT(vk, IMAGE_VIEW, cts->base.images[i].view, "comp_target_swapchain image view"); } free(images); @@ -601,11 +604,17 @@ target_init_semaphores(struct comp_target_swapchain *cts) COMP_ERROR(cts->base.c, "vkCreateSemaphore: %s", vk_result_string(ret)); } + VK_NAME_OBJECT(vk, SEMAPHORE, cts->base.semaphores.present_complete, + "comp_target_swapchain semaphore present complete"); + cts->base.semaphores.render_complete_is_timeline = false; ret = vk->vkCreateSemaphore(vk->device, &info, NULL, &cts->base.semaphores.render_complete); if (ret != VK_SUCCESS) { COMP_ERROR(cts->base.c, "vkCreateSemaphore: %s", vk_result_string(ret)); } + + VK_NAME_OBJECT(vk, SEMAPHORE, cts->base.semaphores.render_complete, + "comp_target_swapchain semaphore render complete"); } @@ -782,6 +791,7 @@ comp_target_swapchain_create_images(struct comp_target *ct, return; } + VK_NAME_OBJECT(vk, SWAPCHAIN_KHR, cts->swapchain.handle, "comp_target_swapchain swapchain"); /* * Set target info. diff --git a/src/xrt/compositor/main/comp_window_android.c b/src/xrt/compositor/main/comp_window_android.c index 3a55a7bee..8f98a1a5e 100644 --- a/src/xrt/compositor/main/comp_window_android.c +++ b/src/xrt/compositor/main/comp_window_android.c @@ -125,6 +125,7 @@ comp_window_android_create_surface(struct comp_window_android *cwa, return ret; } + VK_NAME_OBJECT(vk, SURFACE_KHR, surface, "comp_window_android surface"); *out_surface = surface; return VK_SUCCESS; diff --git a/src/xrt/compositor/main/comp_window_direct.c b/src/xrt/compositor/main/comp_window_direct.c index 4b463e9b0..3cda95125 100644 --- a/src/xrt/compositor/main/comp_window_direct.c +++ b/src/xrt/compositor/main/comp_window_direct.c @@ -268,6 +268,7 @@ comp_window_direct_create_surface(struct comp_target_swapchain *cts, return ret; } + VK_NAME_OBJECT(get_vk(cts), SURFACE_KHR, surface, "comp_target_swapchain direct surface"); cts->surface.handle = surface; return VK_SUCCESS; diff --git a/src/xrt/compositor/main/comp_window_mswin.c b/src/xrt/compositor/main/comp_window_mswin.c index c09a0cc0d..63c334a5d 100644 --- a/src/xrt/compositor/main/comp_window_mswin.c +++ b/src/xrt/compositor/main/comp_window_mswin.c @@ -167,6 +167,7 @@ comp_window_mswin_create_surface(struct comp_window_mswin *w, VkSurfaceKHR *out_ return ret; } + VK_NAME_OBJECT(vk, SURFACE_KHR, surface, "comp_window_mswin surface"); *out_surface = surface; return VK_SUCCESS; diff --git a/src/xrt/compositor/main/comp_window_peek.c b/src/xrt/compositor/main/comp_window_peek.c index 038bc82bb..a713600b0 100644 --- a/src/xrt/compositor/main/comp_window_peek.c +++ b/src/xrt/compositor/main/comp_window_peek.c @@ -152,12 +152,16 @@ comp_window_peek_create(struct comp_compositor *c) goto err_free; } + VK_NAME_OBJECT(vk, COMMAND_POOL, w->pool.pool, "comp_window_peek command pool"); + ret = vk_cmd_pool_create_cmd_buffer(vk, &w->pool, &w->cmd); if (ret != VK_SUCCESS) { COMP_ERROR(c, "vk_cmd_pool_create_cmd_buffer: %s", vk_result_string(ret)); goto err_pool; } + VK_NAME_OBJECT(vk, COMMAND_BUFFER, w->cmd, "comp_window_peek command buffer"); + /* * SDL diff --git a/src/xrt/compositor/main/comp_window_wayland.c b/src/xrt/compositor/main/comp_window_wayland.c index 9e66ed179..eebda8fb1 100644 --- a/src/xrt/compositor/main/comp_window_wayland.c +++ b/src/xrt/compositor/main/comp_window_wayland.c @@ -238,6 +238,7 @@ comp_window_wayland_create_surface(struct comp_window_wayland *w, VkSurfaceKHR * return ret; } + VK_NAME_OBJECT(vk, SURFACE_KHR, surface, "comp_window_wayland surface"); *out_surface = surface; return VK_SUCCESS; diff --git a/src/xrt/compositor/main/comp_window_xcb.c b/src/xrt/compositor/main/comp_window_xcb.c index aad93891b..a8732d096 100644 --- a/src/xrt/compositor/main/comp_window_xcb.c +++ b/src/xrt/compositor/main/comp_window_xcb.c @@ -423,6 +423,7 @@ comp_window_xcb_create_surface(struct comp_window_xcb *w, VkSurfaceKHR *out_surf return ret; } + VK_NAME_OBJECT(vk, SURFACE_KHR, surface, "comp_window_xcb surface"); *out_surface = surface; return VK_SUCCESS;