summaryrefslogtreecommitdiffstats
path: root/tools/gfx/debug-layer/debug-transient-heap.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-10-12 14:51:13 -0700
committerGitHub <noreply@github.com>2022-10-12 14:51:13 -0700
commit344898b091867e5450a3fa432a207d75255df77a (patch)
treee9779a112e371ad141d1f6d9b8778acb4207179b /tools/gfx/debug-layer/debug-transient-heap.cpp
parentd96250bcc2e8fedb485df3ed0fdc28f89f6d23c8 (diff)
Add gfx debug layer trampoline for D3D12 interfaces. (#2445)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools/gfx/debug-layer/debug-transient-heap.cpp')
-rw-r--r--tools/gfx/debug-layer/debug-transient-heap.cpp48
1 files changed, 47 insertions, 1 deletions
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<ITransientResourceHeap*>(this);
+ if (uuid == GfxGUID::IID_ITransientResourceHeapD3D12)
+ {
+ RefPtr<DebugTransientResourceHeapD3D12> 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<ITransientResourceHeapD3D12*>(this);
+ if (uuid == GfxGUID::IID_ITransientResourceHeap)
+ {
+ RefPtr<DebugTransientResourceHeap> 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