diff options
| author | mrp1no <137657338+mrp1no@users.noreply.github.com> | 2026-11-22 19:24:07 +0100 |
|---|---|---|
| committer | mrp1no <137657338+mrp1no@users.noreply.github.com> | 2026-11-22 19:24:07 +0100 |
| commit | 55a073183e15b461b1c4e059308d9bc25b44cdb8 (patch) | |
| tree | 369c8f3147ef1927fa4ec1a9d52524d861da922e /runtime/test | |
| parent | b0a9c16d216acee1738ec561c51db972f319f00d (diff) | |
d3d12: SetName is readable as WKPDID_D3DDebugObjectNameW, with the right GUID
@pwu2775-dev found on #2533 that the tests' WKPDID_D3DDebugObjectNameW was
mistyped ({4cca5fd8-921f-42c8-8599-d2866a3e5f7e}, the layer's old constant)
instead of d3dcommon.h's {4cca5fd8-921f-42c8-8566-70caf2a9b741}. Measured with
the right key, the host runtime does what D3D12 documents: SetName is
SetPrivateData with that key and the name with its terminator, GetPrivateData
reads it back (an empty name is a 2-byte entry), and the narrow key is not
touched. SetName(nullptr) faults in the host and leaves the name as it was.
So the name goes back into the private data, now under the right GUID, and the
separate name_ / debug_name() are gone. SetName(nullptr) answers E_INVALIDARG
and changes nothing. d3d12_private_data_test: 667 steps compared, 0 mismatches
(RTX 3060, driver 610.88); d3d12_debug_markers_test checks the name again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test')
| -rw-r--r-- | runtime/test/d3d12_debug_markers_test.cpp | 16 | ||||
| -rw-r--r-- | runtime/test/d3d12_private_data_test.cpp | 2 |
2 files changed, 11 insertions, 7 deletions
diff --git a/runtime/test/d3d12_debug_markers_test.cpp b/runtime/test/d3d12_debug_markers_test.cpp index 1be8fffed..a87fd030f 100644 --- a/runtime/test/d3d12_debug_markers_test.cpp +++ b/runtime/test/d3d12_debug_markers_test.cpp | |||
| @@ -186,7 +186,7 @@ struct Counted final : IUnknown { | |||
| 186 | constexpr GUID kKey{0xd3d24a01, 0x0000, 0x4000, {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}}; | 186 | constexpr GUID kKey{0xd3d24a01, 0x0000, 0x4000, {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}}; |
| 187 | constexpr GUID kOtherKey{0xd3d24a01, 0x0000, 0x4000, {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}}; | 187 | constexpr GUID kOtherKey{0xd3d24a01, 0x0000, 0x4000, {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}}; |
| 188 | // WKPDID_D3DDebugObjectNameW (d3dcommon.h). | 188 | // WKPDID_D3DDebugObjectNameW (d3dcommon.h). |
| 189 | constexpr GUID kDebugObjectNameW{0x4cca5fd8, 0x921f, 0x42c8, {0x85, 0x99, 0xd2, 0x86, 0x6a, 0x3e, 0x5f, 0x7e}}; | 189 | constexpr GUID kDebugObjectNameW{0x4cca5fd8, 0x921f, 0x42c8, {0x85, 0x66, 0x70, 0xca, 0xf2, 0xa9, 0xb7, 0x41}}; |
| 190 | 190 | ||
| 191 | int check_private_data(ID3D12Object* object, const char* what) { | 191 | int check_private_data(ID3D12Object* object, const char* what) { |
| 192 | std::printf("private data: %s\n", what); | 192 | std::printf("private data: %s\n", what); |
| @@ -230,13 +230,17 @@ int check_private_data(ID3D12Object* object, const char* what) { | |||
| 230 | EXPECT(object->SetPrivateData(kKey, 0, nullptr) == S_OK); | 230 | EXPECT(object->SetPrivateData(kKey, 0, nullptr) == S_OK); |
| 231 | EXPECT(object->GetPrivateData(kKey, &size, nullptr) == DXGI_ERROR_NOT_FOUND && size == 0); | 231 | EXPECT(object->GetPrivateData(kKey, &size, nullptr) == DXGI_ERROR_NOT_FOUND && size == 0); |
| 232 | 232 | ||
| 233 | // SetName is not readable through GetPrivateData, as on the host runtime: WKPDID_D3DDebugObjectNameW stays | 233 | // SetName is readable as WKPDID_D3DDebugObjectNameW, terminator included, as on the host runtime. A null name |
| 234 | // missing. A null name (which the host faults on) clears it. | 234 | // (which the host faults on) changes nothing. |
| 235 | const wchar_t name[] = L"leonida object"; | 235 | const wchar_t name[] = L"leonida object"; |
| 236 | EXPECT(object->SetName(name) == S_OK); | 236 | EXPECT(object->SetName(name) == S_OK); |
| 237 | size = 0; | 237 | wchar_t stored[32] = {}; |
| 238 | EXPECT(object->GetPrivateData(kDebugObjectNameW, &size, nullptr) == DXGI_ERROR_NOT_FOUND && size == 0); | 238 | size = sizeof(stored); |
| 239 | EXPECT(object->SetName(nullptr) == S_OK); | 239 | EXPECT(object->GetPrivateData(kDebugObjectNameW, &size, stored) == S_OK); |
| 240 | EXPECT(size == sizeof(name) && std::wcscmp(stored, name) == 0); | ||
| 241 | EXPECT(object->SetName(nullptr) == E_INVALIDARG); | ||
| 242 | size = sizeof(stored); | ||
| 243 | EXPECT(object->GetPrivateData(kDebugObjectNameW, &size, stored) == S_OK && size == sizeof(name)); | ||
| 240 | 244 | ||
| 241 | // Left set: released when the object dies (checked for a fence below). | 245 | // Left set: released when the object dies (checked for a fence below). |
| 242 | EXPECT(object->SetPrivateDataInterface(kOtherKey, nullptr) == S_OK); | 246 | EXPECT(object->SetPrivateDataInterface(kOtherKey, nullptr) == S_OK); |
diff --git a/runtime/test/d3d12_private_data_test.cpp b/runtime/test/d3d12_private_data_test.cpp index 4c1848a9c..8acacb049 100644 --- a/runtime/test/d3d12_private_data_test.cpp +++ b/runtime/test/d3d12_private_data_test.cpp | |||
| @@ -51,7 +51,7 @@ public: | |||
| 51 | 51 | ||
| 52 | // WKPDID_D3DDebugObjectName / ...NameW (d3dcommon.h), spelled out so nothing needs dxguid.lib. | 52 | // WKPDID_D3DDebugObjectName / ...NameW (d3dcommon.h), spelled out so nothing needs dxguid.lib. |
| 53 | constexpr GUID kName{0x429b8c22, 0x9188, 0x4b0c, {0x87, 0x42, 0xac, 0xb0, 0xbf, 0x85, 0xc2, 0x00}}; | 53 | constexpr GUID kName{0x429b8c22, 0x9188, 0x4b0c, {0x87, 0x42, 0xac, 0xb0, 0xbf, 0x85, 0xc2, 0x00}}; |
| 54 | constexpr GUID kNameW{0x4cca5fd8, 0x921f, 0x42c8, {0x85, 0x99, 0xd2, 0x86, 0x6a, 0x3e, 0x5f, 0x7e}}; | 54 | constexpr GUID kNameW{0x4cca5fd8, 0x921f, 0x42c8, {0x85, 0x66, 0x70, 0xca, 0xf2, 0xa9, 0xb7, 0x41}}; |
| 55 | 55 | ||
| 56 | // A key of its own for each step, so no step sees another's entry. | 56 | // A key of its own for each step, so no step sees another's entry. |
| 57 | GUID key(unsigned step) { return GUID{0x5eed0000u + step, 0x1d3d, 0x4c12, {0x9a, 0x41, 0x77, 0x10, 0x2b, 0x6c, 0x00, 0x01}}; } | 57 | GUID key(unsigned step) { return GUID{0x5eed0000u + step, 0x1d3d, 0x4c12, {0x9a, 0x41, 0x77, 0x10, 0x2b, 0x6c, 0x00, 0x01}}; } |