diff options
| author | Yong He <yonghe@outlook.com> | 2022-10-12 14:51:13 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-12 14:51:13 -0700 |
| commit | 344898b091867e5450a3fa432a207d75255df77a (patch) | |
| tree | e9779a112e371ad141d1f6d9b8778acb4207179b /tools/gfx/debug-layer/debug-helper-functions.h | |
| parent | d96250bcc2e8fedb485df3ed0fdc28f89f6d23c8 (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-helper-functions.h')
| -rw-r--r-- | tools/gfx/debug-layer/debug-helper-functions.h | 39 |
1 files changed, 28 insertions, 11 deletions
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<Debug##type*>(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<Debug##type*>(static_cast<DebugObject<I##type>*>(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<Debug##type*>(static_cast<UnownedDebugObject<I##type>*>(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) |
