summaryrefslogtreecommitdiffstats
path: root/source/core/slang-render-api-util.cpp
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2023-04-14 17:08:18 +0800
committerGitHub <noreply@github.com>2023-04-14 17:08:18 +0800
commit4c9c8a7a4d9b97fec6041a562638fbea521533ed (patch)
treebcbe353f9c3a64ce7e7e5419c4172a5fadac297b /source/core/slang-render-api-util.cpp
parent5a629b3ccd801a1f0647e971d01481c55d3381c2 (diff)
Some small fixes with Windows/DX usage (#2797)
* Correct case of windows.h includes * Use Slang::SharedLibrary to load directx dlls * s/max/std::max/ * Factor common OS code in calcHasApi * Add DXIL test for compute/simple * s/false/FALSE for calls to WinAPI functions * Factor common OS code in gfxGetAdapters * 2 missing headers d3d12sdklayers for ID3DDebug climits for UINT_MAX * Define out unused function on Linux * Only try to load Vulkan and CUDA on Windows or Linux * simplify D3DUtil::getDxgiModule * Remove WIN32_LEAN_AND_MEAN &co from source files Add a global define * Set WIN32_LEAN_AND_MEAN &friends in headers Restore previous state also * regenerate vs projects
Diffstat (limited to 'source/core/slang-render-api-util.cpp')
-rw-r--r--source/core/slang-render-api-util.cpp49
1 files changed, 18 insertions, 31 deletions
diff --git a/source/core/slang-render-api-util.cpp b/source/core/slang-render-api-util.cpp
index bc15a8164..fa39f46ee 100644
--- a/source/core/slang-render-api-util.cpp
+++ b/source/core/slang-render-api-util.cpp
@@ -261,41 +261,28 @@ static bool _canLoadSharedLibrary(const char* libName)
/* static */bool RenderApiUtil::calcHasApi(RenderApiType type)
{
-#if SLANG_WINDOWS_FAMILY
switch (type)
{
- case RenderApiType::OpenGl: return _canLoadSharedLibrary("opengl32");
- case RenderApiType::Vulkan: return _canLoadSharedLibrary("vulkan-1") || _canLoadSharedLibrary("vk_swiftshader");
- case RenderApiType::D3D11: return _canLoadSharedLibrary("d3d11");
- case RenderApiType::D3D12: return _canLoadSharedLibrary("d3d12");
- case RenderApiType::CPU: return true;
- case RenderApiType::CUDA:
- {
- // We'll assume it's available, and if not trying to create it will detect it
- return true;
- }
- default: break;
- }
+#if SLANG_WINDOWS_FAMILY
+ case RenderApiType::OpenGl: return _canLoadSharedLibrary("opengl32");
+ case RenderApiType::Vulkan: return _canLoadSharedLibrary("vulkan-1") || _canLoadSharedLibrary("vk_swiftshader");
+ case RenderApiType::D3D11: return _canLoadSharedLibrary("d3d11");
+ case RenderApiType::D3D12: return _canLoadSharedLibrary("d3d12");
#elif SLANG_UNIX_FAMILY
- // Assume on unix target we never have D3D
- switch (type)
- {
- case RenderApiType::OpenGl:
- case RenderApiType::Vulkan:
- {
- return true;
- }
- case RenderApiType::CPU:
- {
- return true;
- }
- case RenderApiType::CUDA:
- {
- return true;
- }
- default: break;
- }
+ case RenderApiType::D3D11: return false;
+ case RenderApiType::D3D12: return false;
+ // The below can be used once they're confirmed working with gfx
+ // case RenderApiType::D3D11: return _canLoadSharedLibrary("dxvk_d3d11");
+ // case RenderApiType::D3D12: return _canLoadSharedLibrary("vkd3d-proton-d3d12");
+
+ case RenderApiType::OpenGl: return true;
+ case RenderApiType::Vulkan: return true;
#endif
+ case RenderApiType::CPU: return true;
+ // We'll assume CUDA is available, and if not, trying to create it will detect it
+ case RenderApiType::CUDA: return true;
+ default: break;
+ }
return false;
}