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-helper-functions.h | 39 ++++++++++++++++++-------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'tools/gfx/debug-layer/debug-helper-functions.h') diff --git a/tools/gfx/debug-layer/debug-helper-functions.h b/tools/gfx/debug-layer/debug-helper-functions.h index 1842cf458..f2edd0d84 100644 --- a/tools/gfx/debug-layer/debug-helper-functions.h +++ b/tools/gfx/debug-layer/debug-helper-functions.h @@ -131,13 +131,30 @@ void _gfxDiagnoseImpl(DebugMessageType type, const char* format, TArgs... args) // Utility conversion functions to get Debug* object or the inner object from a user provided // pointer. -#define SLANG_GFX_DEBUG_GET_OBJ_IMPL(type) \ - inline Debug##type* getDebugObj(I##type* ptr) { return static_cast(ptr); } \ - inline I##type* getInnerObj(I##type* ptr) \ - { \ - if (!ptr) return nullptr; \ - auto debugObj = getDebugObj(ptr); \ - return debugObj->baseObject; \ +#define SLANG_GFX_DEBUG_GET_OBJ_IMPL(type) \ + inline Debug##type* getDebugObj(I##type* ptr) \ + { \ + return static_cast(static_cast*>(ptr)); \ + } \ + inline I##type* getInnerObj(I##type* ptr) \ + { \ + if (!ptr) \ + return nullptr; \ + auto debugObj = getDebugObj(ptr); \ + return debugObj->baseObject; \ + } + +#define SLANG_GFX_DEBUG_GET_OBJ_IMPL_UNOWNED(type) \ + inline Debug##type* getDebugObj(I##type* ptr) \ + { \ + return static_cast(static_cast*>(ptr)); \ + } \ + inline I##type* getInnerObj(I##type* ptr) \ + { \ + if (!ptr) \ + return nullptr; \ + auto debugObj = getDebugObj(ptr); \ + return debugObj->baseObject; \ } SLANG_GFX_DEBUG_GET_OBJ_IMPL(Device) @@ -145,10 +162,10 @@ SLANG_GFX_DEBUG_GET_OBJ_IMPL(BufferResource) SLANG_GFX_DEBUG_GET_OBJ_IMPL(TextureResource) SLANG_GFX_DEBUG_GET_OBJ_IMPL(CommandBuffer) SLANG_GFX_DEBUG_GET_OBJ_IMPL(CommandQueue) -SLANG_GFX_DEBUG_GET_OBJ_IMPL(ComputeCommandEncoder) -SLANG_GFX_DEBUG_GET_OBJ_IMPL(RenderCommandEncoder) -SLANG_GFX_DEBUG_GET_OBJ_IMPL(ResourceCommandEncoder) -SLANG_GFX_DEBUG_GET_OBJ_IMPL(RayTracingCommandEncoder) +SLANG_GFX_DEBUG_GET_OBJ_IMPL_UNOWNED(ComputeCommandEncoder) +SLANG_GFX_DEBUG_GET_OBJ_IMPL_UNOWNED(RenderCommandEncoder) +SLANG_GFX_DEBUG_GET_OBJ_IMPL_UNOWNED(ResourceCommandEncoder) +SLANG_GFX_DEBUG_GET_OBJ_IMPL_UNOWNED(RayTracingCommandEncoder) SLANG_GFX_DEBUG_GET_OBJ_IMPL(Framebuffer) SLANG_GFX_DEBUG_GET_OBJ_IMPL(FramebufferLayout) SLANG_GFX_DEBUG_GET_OBJ_IMPL(InputLayout) -- cgit v1.2.3