From 31194f5b1c84638267958c8efa9212f362e57ae0 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sat, 31 Jul 2021 15:39:46 +0200 Subject: Add `get_video_adapter_api_version()` to RenderingServer This method can be used to get the graphics API version currently in use (such as Vulkan). It can be used by projects for troubleshooting or statistical purposes. --- drivers/vulkan/rendering_device_vulkan.cpp | 5 +++++ drivers/vulkan/rendering_device_vulkan.h | 1 + drivers/vulkan/vulkan_context.cpp | 5 +++++ drivers/vulkan/vulkan_context.h | 1 + 4 files changed, 12 insertions(+) (limited to 'drivers/vulkan') diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index 59b4c34c3f..5102eab979 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -8649,6 +8649,7 @@ void RenderingDeviceVulkan::draw_command_end_label() { String RenderingDeviceVulkan::get_device_vendor_name() const { return context->get_device_vendor_name(); } + String RenderingDeviceVulkan::get_device_name() const { return context->get_device_name(); } @@ -8657,6 +8658,10 @@ RenderingDevice::DeviceType RenderingDeviceVulkan::get_device_type() const { return context->get_device_type(); } +String RenderingDeviceVulkan::get_device_api_version() const { + return context->get_device_api_version(); +} + String RenderingDeviceVulkan::get_device_pipeline_cache_uuid() const { return context->get_device_pipeline_cache_uuid(); } diff --git a/drivers/vulkan/rendering_device_vulkan.h b/drivers/vulkan/rendering_device_vulkan.h index 219d48a9f5..236742c15d 100644 --- a/drivers/vulkan/rendering_device_vulkan.h +++ b/drivers/vulkan/rendering_device_vulkan.h @@ -1229,6 +1229,7 @@ public: virtual String get_device_vendor_name() const; virtual String get_device_name() const; virtual RenderingDevice::DeviceType get_device_type() const; + virtual String get_device_api_version() const; virtual String get_device_pipeline_cache_uuid() const; virtual uint64_t get_driver_resource(DriverResource p_resource, RID p_rid = RID(), uint64_t p_index = 0); diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp index a09a757842..7944057041 100644 --- a/drivers/vulkan/vulkan_context.cpp +++ b/drivers/vulkan/vulkan_context.cpp @@ -2364,6 +2364,7 @@ void VulkanContext::set_object_name(VkObjectType p_object_type, uint64_t p_objec String VulkanContext::get_device_vendor_name() const { return device_vendor; } + String VulkanContext::get_device_name() const { return device_name; } @@ -2372,6 +2373,10 @@ RenderingDevice::DeviceType VulkanContext::get_device_type() const { return RenderingDevice::DeviceType(device_type); } +String VulkanContext::get_device_api_version() const { + return vformat("%d.%d.%d", vulkan_major, vulkan_minor, vulkan_patch); +} + String VulkanContext::get_device_pipeline_cache_uuid() const { return pipeline_cache_id; } diff --git a/drivers/vulkan/vulkan_context.h b/drivers/vulkan/vulkan_context.h index 365ee3c9b0..6858eb7524 100644 --- a/drivers/vulkan/vulkan_context.h +++ b/drivers/vulkan/vulkan_context.h @@ -305,6 +305,7 @@ public: String get_device_vendor_name() const; String get_device_name() const; RenderingDevice::DeviceType get_device_type() const; + String get_device_api_version() const; String get_device_pipeline_cache_uuid() const; void set_vsync_mode(DisplayServer::WindowID p_window, DisplayServer::VSyncMode p_mode); -- cgit v1.2.3