dawn_node: add "dlldir=<path>" flag
Only used on Windows builds for now, this flag adds the input path to the DLL search paths. The main purpose is to ensure we load the right version of D3D dlls, such as d3dcompiler_47.dll from the Chrome output dir, rather than the default one in the Systems directory. Bug: dawn:1163 Change-Id: I8e696dd877ec715e1e54d8589af8275e62c90937 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66962 Commit-Queue: Antonio Maiorano <amaiorano@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
821f1a8a60
commit
c6745901f0
|
@ -18,6 +18,10 @@
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
std::string GetEnvVar(const char* varName) {
|
std::string GetEnvVar(const char* varName) {
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
@ -37,6 +41,14 @@ namespace {
|
||||||
return "";
|
return "";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetDllDir(const char* dir) {
|
||||||
|
(void)dir;
|
||||||
|
#if defined(_WIN32)
|
||||||
|
::SetDllDirectory(dir);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace wgpu { namespace binding {
|
namespace wgpu { namespace binding {
|
||||||
|
@ -49,6 +61,10 @@ namespace wgpu { namespace binding {
|
||||||
instance_.EnableBackendValidation(true);
|
instance_.EnableBackendValidation(true);
|
||||||
instance_.SetBackendValidationLevel(dawn_native::BackendValidationLevel::Full);
|
instance_.SetBackendValidationLevel(dawn_native::BackendValidationLevel::Full);
|
||||||
|
|
||||||
|
// Setting the DllDir changes where we load adapter DLLs from (e.g. d3dcompiler_47.dll)
|
||||||
|
if (auto dir = flags_.Get("dlldir")) {
|
||||||
|
SetDllDir(dir->c_str());
|
||||||
|
}
|
||||||
instance_.DiscoverDefaultAdapters();
|
instance_.DiscoverDefaultAdapters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue