From b3174e7af93e9840698bba53a5d866a61c37d2da Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 10 Dec 2021 17:01:51 +0100 Subject: Add `RenderingServer.get_video_adapter_type()` method This can be used to distinguish between integrated, dedicated, virtual and software-emulated GPUs. This in turn can be used to automatically adjust graphics settings, or warn users about features that may run slowly on their hardware. --- servers/rendering/renderer_rd/renderer_storage_rd.cpp | 5 +++++ servers/rendering/renderer_rd/renderer_storage_rd.h | 1 + 2 files changed, 6 insertions(+) (limited to 'servers/rendering/renderer_rd') diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp index 79728169ae..a6c17ed0c8 100644 --- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp @@ -9529,10 +9529,15 @@ uint64_t RendererStorageRD::get_rendering_info(RS::RenderingInfo p_info) { String RendererStorageRD::get_video_adapter_name() const { return RenderingDevice::get_singleton()->get_device_name(); } + String RendererStorageRD::get_video_adapter_vendor() const { return RenderingDevice::get_singleton()->get_device_vendor_name(); } +RenderingDevice::DeviceType RendererStorageRD::get_video_adapter_type() const { + return RenderingDevice::get_singleton()->get_device_type(); +} + RendererStorageRD *RendererStorageRD::base_singleton = nullptr; RendererStorageRD::RendererStorageRD() { diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.h b/servers/rendering/renderer_rd/renderer_storage_rd.h index 9a64480c3e..e918aec32f 100644 --- a/servers/rendering/renderer_rd/renderer_storage_rd.h +++ b/servers/rendering/renderer_rd/renderer_storage_rd.h @@ -2393,6 +2393,7 @@ public: String get_video_adapter_name() const; String get_video_adapter_vendor() const; + RenderingDevice::DeviceType get_video_adapter_type() const; virtual void capture_timestamps_begin(); virtual void capture_timestamp(const String &p_name); -- cgit v1.2.3