From 73a61edda8893901acad05bb4e7d3110db5041a8 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 28 Feb 2024 22:57:07 -0800 Subject: [SPIRV] Add NonSemanticDebugInfo for step-through debugging. (#3644) * [SPIRV] Add NonSemanticDebugInfo for step-through debugging. * Fix. * Fix. --- tools/gfx-unit-test/gfx-test-util.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'tools/gfx-unit-test') diff --git a/tools/gfx-unit-test/gfx-test-util.cpp b/tools/gfx-unit-test/gfx-test-util.cpp index 748ced5eb..fe06a1745 100644 --- a/tools/gfx-unit-test/gfx-test-util.cpp +++ b/tools/gfx-unit-test/gfx-test-util.cpp @@ -4,7 +4,7 @@ #include #define GFX_ENABLE_RENDERDOC_INTEGRATION 0 - +#define GFX_ENABLE_SPIRV_DEBUG 0 #if GFX_ENABLE_RENDERDOC_INTEGRATION # include "external/renderdoc_app.h" # include @@ -278,10 +278,25 @@ namespace gfx_test gfx::D3D12DeviceExtendedDesc extDesc = {}; extDesc.rootParameterShaderAttributeName = "root"; + + gfx::SlangSessionExtendedDesc slangExtDesc = {}; + Slang::List entries; + slang::CompilerOptionEntry emitSpirvDirectlyEntry; + emitSpirvDirectlyEntry.name = slang::CompilerOptionName::EmitSpirvDirectly; + emitSpirvDirectlyEntry.value.intValue0 = 1; + entries.add(emitSpirvDirectlyEntry); +#if GFX_ENABLE_SPIRV_DEBUG + slang::CompilerOptionEntry debugLevelCompilerOptionEntry; + debugLevelCompilerOptionEntry.name = slang::CompilerOptionName::DebugInformation; + debugLevelCompilerOptionEntry.value.intValue0 = SLANG_DEBUG_INFO_LEVEL_STANDARD; + entries.add(debugLevelCompilerOptionEntry); +#endif + slangExtDesc.compilerOptionEntries = entries.getBuffer(); + slangExtDesc.compilerOptionEntryCount = (uint32_t)entries.getCount(); - deviceDesc.extendedDescCount = 1; - void* extDescPtr = &extDesc; - deviceDesc.extendedDescs = &extDescPtr; + deviceDesc.extendedDescCount = 2; + void* extDescPtrs[2] = { &extDesc, &slangExtDesc }; + deviceDesc.extendedDescs = extDescPtrs; // TODO: We should also set the debug callback // (And in general reduce the differences (and duplication) between -- cgit v1.2.3