summaryrefslogtreecommitdiffstats
path: root/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'source/core')
-rw-r--r--source/core/slang-io.cpp5
-rw-r--r--source/core/slang-platform.cpp6
-rw-r--r--source/core/slang-render-api-util.cpp49
-rw-r--r--source/core/slang-shared-library.cpp3
-rw-r--r--source/core/windows/slang-win-process.cpp7
5 files changed, 22 insertions, 48 deletions
diff --git a/source/core/slang-io.cpp b/source/core/slang-io.cpp
index 5c57a4b3a..30ba41d0f 100644
--- a/source/core/slang-io.cpp
+++ b/source/core/slang-io.cpp
@@ -16,10 +16,7 @@
#ifdef _WIN32
# include <direct.h>
-
-# define WIN32_LEAN_AND_MEAN
-# define VC_EXTRALEAN
-# include <Windows.h>
+# include <windows.h>
#endif
#if defined(__linux__) || defined(__CYGWIN__) || SLANG_APPLE_FAMILY
diff --git a/source/core/slang-platform.cpp b/source/core/slang-platform.cpp
index bb612932c..4f9b0698c 100644
--- a/source/core/slang-platform.cpp
+++ b/source/core/slang-platform.cpp
@@ -8,11 +8,7 @@
#include "slang-io.h"
#ifdef _WIN32
- #define WIN32_LEAN_AND_MEAN
- #define NOMINMAX
- #include <Windows.h>
- #undef WIN32_LEAN_AND_MEAN
- #undef NOMINMAX
+ #include <windows.h>
#else
#include "slang-string.h"
#include <dlfcn.h>
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;
}
diff --git a/source/core/slang-shared-library.cpp b/source/core/slang-shared-library.cpp
index e0fe82012..c3991ad06 100644
--- a/source/core/slang-shared-library.cpp
+++ b/source/core/slang-shared-library.cpp
@@ -6,8 +6,7 @@
#include "slang-string-util.h"
#if defined(_WIN32)
-#define WIN32_LEAN_AND_MEAN
-#include <Windows.h>
+#include <windows.h>
#elif defined(__linux__) || defined(SLANG_OSX)
#include <dlfcn.h>
#endif
diff --git a/source/core/windows/slang-win-process.cpp b/source/core/windows/slang-win-process.cpp
index 215904938..93bff3eb3 100644
--- a/source/core/windows/slang-win-process.cpp
+++ b/source/core/windows/slang-win-process.cpp
@@ -9,15 +9,10 @@
#include "../../../slang-com-helper.h"
#ifdef _WIN32
-// Include Windows header in a way that minimized namespace pollution.
// TODO: We could try to avoid including this at all, but it would
// mean trying to hide certain struct layouts, which would add
// more dynamic allocation.
-# define WIN32_LEAN_AND_MEAN
-# define NOMINMAX
-# include <Windows.h>
-# undef WIN32_LEAN_AND_MEAN
-# undef NOMINMAX
+# include <windows.h>
#endif
#include <stdio.h>