Skip to content

icd: Translate handles in debug utils object info - #51

Open
dgkoch wants to merge 2 commits into
mainfrom
fix/debug-utils-object-handle-translation
Open

icd: Translate handles in debug utils object info#51
dgkoch wants to merge 2 commits into
mainfrom
fix/debug-utils-object-handle-translation

Conversation

@dgkoch

@dgkoch dgkoch commented Sep 9, 2026

Copy link
Copy Markdown

Device::SetDebugUtilsObjectNameEXT and SetDebugUtilsObjectTagEXT forwarded the object info
structure to the underlying implementation unchanged, so objectHandle reached it as an emulation ICD
wrapper rather than a handle it owns. The loader does not correct this. The first commit translates
the wrapped dispatchable object types before forwarding.

The second commit adds a test that the physical device, device, queue and command buffer handles
arriving at the underlying implementation are the unwrapped ones, for both names and tags. It runs in
the configurations where the underlying implementation supports VK_EXT_debug_utils and skips
otherwise. VK_OBJECT_TYPE_INSTANCE is not covered because the loader replaces the instance handle
with its own regardless of what the ICD passes.

The code and tests in this PR were written with Claude (Anthropic).

Dispatchable objects are wrapped by the emulation ICD, so a handle the
application uses is not the handle of the corresponding object in the
underlying Vulkan implementation. SetDebugUtilsObjectNameEXT and
SetDebugUtilsObjectTagEXT forwarded the object info structure
unchanged, so the underlying implementation received a handle it does
not own.

Translate the handle of the wrapped dispatchable object types before
forwarding.
No test called the debug utils object naming or tagging entry points,
so nothing observed which handle reached the underlying implementation.

Add a test checking that the physical device, device, queue and command
buffer handles arriving at the underlying implementation are the
unwrapped ones, for both names and tags. The object info is only
forwarded if the underlying implementation supports VK_EXT_debug_utils,
which the Vulkan loader always reports, so the test runs in the
configurations using it.

Instance handles are not covered because the Vulkan loader replaces
them with its own before the underlying implementation sees them,
whether the emulation ICD translated them or not.
@dgkoch
dgkoch requested a review from aqnuep September 9, 2026 04:48
@aqnuep

aqnuep commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

The issue triggering this PR is indeed valid, but I cannot accept code with the signature style of Claude using free-standing anonymous namespace functions, as it's ugly and does not even fit the style of the rest of the code base.

I would prefer issues being raised instead of such PRs because it takes much less time to write the code than getting Claude to produce the code in the appropriate style/architecture.

@aqnuep

aqnuep commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Btw, it's an interesting question why this isn't caught by CTS. I think there ought to be some CTS test that actually verifies the correct behavior of these commands.

@aqnuep

aqnuep commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

This would deserve a generic, future proof solution, which, in theory, should be doable because vk.xml does have the objecttype attribute as markup for cases where translation may have to happen. Unfortunately, vulkan_object does not handle that attribute yet, so an immediate fix would probably have to be a similar hard-coded one like this or now...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants