Vulkan: Load functions for surface extensions we support.
Previously the surface extensions were only enabled so we could import VkSurfaceKHR's created from GLFW. To implement the webgpu.h surface-based swapchains, we are going to use the extension entrypoints too. This changes vulkan_platform.h to set defines that make vulkan.h expose the entrypoints and datatypes for all the Vulkan extensions we might care about for a given compilation configuration. Bug: dawn:269 Change-Id: If4202ff5e31c816eccb5f5381bd36b660a3b6c5b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17964 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
12944c84c9
commit
ba53617f6f
|
@ -143,6 +143,31 @@ namespace dawn_native { namespace vulkan {
|
|||
} \
|
||||
} // namespace dawn_native::vulkan
|
||||
|
||||
// Import additional parts of Vulkan that are supported on our architecture and preemptively include
|
||||
// headers that vulkan.h includes that we have "undefs" for.
|
||||
#if defined(DAWN_PLATFORM_WINDOWS)
|
||||
# define VK_USE_PLATFORM_WIN32_KHR
|
||||
# include "common/windows_with_undefs.h"
|
||||
#endif // DAWN_PLATFORM_WINDOWS
|
||||
|
||||
#if defined(DAWN_USE_X11)
|
||||
# define VK_USE_PLATFORM_XLIB_KHR
|
||||
# include "common/xlib_with_undefs.h"
|
||||
#endif // defined(DAWN_USE_X11)
|
||||
|
||||
#if defined(DAWN_ENABLE_BACKEND_METAL)
|
||||
# define VK_USE_PLATFORM_METAL_EXT
|
||||
#endif // defined(DAWN_ENABLE_BACKEND_METAL)
|
||||
|
||||
#if defined(DAWN_PLATFORM_ANDROID)
|
||||
# define VK_USE_PLATFORM_ANDROID_KHR
|
||||
#endif // defined(DAWN_PLATFORM_ANDROID)
|
||||
|
||||
#if defined(DAWN_PLATFORM_FUCHSIA)
|
||||
# define VK_USE_PLATFORM_FUCHSIA
|
||||
#endif // defined(DAWN_PLATFORM_FUCHSIA)
|
||||
|
||||
// The actual inclusion of vulkan.h!
|
||||
#define VK_NO_PROTOTYPES
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
|
@ -156,18 +181,9 @@ static constexpr uint64_t VK_NULL_HANDLE = 0;
|
|||
# error "Unsupported platform"
|
||||
#endif
|
||||
|
||||
// Remove windows.h macros after vulkan_platform's include of windows.h
|
||||
#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_USE_X11)
|
||||
# include "common/xlib_with_undefs.h"
|
||||
#endif
|
||||
|
||||
// Include Fuchsia-specific definitions that are not upstreamed yet.
|
||||
#if defined(DAWN_PLATFORM_FUCHSIA)
|
||||
# include <vulkan/vulkan_fuchsia_extras.h>
|
||||
#endif
|
||||
#endif // defined(DAWN_PLATFORM_FUCHSIA)
|
||||
|
||||
#endif // COMMON_VULKANPLATFORM_H_
|
||||
|
|
|
@ -116,12 +116,31 @@ namespace dawn_native { namespace vulkan {
|
|||
GET_INSTANCE_PROC(GetPhysicalDeviceSurfacePresentModesKHR);
|
||||
}
|
||||
|
||||
#ifdef VK_USE_PLATFORM_FUCHSIA
|
||||
#if defined(VK_USE_PLATFORM_FUCHSIA)
|
||||
if (globalInfo.fuchsiaImagePipeSurface) {
|
||||
GET_INSTANCE_PROC(CreateImagePipeSurfaceFUCHSIA);
|
||||
}
|
||||
#endif
|
||||
#endif // defined(VK_USE_PLATFORM_FUCHSIA)
|
||||
|
||||
#if defined(DAWN_ENABLE_BACKEND_METAL)
|
||||
if (globalInfo.metalSurface) {
|
||||
GET_INSTANCE_PROC(CreateMetalSurfaceEXT);
|
||||
}
|
||||
#endif // defined(DAWN_ENABLE_BACKEND_METAL)
|
||||
|
||||
#if defined(DAWN_PLATFORM_WINDOWS)
|
||||
if (globalInfo.win32Surface) {
|
||||
GET_INSTANCE_PROC(CreateWin32SurfaceKHR);
|
||||
GET_INSTANCE_PROC(GetPhysicalDeviceWin32PresentationSupportKHR);
|
||||
}
|
||||
#endif // defined(DAWN_PLATFORM_WINDOWS)
|
||||
|
||||
#if defined(DAWN_USE_X11)
|
||||
if (globalInfo.xlibSurface) {
|
||||
GET_INSTANCE_PROC(CreateXlibSurfaceKHR);
|
||||
GET_INSTANCE_PROC(GetPhysicalDeviceXlibPresentationSupportKHR);
|
||||
}
|
||||
#endif // defined(DAWN_USE_X11)
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -107,10 +107,29 @@ namespace dawn_native { namespace vulkan {
|
|||
PFN_vkGetPhysicalDeviceSparseImageFormatProperties2
|
||||
GetPhysicalDeviceSparseImageFormatProperties2 = nullptr;
|
||||
|
||||
#ifdef VK_USE_PLATFORM_FUCHSIA
|
||||
#if defined(VK_USE_PLATFORM_FUCHSIA)
|
||||
// FUCHSIA_image_pipe_surface
|
||||
PFN_vkCreateImagePipeSurfaceFUCHSIA CreateImagePipeSurfaceFUCHSIA = nullptr;
|
||||
#endif
|
||||
#endif // defined(VK_USE_PLATFORM_FUCHSIA)
|
||||
|
||||
#if defined(DAWN_ENABLE_BACKEND_METAL)
|
||||
// EXT_metal_surface
|
||||
PFN_vkCreateMetalSurfaceEXT CreateMetalSurfaceEXT = nullptr;
|
||||
#endif // defined(DAWN_ENABLE_BACKEND_METAL)
|
||||
|
||||
#if defined(DAWN_PLATFORM_WINDOWS)
|
||||
// KHR_win32_surface
|
||||
PFN_vkCreateWin32SurfaceKHR CreateWin32SurfaceKHR = nullptr;
|
||||
PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR
|
||||
GetPhysicalDeviceWin32PresentationSupportKHR = nullptr;
|
||||
#endif // defined(DAWN_PLATFORM_WINDOWS)
|
||||
|
||||
#if defined(DAWN_USE_X11)
|
||||
// KHR_xlib_surface
|
||||
PFN_vkCreateXlibSurfaceKHR CreateXlibSurfaceKHR = nullptr;
|
||||
PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR
|
||||
GetPhysicalDeviceXlibPresentationSupportKHR = nullptr;
|
||||
#endif // defined(DAWN_USE_X11)
|
||||
|
||||
// ---------- Device procs
|
||||
|
||||
|
|
|
@ -27,18 +27,6 @@ config("khronos_headers_public") {
|
|||
|
||||
config("vulkan_headers_config") {
|
||||
include_dirs = [ "khronos" ]
|
||||
if (is_win) {
|
||||
defines = [ "VK_USE_PLATFORM_WIN32_KHR" ]
|
||||
}
|
||||
if (is_linux && !is_chromeos) {
|
||||
defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
|
||||
}
|
||||
if (is_android) {
|
||||
defines = [ "VK_USE_PLATFORM_ANDROID_KHR" ]
|
||||
}
|
||||
if (is_fuchsia) {
|
||||
defines = [ "VK_USE_PLATFORM_FUCHSIA" ]
|
||||
}
|
||||
}
|
||||
|
||||
source_set("vulkan_headers") {
|
||||
|
|
Loading…
Reference in New Issue