summaryrefslogtreecommitdiffstats
path: root/tools/gfx/d3d12/d3d12-device.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gfx/d3d12/d3d12-device.cpp')
-rw-r--r--tools/gfx/d3d12/d3d12-device.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/gfx/d3d12/d3d12-device.cpp b/tools/gfx/d3d12/d3d12-device.cpp
index 312c81d75..9bf54a01b 100644
--- a/tools/gfx/d3d12/d3d12-device.cpp
+++ b/tools/gfx/d3d12/d3d12-device.cpp
@@ -405,8 +405,13 @@ Result DeviceImpl::initialize(const Desc& desc)
// Rather than statically link against D3D, we load it dynamically.
- HMODULE d3dModule = LoadLibraryA("d3d12.dll");
- if (!d3dModule)
+ SharedLibrary::Handle d3dModule;
+#if SLANG_WINDOWS_FAMILY
+ const char* libName = "d3d11";
+#else
+ const char* libName = "vkd3d-proton-d3d12";
+#endif
+ if (SLANG_FAILED(SharedLibrary::load(libName, d3dModule)))
{
getDebugCallback()->handleMessage(
DebugMessageType::Error, DebugMessageSource::Layer, "error: failed load 'd3d12.dll'\n");
@@ -1990,7 +1995,7 @@ void DeviceImpl::submitResourceCommandsAndWait(const DeviceImpl::ResourceCommand
m_resourceCommandTransientHeap->synchronizeAndReset();
}
-void DeviceImpl::processExperimentalFeaturesDesc(void* d3dModule, void* inDesc)
+void DeviceImpl::processExperimentalFeaturesDesc(SharedLibrary::Handle d3dModule, void* inDesc)
{
typedef HRESULT(WINAPI* PFN_D3D12_ENABLE_EXPERIMENTAL_FEATURES)(
UINT NumFeatures,
@@ -2002,7 +2007,7 @@ void DeviceImpl::processExperimentalFeaturesDesc(void* d3dModule, void* inDesc)
D3D12ExperimentalFeaturesDesc desc = {};
memcpy(&desc, inDesc, sizeof(desc));
auto enableExperimentalFeaturesFunc =
- (PFN_D3D12_ENABLE_EXPERIMENTAL_FEATURES)loadProc((HMODULE)d3dModule, "D3D12EnableExperimentalFeatures");
+ (PFN_D3D12_ENABLE_EXPERIMENTAL_FEATURES)loadProc(d3dModule, "D3D12EnableExperimentalFeatures");
if (!enableExperimentalFeaturesFunc)
{
getDebugCallback()->handleMessage(
@@ -2173,9 +2178,9 @@ Result DeviceImpl::createCommandQueueImpl(CommandQueueImpl** outQueue)
return SLANG_OK;
}
-PROC DeviceImpl::loadProc(HMODULE module, char const* name)
+void* DeviceImpl::loadProc(SharedLibrary::Handle module, char const* name)
{
- PROC proc = ::GetProcAddress(module, name);
+ void* proc = SharedLibrary::findSymbolAddressByName(module, name);
if (!proc)
{
fprintf(stderr, "error: failed load symbol '%s'\n", name);