summaryrefslogtreecommitdiffstats
path: root/drivers/vulkan
diff options
context:
space:
mode:
authorGergely Kis <gergely.kis@migeran.com>2024-09-26 21:46:48 +0200
committerGergely Kis <gergely.kis@migeran.com>2024-09-29 17:53:18 +0200
commit146ba4106f459fd37d130a34da02ef737ac166e4 (patch)
tree979d8607da0f5e4dd38d051bd0abe56e88c9e5cb /drivers/vulkan
parent1fc82087658066935bed9e1350d62e334c7e0309 (diff)
downloadredot-engine-146ba4106f459fd37d130a34da02ef737ac166e4.tar.gz
Move Vulkan includes to a central godot_vulkan.h header
Also fixes Vulkan build problem with recent Clang.
Diffstat (limited to 'drivers/vulkan')
-rw-r--r--drivers/vulkan/godot_vulkan.h42
-rw-r--r--drivers/vulkan/rendering_context_driver_vulkan.h6
-rw-r--r--drivers/vulkan/rendering_device_driver_vulkan.h6
-rw-r--r--drivers/vulkan/vulkan_hooks.h6
4 files changed, 45 insertions, 15 deletions
diff --git a/drivers/vulkan/godot_vulkan.h b/drivers/vulkan/godot_vulkan.h
new file mode 100644
index 0000000000..f911c5520a
--- /dev/null
+++ b/drivers/vulkan/godot_vulkan.h
@@ -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
diff --git a/drivers/vulkan/rendering_context_driver_vulkan.h b/drivers/vulkan/rendering_context_driver_vulkan.h
index f9352d617b..26de386206 100644
--- a/drivers/vulkan/rendering_context_driver_vulkan.h
+++ b/drivers/vulkan/rendering_context_driver_vulkan.h
@@ -40,11 +40,7 @@
#define VK_TRACK_DEVICE_MEMORY
#endif
-#ifdef USE_VOLK
-#include <volk.h>
-#else
-#include <vulkan/vulkan.h>
-#endif
+#include "drivers/vulkan/godot_vulkan.h"
class RenderingContextDriverVulkan : public RenderingContextDriver {
public:
diff --git a/drivers/vulkan/rendering_device_driver_vulkan.h b/drivers/vulkan/rendering_device_driver_vulkan.h
index 81f4256941..cc15c0a0fe 100644
--- a/drivers/vulkan/rendering_device_driver_vulkan.h
+++ b/drivers/vulkan/rendering_device_driver_vulkan.h
@@ -43,11 +43,7 @@
#endif
#include "thirdparty/vulkan/vk_mem_alloc.h"
-#ifdef USE_VOLK
-#include <volk.h>
-#else
-#include <vulkan/vulkan.h>
-#endif
+#include "drivers/vulkan/godot_vulkan.h"
// Design principles:
// - Vulkan structs are zero-initialized and fields not requiring a non-zero value are omitted (except in cases where expresivity reasons apply).
diff --git a/drivers/vulkan/vulkan_hooks.h b/drivers/vulkan/vulkan_hooks.h
index bb30b29cec..82bcc9a064 100644
--- a/drivers/vulkan/vulkan_hooks.h
+++ b/drivers/vulkan/vulkan_hooks.h
@@ -31,11 +31,7 @@
#ifndef VULKAN_HOOKS_H
#define VULKAN_HOOKS_H
-#ifdef USE_VOLK
-#include <volk.h>
-#else
-#include <vulkan/vulkan.h>
-#endif
+#include "drivers/vulkan/godot_vulkan.h"
class VulkanHooks {
private: