summaryrefslogtreecommitdiffstats
path: root/tools/gfx/vulkan/vk-module.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-07-09 11:00:44 -0700
committerGitHub <noreply@github.com>2021-07-09 11:00:44 -0700
commitfa565f96823f3985cffa3a899742fdf1449d5876 (patch)
treee8aeddb87cd077bf9b28ca4b799756c0ee77e48a /tools/gfx/vulkan/vk-module.cpp
parent09a251e0f3a31c826eaa91eef64b04eb01c4393a (diff)
Enable testing with Swiftshader. (#1906)
Diffstat (limited to 'tools/gfx/vulkan/vk-module.cpp')
-rw-r--r--tools/gfx/vulkan/vk-module.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/gfx/vulkan/vk-module.cpp b/tools/gfx/vulkan/vk-module.cpp
index 4e92a3d2c..985df1a7b 100644
--- a/tools/gfx/vulkan/vk-module.cpp
+++ b/tools/gfx/vulkan/vk-module.cpp
@@ -1,4 +1,4 @@
-// module.cpp
+// module.cpp
#include "vk-module.h"
#include <stdlib.h>
@@ -37,6 +37,18 @@ Slang::Result VulkanModule::init()
if (!m_module)
{
+ dynamicLibraryName = "vk_swiftshader";
+#if SLANG_WINDOWS_FAMILY
+ HMODULE swiftShaderModule = ::LoadLibraryA(dynamicLibraryName);
+ m_module = (void*)swiftShaderModule;
+#else
+ m_module = dlopen(dynamicLibraryName, RTLD_NOW);
+#endif
+ m_isSoftware = true;
+ }
+
+ if (!m_module)
+ {
fprintf(stderr, "error: failed load '%s'\n", dynamicLibraryName);
return SLANG_FAIL;
}