Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 522d512

Browse files
committed
Simplify Vulkan ICD loading for testing
The STANDALONE preprocessor macro is only for controlling the loading of a delay loaded DLL, on Windows. Change-Id: Ife765f27c7e03c542d7e81d90c09c97e4e2cbe5d Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/33248 Kokoro-Presubmit: kokoro <[email protected]> Tested-by: Nicolas Capens <[email protected]> Reviewed-by: Alexis Hétu <[email protected]> Reviewed-by: Ben Clayton <[email protected]>
1 parent cd98c73 commit 522d512

File tree

2 files changed

+20
-25
lines changed

2 files changed

+20
-25
lines changed

src/Vulkan/VulkanPlatform.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#include <cstddef>
1919
#include <cstdint>
20-
#include <type_traits>
20+
#include <type_traits>
2121

2222
template<typename T> class VkNonDispatchableHandle
2323
{
@@ -46,7 +46,7 @@ template<typename T> class VkNonDispatchableHandle
4646
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) \
4747
typedef struct object##_T *object##Ptr; \
4848
typedef VkNonDispatchableHandle<object##Ptr> object; \
49-
template class VkNonDispatchableHandle<object##Ptr>;
49+
template class VkNonDispatchableHandle<object##Ptr>;
5050

5151
#include <vulkan/vulkan.h>
5252

tests/VulkanUnitTests/Driver.cpp

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,43 +49,38 @@ Driver::~Driver()
4949
bool Driver::loadSwiftShader()
5050
{
5151
#if OS_WINDOWS
52-
#if !defined(STANDALONE)
53-
// The DLL is delay loaded (see BUILD.gn), so we can load
54-
// the correct ones from Chrome's swiftshader subdirectory.
55-
HMODULE libvulkan = LoadLibraryA("swiftshader\\libvulkan.dll");
56-
EXPECT_NE((HMODULE)NULL, libvulkan);
57-
return true;
58-
#elif defined(NDEBUG)
52+
#if !defined(STANDALONE)
53+
// The DLL is delay loaded (see BUILD.gn), so we can load
54+
// the correct ones from Chrome's swiftshader subdirectory.
55+
HMODULE libvulkan = LoadLibraryA("swiftshader\\libvulkan.dll");
56+
EXPECT_NE((HMODULE)NULL, libvulkan);
57+
return true;
58+
#elif defined(NDEBUG)
5959
#if defined(_WIN64)
60-
return load("./build/Release_Win64/vk_swiftshader.dll") ||
60+
return load("./build/Release_x64/vk_swiftshader.dll") ||
6161
#else
6262
return load("./build/Release_Win32/vk_swiftshader.dll") ||
6363
#endif
6464
load("./build/Release/libvk_swiftshader.dll");
65-
#else
65+
#else
6666
#if defined(_WIN64)
67-
return load("./build/Debug_Win64/vk_swiftshader.dll") ||
67+
return load("./build/Debug_x64/vk_swiftshader.dll") ||
6868
#else
6969
return load("./build/Debug_Win32/vk_swiftshader.dll") ||
7070
#endif
7171
load("./build/Debug/libvk_swiftshader.dll");
72-
#endif
72+
#endif
7373
#elif OS_MAC
74-
#if defined(STANDALONE)
75-
return load("./build/Darwin/libvk_swiftshader.dylib");
76-
#else
77-
return load("libvulkan.dylib");
78-
#endif
74+
return load("./build/Darwin/libvk_swiftshader.dylib") ||
75+
load("swiftshader/libvulkan.dylib");
7976
#elif OS_LINUX
80-
#if defined(STANDALONE)
81-
return load("./build/Linux/libvk_swiftshader.so");
82-
#else
83-
return load("libvulkan.so");
84-
#endif
77+
return load("./build/Linux/libvk_swiftshader.so") ||
78+
load("swiftshader/libvulkan.so") ||
79+
load("libvk_swiftshader.so");
8580
#elif OS_ANDROID
86-
return load("libvk_swiftshader.so");
81+
return load("libvk_swiftshader.so");
8782
#else
88-
# error Unimplemented platform
83+
#error Unimplemented platform
8984
#endif
9085
}
9186

0 commit comments

Comments
 (0)