From 2482271fffbe85efc1bd7efcf74a76f6ed436012 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 29 Apr 2021 14:19:51 -0700 Subject: `gfx` DebugCallback and debug layer. (#1822) * `gfx` DebugCallback and debug layer. --- tools/gfx/cpu/render-cpu.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'tools/gfx/cpu/render-cpu.cpp') diff --git a/tools/gfx/cpu/render-cpu.cpp b/tools/gfx/cpu/render-cpu.cpp index af1641e60..2d7d858c4 100644 --- a/tools/gfx/cpu/render-cpu.cpp +++ b/tools/gfx/cpu/render-cpu.cpp @@ -1136,7 +1136,17 @@ private: auto entryPointObject = m_currentRootObject->getEntryPoint(entryPointIndex); ComPtr sharedLibrary; - program->slangProgram->getEntryPointHostCallable(entryPointIndex, targetIndex, sharedLibrary.writeRef()); + ComPtr diagnostics; + auto compileResult = program->slangProgram->getEntryPointHostCallable( + entryPointIndex, targetIndex, sharedLibrary.writeRef(), diagnostics.writeRef()); + if (diagnostics) + { + getDebugCallback()->handleMessage( + compileResult == SLANG_OK ? DebugMessageType::Warning : DebugMessageType::Error, + DebugMessageSource::Slang, + (char*)diagnostics->getBufferPointer()); + } + if (SLANG_FAILED(compileResult)) return; auto func = (slang_prelude::ComputeFunc) sharedLibrary->findSymbolAddressByName(entryPointName); -- cgit v1.2.3