summaryrefslogtreecommitdiffstats
path: root/tools/gfx/debug-layer/debug-command-buffer.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-command-buffer.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-command-buffer.cpp')
-rw-r--r--tools/gfx/debug-layer/debug-command-buffer.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/gfx/debug-layer/debug-command-buffer.cpp b/tools/gfx/debug-layer/debug-command-buffer.cpp
index aa9c6b8b8..f3c71cb77 100644
--- a/tools/gfx/debug-layer/debug-command-buffer.cpp
+++ b/tools/gfx/debug-layer/debug-command-buffer.cpp
@@ -22,6 +22,15 @@ DebugCommandBuffer::DebugCommandBuffer()
m_rayTracingCommandEncoder.commandBuffer = this;
}
+ICommandBuffer* DebugCommandBuffer::getInterface(const Slang::Guid& guid)
+{
+ if (guid == GfxGUID::IID_ICommandBuffer || guid == GfxGUID::IID_ISlangUnknown)
+ return (DebugObject<ICommandBuffer>*)this;
+ if (guid == GfxGUID::IID_ICommandBufferD3D12)
+ return static_cast<ICommandBufferD3D12*>(this);
+ return nullptr;
+}
+
void DebugCommandBuffer::encodeRenderCommands(
IRenderPassLayout* renderPass,
IFramebuffer* framebuffer,
@@ -127,6 +136,30 @@ Result DebugCommandBuffer::getNativeHandle(InteropHandle* outHandle)
return baseObject->getNativeHandle(outHandle);
}
+void DebugCommandBuffer::invalidateDescriptorHeapBinding()
+{
+ SLANG_GFX_API_FUNC;
+ ComPtr<ICommandBufferD3D12> cmdBuf;
+ if (SLANG_FAILED(baseObject->queryInterface(SlangUUID SLANG_UUID_ICommandBufferD3D12, (void**)cmdBuf.writeRef())))
+ {
+ GFX_DIAGNOSE_ERROR("The current command buffer implementation does not provide ICommandBufferD3D12 interface.");
+ return;
+ }
+ return cmdBuf->invalidateDescriptorHeapBinding();
+}
+
+void DebugCommandBuffer::ensureInternalDescriptorHeapsBound()
+{
+ SLANG_GFX_API_FUNC;
+ ComPtr<ICommandBufferD3D12> cmdBuf;
+ if (SLANG_FAILED(baseObject->queryInterface(SlangUUID SLANG_UUID_ICommandBufferD3D12, (void**)cmdBuf.writeRef())))
+ {
+ GFX_DIAGNOSE_ERROR("The current command buffer implementation does not provide ICommandBufferD3D12 interface.");
+ return;
+ }
+ return cmdBuf->ensureInternalDescriptorHeapsBound();
+}
+
void DebugCommandBuffer::checkEncodersClosedBeforeNewEncoder()
{
if (m_renderCommandEncoder.isOpen || m_resourceCommandEncoder.isOpen ||