From 344898b091867e5450a3fa432a207d75255df77a Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 12 Oct 2022 14:51:13 -0700 Subject: Add gfx debug layer trampoline for D3D12 interfaces. (#2445) Co-authored-by: Yong He --- tools/gfx/debug-layer/debug-transient-heap.cpp | 48 +++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'tools/gfx/debug-layer/debug-transient-heap.cpp') diff --git a/tools/gfx/debug-layer/debug-transient-heap.cpp b/tools/gfx/debug-layer/debug-transient-heap.cpp index 91e575742..84861297a 100644 --- a/tools/gfx/debug-layer/debug-transient-heap.cpp +++ b/tools/gfx/debug-layer/debug-transient-heap.cpp @@ -12,6 +12,23 @@ using namespace Slang; namespace debug { +SlangResult DebugTransientResourceHeap::queryInterface(SlangUUID const& uuid, void** outObject) +{ + if (uuid == GfxGUID::IID_ISlangUnknown || uuid == GfxGUID::IID_ITransientResourceHeap) + *outObject = static_cast(this); + if (uuid == GfxGUID::IID_ITransientResourceHeapD3D12) + { + RefPtr result = new DebugTransientResourceHeapD3D12(); + baseObject->queryInterface(uuid, (void**)result->baseObject.writeRef()); + returnComPtr((ITransientResourceHeapD3D12**)outObject, result); + return SLANG_OK; + } + else + { + return baseObject->queryInterface(uuid, outObject); + } +} + Result DebugTransientResourceHeap::synchronizeAndReset() { SLANG_GFX_API_FUNC; @@ -32,9 +49,38 @@ Result DebugTransientResourceHeap::createCommandBuffer(ICommandBuffer** outComma auto result = baseObject->createCommandBuffer(outObject->baseObject.writeRef()); if (SLANG_FAILED(result)) return result; - returnComPtr(outCommandBuffer, outObject); + outObject->queryInterface(SlangUUID SLANG_UUID_ICommandBuffer, (void**)outCommandBuffer); return result; } +SlangResult DebugTransientResourceHeapD3D12::queryInterface(SlangUUID const& uuid, void** outObject) +{ + if (uuid == GfxGUID::IID_ISlangUnknown || uuid == GfxGUID::IID_ITransientResourceHeapD3D12) + *outObject = static_cast(this); + if (uuid == GfxGUID::IID_ITransientResourceHeap) + { + RefPtr result = new DebugTransientResourceHeap(); + baseObject->queryInterface(uuid, (void**)result->baseObject.writeRef()); + returnComPtr((ITransientResourceHeap**)outObject, result); + return SLANG_OK; + } + else + { + return baseObject->queryInterface(uuid, outObject); + } +} + +Result DebugTransientResourceHeapD3D12::allocateTransientDescriptorTable( + DescriptorType type, + GfxCount count, + Offset& outDescriptorOffset, + void** outD3DDescriptorHeapHandle) +{ + SLANG_GFX_API_FUNC; + + return baseObject->allocateTransientDescriptorTable( + type, count, outDescriptorOffset, outD3DDescriptorHeapHandle); +} + } // namespace debug } // namespace gfx -- cgit v1.2.3