Skip to content

Commit

Permalink
wgpu: Add webgpu_dawn.dll as an alternative library name (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleino-nv authored Nov 26, 2024
1 parent bc7657a commit bad0fa1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/wgpu/wgpu-api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bad0fa1

Please sign in to comment.