From fa565f96823f3985cffa3a899742fdf1449d5876 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 9 Jul 2021 11:00:44 -0700 Subject: Enable testing with Swiftshader. (#1906) --- tools/gfx/vulkan/vk-module.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tools/gfx/vulkan/vk-module.cpp') 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 @@ -35,6 +35,18 @@ Slang::Result VulkanModule::init() m_module = dlopen(dynamicLibraryName, RTLD_NOW); #endif + 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); -- cgit v1.2.3