mirror of
https://github.com/godotengine/godot.git
synced 2025-01-22 10:32:54 -05:00
Move Vulkan includes to a central godot_vulkan.h header
Also fixes Vulkan build problem with recent Clang.
This commit is contained in:
parent
1fc8208765
commit
146ba4106f
14 changed files with 64 additions and 69 deletions
42
drivers/vulkan/godot_vulkan.h
Normal file
42
drivers/vulkan/godot_vulkan.h
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
/**************************************************************************/
|
||||||
|
/* godot_vulkan.h */
|
||||||
|
/**************************************************************************/
|
||||||
|
/* This file is part of: */
|
||||||
|
/* GODOT ENGINE */
|
||||||
|
/* https://godotengine.org */
|
||||||
|
/**************************************************************************/
|
||||||
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||||
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||||
|
/* */
|
||||||
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||||
|
/* a copy of this software and associated documentation files (the */
|
||||||
|
/* "Software"), to deal in the Software without restriction, including */
|
||||||
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||||
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||||
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||||
|
/* the following conditions: */
|
||||||
|
/* */
|
||||||
|
/* The above copyright notice and this permission notice shall be */
|
||||||
|
/* included in all copies or substantial portions of the Software. */
|
||||||
|
/* */
|
||||||
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||||
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||||
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||||
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||||
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||||
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
|
/**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef GODOT_VULKAN_H
|
||||||
|
#define GODOT_VULKAN_H
|
||||||
|
|
||||||
|
#ifdef USE_VOLK
|
||||||
|
#include <volk.h>
|
||||||
|
#else
|
||||||
|
#include <stdint.h>
|
||||||
|
#define VK_NO_STDINT_H
|
||||||
|
#include <vulkan/vulkan.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // GODOT_VULKAN_H
|
|
@ -40,11 +40,7 @@
|
||||||
#define VK_TRACK_DEVICE_MEMORY
|
#define VK_TRACK_DEVICE_MEMORY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_VOLK
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class RenderingContextDriverVulkan : public RenderingContextDriver {
|
class RenderingContextDriverVulkan : public RenderingContextDriver {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -43,11 +43,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include "thirdparty/vulkan/vk_mem_alloc.h"
|
#include "thirdparty/vulkan/vk_mem_alloc.h"
|
||||||
|
|
||||||
#ifdef USE_VOLK
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Design principles:
|
// Design principles:
|
||||||
// - Vulkan structs are zero-initialized and fields not requiring a non-zero value are omitted (except in cases where expresivity reasons apply).
|
// - Vulkan structs are zero-initialized and fields not requiring a non-zero value are omitted (except in cases where expresivity reasons apply).
|
||||||
|
|
|
@ -31,11 +31,7 @@
|
||||||
#ifndef VULKAN_HOOKS_H
|
#ifndef VULKAN_HOOKS_H
|
||||||
#define VULKAN_HOOKS_H
|
#define VULKAN_HOOKS_H
|
||||||
|
|
||||||
#ifdef USE_VOLK
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class VulkanHooks {
|
class VulkanHooks {
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -32,11 +32,7 @@
|
||||||
|
|
||||||
#ifdef VULKAN_ENABLED
|
#ifdef VULKAN_ENABLED
|
||||||
|
|
||||||
#ifdef USE_VOLK
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *RenderingContextDriverVulkanAndroid::_get_platform_surface_extension() const {
|
const char *RenderingContextDriverVulkanAndroid::_get_platform_surface_extension() const {
|
||||||
return VK_KHR_ANDROID_SURFACE_EXTENSION_NAME;
|
return VK_KHR_ANDROID_SURFACE_EXTENSION_NAME;
|
||||||
|
|
|
@ -41,11 +41,7 @@
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
#import "rendering_context_driver_vulkan_ios.h"
|
#import "rendering_context_driver_vulkan_ios.h"
|
||||||
|
|
||||||
#ifdef USE_VOLK
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
#endif // VULKAN_ENABLED
|
#endif // VULKAN_ENABLED
|
||||||
|
|
||||||
#if defined(METAL_ENABLED)
|
#if defined(METAL_ENABLED)
|
||||||
|
|
|
@ -56,11 +56,7 @@
|
||||||
#import <QuartzCore/CAMetalLayer.h>
|
#import <QuartzCore/CAMetalLayer.h>
|
||||||
|
|
||||||
#if defined(VULKAN_ENABLED)
|
#if defined(VULKAN_ENABLED)
|
||||||
#ifdef USE_VOLK
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
#endif // VULKAN_ENABLED
|
#endif // VULKAN_ENABLED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -32,11 +32,7 @@
|
||||||
|
|
||||||
#include "rendering_context_driver_vulkan_wayland.h"
|
#include "rendering_context_driver_vulkan_wayland.h"
|
||||||
|
|
||||||
#ifdef USE_VOLK
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *RenderingContextDriverVulkanWayland::_get_platform_surface_extension() const {
|
const char *RenderingContextDriverVulkanWayland::_get_platform_surface_extension() const {
|
||||||
return VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME;
|
return VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME;
|
||||||
|
|
|
@ -32,11 +32,7 @@
|
||||||
|
|
||||||
#include "rendering_context_driver_vulkan_x11.h"
|
#include "rendering_context_driver_vulkan_x11.h"
|
||||||
|
|
||||||
#ifdef USE_VOLK
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *RenderingContextDriverVulkanX11::_get_platform_surface_extension() const {
|
const char *RenderingContextDriverVulkanX11::_get_platform_surface_extension() const {
|
||||||
return VK_KHR_XLIB_SURFACE_EXTENSION_NAME;
|
return VK_KHR_XLIB_SURFACE_EXTENSION_NAME;
|
||||||
|
|
|
@ -34,11 +34,7 @@
|
||||||
|
|
||||||
#include "rendering_context_driver_vulkan_windows.h"
|
#include "rendering_context_driver_vulkan_windows.h"
|
||||||
|
|
||||||
#ifdef USE_VOLK
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *RenderingContextDriverVulkanWindows::_get_platform_surface_extension() const {
|
const char *RenderingContextDriverVulkanWindows::_get_platform_surface_extension() const {
|
||||||
return VK_KHR_WIN32_SURFACE_EXTENSION_NAME;
|
return VK_KHR_WIN32_SURFACE_EXTENSION_NAME;
|
||||||
|
|
|
@ -1,17 +1,13 @@
|
||||||
diff --git a/thirdparty/vulkan/vk_enum_string_helper.h b/thirdparty/vulkan/vk_enum_string_helper.h
|
diff --git a/thirdparty/vulkan/vk_enum_string_helper.h b/thirdparty/vulkan/vk_enum_string_helper.h
|
||||||
index 9d2af46344..d61dbb1290 100644
|
index 8026787ad4..7a54b12a38 100644
|
||||||
--- a/thirdparty/vulkan/vk_enum_string_helper.h
|
--- a/thirdparty/vulkan/vk_enum_string_helper.h
|
||||||
+++ b/thirdparty/vulkan/vk_enum_string_helper.h
|
+++ b/thirdparty/vulkan/vk_enum_string_helper.h
|
||||||
@@ -13,7 +13,11 @@
|
@@ -13,7 +13,7 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include <string>
|
#include <string>
|
||||||
#endif
|
#endif
|
||||||
-#include <vulkan/vulkan.h>
|
-#include <vulkan/vulkan.h>
|
||||||
+#ifdef USE_VOLK
|
+#include "drivers/vulkan/godot_vulkan.h"
|
||||||
+ #include <volk.h>
|
|
||||||
+#else
|
|
||||||
+ #include <vulkan/vulkan.h>
|
|
||||||
+#endif
|
|
||||||
static inline const char* string_VkResult(VkResult input_value) {
|
static inline const char* string_VkResult(VkResult input_value) {
|
||||||
switch (input_value) {
|
switch (input_value) {
|
||||||
case VK_SUCCESS:
|
case VK_SUCCESS:
|
|
@ -1,17 +1,18 @@
|
||||||
diff --git a/thirdparty/vulkan/vk_mem_alloc.h b/thirdparty/vulkan/vk_mem_alloc.h
|
diff --git a/thirdparty/vulkan/vk_mem_alloc.h b/thirdparty/vulkan/vk_mem_alloc.h
|
||||||
index 711f486571..e5eaa80e74 100644
|
index 2307325d4e..ecb84094b9 100644
|
||||||
--- a/thirdparty/vulkan/vk_mem_alloc.h
|
--- a/thirdparty/vulkan/vk_mem_alloc.h
|
||||||
+++ b/thirdparty/vulkan/vk_mem_alloc.h
|
+++ b/thirdparty/vulkan/vk_mem_alloc.h
|
||||||
@@ -127,7 +127,11 @@ See documentation chapter: \ref statistics.
|
@@ -122,12 +122,12 @@ for user-defined purpose without allocating any real GPU memory.
|
||||||
|
See documentation chapter: \ref statistics.
|
||||||
|
*/
|
||||||
|
|
||||||
|
+#include "drivers/vulkan/godot_vulkan.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
-#include <vulkan/vulkan.h>
|
-#include <vulkan/vulkan.h>
|
||||||
+#ifdef USE_VOLK
|
|
||||||
+ #include <volk.h>
|
|
||||||
+#else
|
|
||||||
+ #include <vulkan/vulkan.h>
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
#if !defined(VMA_VULKAN_VERSION)
|
#if !defined(VMA_VULKAN_VERSION)
|
||||||
#if defined(VK_VERSION_1_3)
|
#if defined(VK_VERSION_1_3)
|
6
thirdparty/vulkan/vk_enum_string_helper.h
vendored
6
thirdparty/vulkan/vk_enum_string_helper.h
vendored
|
@ -13,11 +13,7 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include <string>
|
#include <string>
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_VOLK
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
static inline const char* string_VkResult(VkResult input_value) {
|
static inline const char* string_VkResult(VkResult input_value) {
|
||||||
switch (input_value) {
|
switch (input_value) {
|
||||||
case VK_SUCCESS:
|
case VK_SUCCESS:
|
||||||
|
|
6
thirdparty/vulkan/vk_mem_alloc.h
vendored
6
thirdparty/vulkan/vk_mem_alloc.h
vendored
|
@ -122,16 +122,12 @@ for user-defined purpose without allocating any real GPU memory.
|
||||||
See documentation chapter: \ref statistics.
|
See documentation chapter: \ref statistics.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "drivers/vulkan/godot_vulkan.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_VOLK
|
|
||||||
#include <volk.h>
|
|
||||||
#else
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(VMA_VULKAN_VERSION)
|
#if !defined(VMA_VULKAN_VERSION)
|
||||||
#if defined(VK_VERSION_1_3)
|
#if defined(VK_VERSION_1_3)
|
||||||
|
|
Loading…
Reference in a new issue