summaryrefslogtreecommitdiff
path: root/drivers/vulkan/vulkan_context.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/vulkan/vulkan_context.h')
-rw-r--r--drivers/vulkan/vulkan_context.h33
1 files changed, 30 insertions, 3 deletions
diff --git a/drivers/vulkan/vulkan_context.h b/drivers/vulkan/vulkan_context.h
index ae7c697be8..8c0111714c 100644
--- a/drivers/vulkan/vulkan_context.h
+++ b/drivers/vulkan/vulkan_context.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -37,6 +37,7 @@
#include "core/templates/map.h"
#include "core/templates/rid_owner.h"
#include "servers/display_server.h"
+#include "servers/rendering/rendering_device.h"
#ifdef USE_VOLK
#include <volk.h>
@@ -44,6 +45,8 @@
#include <vulkan/vulkan.h>
#endif
+#include "vulkan_hooks.h"
+
class VulkanContext {
public:
struct SubgroupCapabilities {
@@ -66,6 +69,18 @@ public:
uint32_t max_instance_count;
};
+ struct ShaderCapabilities {
+ bool shader_float16_is_supported;
+ bool shader_int8_is_supported;
+ };
+
+ struct StorageBufferCapabilities {
+ bool storage_buffer_16_bit_access_is_supported;
+ bool uniform_and_storage_buffer_16_bit_access_is_supported;
+ bool storage_push_constant_16_is_supported;
+ bool storage_input_output_16;
+ };
+
private:
enum {
MAX_EXTENSIONS = 128,
@@ -73,6 +88,7 @@ private:
FRAME_LAG = 2
};
+ static VulkanHooks *vulkan_hooks;
VkInstance inst = VK_NULL_HANDLE;
VkPhysicalDevice gpu = VK_NULL_HANDLE;
VkPhysicalDeviceProperties gpu_props;
@@ -88,9 +104,12 @@ private:
uint32_t vulkan_patch = 0;
SubgroupCapabilities subgroup_capabilities;
MultiviewCapabilities multiview_capabilities;
+ ShaderCapabilities shader_capabilities;
+ StorageBufferCapabilities storage_buffer_capabilities;
String device_vendor;
String device_name;
+ VkPhysicalDeviceType device_type;
String pipeline_cache_id;
uint32_t device_api_version = 0;
@@ -212,7 +231,9 @@ private:
const char *pMessage,
void *pUserData);
- Error _create_physical_device();
+ Error _create_instance();
+
+ Error _create_physical_device(VkSurfaceKHR p_surface);
Error _initialize_queues(VkSurfaceKHR p_surface);
@@ -239,6 +260,8 @@ public:
uint32_t get_vulkan_minor() const { return vulkan_minor; };
SubgroupCapabilities get_subgroup_capabilities() const { return subgroup_capabilities; };
MultiviewCapabilities get_multiview_capabilities() const { return multiview_capabilities; };
+ ShaderCapabilities get_shader_capabilities() const { return shader_capabilities; };
+ StorageBufferCapabilities get_storage_buffer_capabilities() const { return storage_buffer_capabilities; };
VkDevice get_device();
VkPhysicalDevice get_physical_device();
@@ -247,9 +270,12 @@ public:
VkQueue get_graphics_queue() const;
uint32_t get_graphics_queue_family_index() const;
+ static void set_vulkan_hooks(VulkanHooks *p_vulkan_hooks) { vulkan_hooks = p_vulkan_hooks; };
+
void window_resize(DisplayServer::WindowID p_window_id, int p_width, int p_height);
int window_get_width(DisplayServer::WindowID p_window = 0);
int window_get_height(DisplayServer::WindowID p_window = 0);
+ bool window_is_valid_swapchain(DisplayServer::WindowID p_window = 0);
void window_destroy(DisplayServer::WindowID p_window_id);
VkFramebuffer window_get_framebuffer(DisplayServer::WindowID p_window = 0);
VkRenderPass window_get_render_pass(DisplayServer::WindowID p_window = 0);
@@ -278,6 +304,7 @@ public:
String get_device_vendor_name() const;
String get_device_name() const;
+ RenderingDevice::DeviceType get_device_type() const;
String get_device_pipeline_cache_uuid() const;
void set_vsync_mode(DisplayServer::WindowID p_window, DisplayServer::VSyncMode p_mode);