Skip to content

[Graphics] fix: a name given after creation reaches the debugger on Direct3D12 and Vulkan - #3558

Open
Nicogo1705 wants to merge 2 commits into
stride3d:masterfrom
Nicogo1705:graphics-debug-names-after-creation
Open

Nicogo1705 wants to merge 2 commits into
stride3d:masterfrom
Nicogo1705:graphics-debug-names-after-creation

Conversation

@Nicogo1705

Copy link
Copy Markdown
Contributor

PR Details

Setting Name on a resource after it is created now reaches the graphics debugger on Direct3D 12 and Vulkan, as it already does on Direct3D 11.

  • Direct3D 12: the debug name was set once, when the native object was attached. OnNameChanged now calls SetDebugName. SetDebugName uses the null-safe IsDebugMode.
  • Vulkan: OnNameChanged still held the 2018 DebugMarker code, commented out, so no object was ever named. It now calls vkSetDebugUtilsObjectNameEXT on the texture's image or the buffer when VK_EXT_debug_utils is enabled. Texture views are skipped, because they share the parent's image.

TestResourceDebugNames renames resources after creation:

  • On D3D12 it reads the name back with GetPrivateData(WKPDID_D3DDebugObjectNameW).
  • On Vulkan it triggers one validation report on the image and reads the report's object names through its own messenger. That error is allowed with [AllowGpuValidationError], and the test project references Vortice.Vulkan for the Vulkan build only.

Both tests fail without the fix, on software and hardware devices. One commit per backend.

Related Issue

None found.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

⚠️ Written with AI assistance (Claude Code), driven and verified by me; needs a real review. 🤖 Generated with Claude Code

Nicogo1705 and others added 2 commits October 10, 2026 15:15
…irect3D12

Direct3D 12 resources took their debug name once, when the native object was set, so a name given
afterwards (the usual case: create, then set Name) never reached PIX or the debug layer.
GraphicsResourceBase now forwards OnNameChanged to SetDebugName, as the Direct3D 11 backend does.

SetDebugName reads IsDebugMode instead of GraphicsDevice.IsDebugMode: it is now reached from a
name change, and the property is null-safe for a resource without a device.

Test: TestResourceDebugNames renames a texture and a buffer after creation and reads the name back
with GetPrivateData(WKPDID_D3DDebugObjectNameW); it fails without the fix (the name stays the
creation-time one), on WARP and on a hardware device.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…yer on Vulkan

The Vulkan backend never named its objects: OnNameChanged still held the 2018 DebugMarker code,
commented out. It now calls vkSetDebugUtilsObjectNameEXT on the texture's image or the buffer,
when VK_EXT_debug_utils is enabled (IsProfilingSupported). A texture view is skipped, since it
shares its parent's image and naming it would rename the parent.

Test: TestResourceDebugNames (Vulkan) renames a texture, provokes one validation report on its
image (vkGetImageSubresourceLayout on an optimal tiling image, allowed for this test) and reads
the object names of the report through its own debug utils messenger; it fails without the fix,
on Lavapipe and on a hardware device, and is skipped when the validation layer is missing. The
test project references Vortice.Vulkan for the Vulkan build only, for these native calls.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant