From bad0fa10c3b3f051769497e84700f6afb95b6b2a Mon Sep 17 00:00:00 2001 From: Anders Leino Date: Tue, 26 Nov 2024 18:57:34 +0200 Subject: [PATCH] wgpu: Add webgpu_dawn.dll as an alternative library name (#113) --- src/wgpu/wgpu-api.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/wgpu/wgpu-api.cpp b/src/wgpu/wgpu-api.cpp index 5573f791..93866c80 100644 --- a/src/wgpu/wgpu-api.cpp +++ b/src/wgpu/wgpu-api.cpp @@ -13,15 +13,23 @@ API::~API() Result API::init() { #if SLANG_WINDOWS_FAMILY - SLANG_RETURN_ON_FAIL(loadSharedLibrary("dawn.dll", m_module)); + char const* libraryNames[] = {"dawn.dll", "webgpu_dawn.dll"}; #elif SLANG_LINUX_FAMILY - SLANG_RETURN_ON_FAIL(loadSharedLibrary("libdawn.so", m_module)); + char const* libraryNames[] = {"libdawn.so"}; #elif SLANG_APPLE_FAMILY - SLANG_RETURN_ON_FAIL(loadSharedLibrary("libdawn.dylib", m_module)); + char const* libraryNames[] = {"libdawn.dylib"}; #else - return SLANG_FAIL; + char const* libraryNames[] = {}; #endif + for (char const* name : libraryNames) + { + if (loadSharedLibrary(name, m_module) == SLANG_OK) + break; + } + if (!m_module) + return SLANG_FAIL; + #define LOAD_PROC(name) wgpu##name = (WGPUProc##name)findSymbolAddressByName(m_module, "wgpu" #name); SLANG_RHI_WGPU_PROCS(LOAD_PROC) #undef LOAD_PROC