mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 10:49:14 +00:00
Enable Vulkan extensions for Linux, Windows, Android and Fuchsia.
This CL ensures that when <vulkan/vulkan.h> is included, the appropriate VK_USE_PLATFORM_XXX macro is defined to enable the declaration of platform-specific types and extensions. Note that for Linux, this requires an xlib_with_undefs.h header to remove annoying macros that are defined by <X11/X.h> (i.e. Success, Always, None) and which prevent compilation of other Dawn sources that use the same symbols as enum value names. Change-Id: I0c8d95fe8043d75ba3f74789e0fe2e3e4a477703 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8961 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: David Turner <digit@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
6eb681cc54
commit
8605d2eb86
@@ -145,6 +145,20 @@ class alignas(kNativeVkHandleAlignment) VkNonDispatchableHandle {
|
||||
static_assert(sizeof(object) == sizeof(object##Native), ""); \
|
||||
static_assert(alignof(object) == kNativeVkHandleAlignment, "");
|
||||
|
||||
// Ensure platform-specific extensions are declared appropriately.
|
||||
#if defined(DAWN_PLATFORM_LINUX)
|
||||
# define VK_USE_PLATFORM_XLIB_KHR
|
||||
# define VK_USE_PLATFORM_XCB_KHR
|
||||
// NOTE: For now the line below is undefined to take care of systems that don't
|
||||
// have the Wayland headers installed on the system.
|
||||
// # define VK_USE_PLATFORM_WAYLAND_KHR
|
||||
#elif defined(DAWN_PLATFORM_WINDOWS)
|
||||
# define VK_USE_PLATFORM_WIN32_KHR
|
||||
#elif defined(DAWN_PLATFORM_ANDROID)
|
||||
# define VK_USE_PLATFORM_ANDROID_KHR
|
||||
#elif defined(DAWN_PLATFORM_FUCHSIA)
|
||||
# define VK_USE_PLATFORM_FUCHSIA
|
||||
#endif
|
||||
# include <vulkan/vulkan.h>
|
||||
|
||||
// VK_NULL_HANDLE is defined to 0 but we don't want our handle type to compare to arbitrary
|
||||
@@ -156,5 +170,9 @@ class alignas(kNativeVkHandleAlignment) VkNonDispatchableHandle {
|
||||
#if defined(DAWN_PLATFORM_WINDOWS)
|
||||
# include "common/windows_with_undefs.h"
|
||||
#endif
|
||||
// Remove X11/Xlib.h macros after vulkan_platform's include of it.
|
||||
#if defined(DAWN_PLATFORM_LINUX)
|
||||
# include "common/xlib_with_undefs.h"
|
||||
#endif
|
||||
|
||||
#endif // COMMON_VULKANPLATFORM_H_
|
||||
|
||||
Reference in New Issue
Block a user