summaryrefslogtreecommitdiffstats
path: root/tools/gfx
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-02-28 22:57:07 -0800
committerGitHub <noreply@github.com>2024-02-28 22:57:07 -0800
commit73a61edda8893901acad05bb4e7d3110db5041a8 (patch)
treebb6331b28715a4e95fcd7724ad338149ce56e562 /tools/gfx
parentd2644e2f8f0abb73bbd6afd70816f6bf245340da (diff)
[SPIRV] Add NonSemanticDebugInfo for step-through debugging. (#3644)
* [SPIRV] Add NonSemanticDebugInfo for step-through debugging. * Fix. * Fix.
Diffstat (limited to 'tools/gfx')
-rw-r--r--tools/gfx/cpu/cpu-device.cpp2
-rw-r--r--tools/gfx/cuda/cuda-device.cpp2
-rw-r--r--tools/gfx/d3d11/d3d11-device.cpp2
-rw-r--r--tools/gfx/d3d12/d3d12-device.cpp2
-rw-r--r--tools/gfx/open-gl/render-gl.cpp2
-rw-r--r--tools/gfx/slang-context.h17
-rw-r--r--tools/gfx/vulkan/vk-device.cpp2
7 files changed, 28 insertions, 1 deletions
diff --git a/tools/gfx/cpu/cpu-device.cpp b/tools/gfx/cpu/cpu-device.cpp
index f248cf52a..bd747d998 100644
--- a/tools/gfx/cpu/cpu-device.cpp
+++ b/tools/gfx/cpu/cpu-device.cpp
@@ -27,6 +27,8 @@ namespace cpu
{
SLANG_RETURN_ON_FAIL(slangContext.initialize(
desc.slang,
+ desc.extendedDescCount,
+ desc.extendedDescs,
SLANG_SHADER_HOST_CALLABLE,
"sm_5_1",
makeArray(slang::PreprocessorMacroDesc{ "__CPU__", "1" }).getView()));
diff --git a/tools/gfx/cuda/cuda-device.cpp b/tools/gfx/cuda/cuda-device.cpp
index 377a5aba2..0fcf9319e 100644
--- a/tools/gfx/cuda/cuda-device.cpp
+++ b/tools/gfx/cuda/cuda-device.cpp
@@ -142,6 +142,8 @@ SLANG_NO_THROW SlangResult SLANG_MCALL DeviceImpl::initialize(const Desc& desc)
{
SLANG_RETURN_ON_FAIL(slangContext.initialize(
desc.slang,
+ desc.extendedDescCount,
+ desc.extendedDescs,
SLANG_PTX,
"sm_5_1",
makeArray(slang::PreprocessorMacroDesc{ "__CUDA_COMPUTE__", "1" }).getView()));
diff --git a/tools/gfx/d3d11/d3d11-device.cpp b/tools/gfx/d3d11/d3d11-device.cpp
index 20e17b082..148590831 100644
--- a/tools/gfx/d3d11/d3d11-device.cpp
+++ b/tools/gfx/d3d11/d3d11-device.cpp
@@ -34,6 +34,8 @@ SlangResult DeviceImpl::initialize(const Desc& desc)
{
SLANG_RETURN_ON_FAIL(slangContext.initialize(
desc.slang,
+ desc.extendedDescCount,
+ desc.extendedDescs,
SLANG_DXBC,
"sm_5_0",
makeArray(slang::PreprocessorMacroDesc{ "__D3D11__", "1" }).getView()));
diff --git a/tools/gfx/d3d12/d3d12-device.cpp b/tools/gfx/d3d12/d3d12-device.cpp
index bbf27b4f7..58b13fe41 100644
--- a/tools/gfx/d3d12/d3d12-device.cpp
+++ b/tools/gfx/d3d12/d3d12-device.cpp
@@ -910,6 +910,8 @@ Result DeviceImpl::initialize(const Desc& desc)
}
SLANG_RETURN_ON_FAIL(slangContext.initialize(
desc.slang,
+ desc.extendedDescCount,
+ desc.extendedDescs,
compileTarget,
profileName,
makeArray(slang::PreprocessorMacroDesc{ "__D3D12__", "1" }).getView()));
diff --git a/tools/gfx/open-gl/render-gl.cpp b/tools/gfx/open-gl/render-gl.cpp
index b5ab14fe8..abb178375 100644
--- a/tools/gfx/open-gl/render-gl.cpp
+++ b/tools/gfx/open-gl/render-gl.cpp
@@ -2007,6 +2007,8 @@ SLANG_NO_THROW Result SLANG_MCALL GLDevice::initialize(const Desc& desc)
{
SLANG_RETURN_ON_FAIL(slangContext.initialize(
desc.slang,
+ desc.extendedDescCount,
+ desc.extendedDescs,
SLANG_GLSL,
"glsl_440",
makeArray(
diff --git a/tools/gfx/slang-context.h b/tools/gfx/slang-context.h
index 8ae14d4aa..79f39c3e6 100644
--- a/tools/gfx/slang-context.h
+++ b/tools/gfx/slang-context.h
@@ -10,7 +10,11 @@ namespace gfx
public:
Slang::ComPtr<slang::IGlobalSession> globalSession;
Slang::ComPtr<slang::ISession> session;
- Result initialize(const gfx::IDevice::SlangDesc& desc, SlangCompileTarget compileTarget, const char* defaultProfileName,
+ Result initialize(const gfx::IDevice::SlangDesc& desc,
+ uint32_t extendedDescCount,
+ void** extendedDescs,
+ SlangCompileTarget compileTarget,
+ const char* defaultProfileName,
Slang::ConstArrayView<slang::PreprocessorMacroDesc> additionalMacros)
{
if (desc.slangGlobalSession)
@@ -45,6 +49,17 @@ namespace gfx
slangSessionDesc.targets = &targetDesc;
slangSessionDesc.targetCount = 1;
+ for (uint32_t i = 0; i < extendedDescCount; i++)
+ {
+ if ((*(StructType*)extendedDescs[i]) == StructType::SlangSessionExtendedDesc)
+ {
+ auto extDesc = (SlangSessionExtendedDesc*)extendedDescs[i];
+ slangSessionDesc.compilerOptionEntryCount = extDesc->compilerOptionEntryCount;
+ slangSessionDesc.compilerOptionEntries = extDesc->compilerOptionEntries;
+ break;
+ }
+ }
+
SLANG_RETURN_ON_FAIL(globalSession->createSession(slangSessionDesc, session.writeRef()));
return SLANG_OK;
}
diff --git a/tools/gfx/vulkan/vk-device.cpp b/tools/gfx/vulkan/vk-device.cpp
index 641b50bf6..1b79887ca 100644
--- a/tools/gfx/vulkan/vk-device.cpp
+++ b/tools/gfx/vulkan/vk-device.cpp
@@ -933,6 +933,8 @@ SlangResult DeviceImpl::initialize(const Desc& desc)
SLANG_RETURN_ON_FAIL(slangContext.initialize(
desc.slang,
+ desc.extendedDescCount,
+ desc.extendedDescs,
SLANG_SPIRV,
"sm_5_1",
makeArray(slang::PreprocessorMacroDesc{ "__VK__", "1" }).getView()));