From fcc1a0973f91f0daff9c5c2d0a00208ecb7b91c2 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 26 Sep 2022 12:58:29 -0700 Subject: Use d3d12/vk debug layer when gfx debug layer is enabled. (#2411) * Use d3d12/vk debug layer when gfx debug layer is enabled. * Fix. Co-authored-by: Yong He --- tools/gfx/debug-layer/debug-command-queue.cpp | 4 ++++ tools/gfx/debug-layer/debug-fence.cpp | 4 ++++ tools/gfx/debug-layer/debug-fence.h | 2 ++ 3 files changed, 10 insertions(+) (limited to 'tools/gfx/debug-layer') diff --git a/tools/gfx/debug-layer/debug-command-queue.cpp b/tools/gfx/debug-layer/debug-command-queue.cpp index 253541abb..c196fa06a 100644 --- a/tools/gfx/debug-layer/debug-command-queue.cpp +++ b/tools/gfx/debug-layer/debug-command-queue.cpp @@ -47,6 +47,10 @@ void DebugCommandQueue::executeCommandBuffers(GfxCount count, ICommandBuffer* co } } baseObject->executeCommandBuffers(count, innerCommandBuffers.getBuffer(), getInnerObj(fence), valueToSignal); + if (fence) + { + getDebugObj(fence)->maxValueToSignal = Math::Max(getDebugObj(fence)->maxValueToSignal, valueToSignal); + } } void DebugCommandQueue::waitOnHost() diff --git a/tools/gfx/debug-layer/debug-fence.cpp b/tools/gfx/debug-layer/debug-fence.cpp index 7ecbfabd7..66c541618 100644 --- a/tools/gfx/debug-layer/debug-fence.cpp +++ b/tools/gfx/debug-layer/debug-fence.cpp @@ -31,6 +31,10 @@ Result DebugFence::getCurrentValue(uint64_t* outValue) Result DebugFence::setCurrentValue(uint64_t value) { SLANG_GFX_API_FUNC; + if (value < maxValueToSignal) + { + GFX_DIAGNOSE_ERROR_FORMAT("Cannot set fence value (%d) to lower than pending signal value (%d) on the fence.", value, maxValueToSignal); + } return baseObject->setCurrentValue(value); } diff --git a/tools/gfx/debug-layer/debug-fence.h b/tools/gfx/debug-layer/debug-fence.h index 980596d90..1f61fac33 100644 --- a/tools/gfx/debug-layer/debug-fence.h +++ b/tools/gfx/debug-layer/debug-fence.h @@ -18,6 +18,8 @@ public: virtual SLANG_NO_THROW Result SLANG_MCALL setCurrentValue(uint64_t value) override; virtual SLANG_NO_THROW Result SLANG_MCALL getSharedHandle(InteropHandle* outHandle) override; virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outNativeHandle) override; +public: + uint64_t maxValueToSignal = 0; }; } // namespace debug -- cgit v1.2.3