Vulkan object names support for memory reports - #39
Draft
jimblacklercorp wants to merge 2 commits into
Draft
jimblacklercorp wants to merge 2 commits into
jimblacklercorp wants to merge 2 commits into
Conversation
The DebugMarker layer owned the only record of which Vulkan objects the application has named. The DeviceMemoryReport layer needs the same information to attribute memory to a named buffer or image, and duplicating the bookkeeping would let the two drift apart on what a name is and when it changes. Move the (VkObjectType, handle) -> name store, the legacy VkDebugReportObjectTypeEXT mapping and the session-start replay into layersvt::VulkanObjectNames. No behaviour change for DebugMarker: it emits the same VulkanApiEvent.VkDebugUtilsObjectName packets, at the same points, with the same ordering guarantees. Each layer declares its own perfetto::TrackEvent data source via PERFETTO_DEFINE_CATEGORIES, so perfetto::TrackEvent is a distinct type per layer and the component cannot call it directly. EmitVulkanObjectName is therefore declared here and defined by each layer, which also keeps the component free of any Perfetto dependency and lets the new test_ObjectNames run without Perfetto or the Vulkan loader. The store's mutex is deliberately held across emission so that emit order matches store order, preventing a concurrent replay from overwriting a newer name with an older one. This preserves the previous behaviour. One hardening change: SetObjectName now tolerates a null name_info, which the old code dereferenced unconditionally.
Memory counters are only actionable if the buffers and images behind them can be identified, so the layer now observes vkSetDebugUtilsObjectNameEXT and vkDebugMarkerSetObjectNameEXT and publishes the names the application sets. Storage, the legacy VkDebugReportObjectTypeEXT mapping and the session-start replay come from layersvt::VulkanObjectNames, shared with DebugMarker. The two layers deliberately emit different events, which is worth stating plainly because it looks like an inconsistency to fix. DebugMarker writes VulkanApiEvent.VkDebugUtilsObjectName packets. Perfetto's trace_processor folds those into an internal map (debug_marker_names_ in gpu_event_parser.cc) and reads it back for exactly three object types: render pass, render target and command buffer, being the handles a GpuRenderStageEvent carries. A name on a VkBuffer or VkImage in that form is parsed and then never surfaced, because nothing joins to it and the map is not exposed as a table. This layer therefore emits "VulkanObjectName" instant events carrying object_type, object_handle and object_name. Those reach the slice table and can be joined to the memory events by object handle, which is what a consumer of this layer's output actually needs. Because the events differ, loading both layers duplicates neither. Unlike DebugMarker, this layer does not claim VK_EXT_debug_utils or VK_EXT_debug_marker. It only intercepts these entry points when the driver below already implements them, which the existing down_func == nullptr guard in vkGetDeviceProcAddr and vkGetInstanceProcAddr enforces.
jimblacklercorp
marked this pull request as draft
September 22, 2026 00:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change allows the memory report layer to output Vulkan object names without duplicating logic from the existing debug marker layer. Memory reports cannot use the existing debug marker layer as a source of data because that layer publishes names as VulkanApiEvent.VkDebugUtilsObjectName packets, which Perfetto's trace_processor folds into a private in-memory map and never exposes as a table.