summaryrefslogtreecommitdiff
path: root/servers/rendering
diff options
context:
space:
mode:
Diffstat (limited to 'servers/rendering')
-rw-r--r--servers/rendering/rasterizer_dummy.h1
-rw-r--r--servers/rendering/renderer_rd/renderer_storage_rd.cpp5
-rw-r--r--servers/rendering/renderer_rd/renderer_storage_rd.h1
-rw-r--r--servers/rendering/renderer_storage.h1
-rw-r--r--servers/rendering/rendering_device.cpp7
-rw-r--r--servers/rendering/rendering_device.h13
-rw-r--r--servers/rendering/rendering_server_default.cpp4
-rw-r--r--servers/rendering/rendering_server_default.h1
8 files changed, 33 insertions, 0 deletions
diff --git a/servers/rendering/rasterizer_dummy.h b/servers/rendering/rasterizer_dummy.h
index 982fec3df1..39d1debd40 100644
--- a/servers/rendering/rasterizer_dummy.h
+++ b/servers/rendering/rasterizer_dummy.h
@@ -704,6 +704,7 @@ public:
String get_video_adapter_name() const override { return String(); }
String get_video_adapter_vendor() const override { return String(); }
+ RenderingDevice::DeviceType get_video_adapter_type() const override { return RenderingDevice::DeviceType::DEVICE_TYPE_OTHER; }
static RendererStorage *base_singleton;
diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
index 67ed815497..587ed4cad9 100644
--- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
@@ -9532,10 +9532,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 234127c269..21ac0ad298 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);
diff --git a/servers/rendering/renderer_storage.h b/servers/rendering/renderer_storage.h
index a50ff5f577..43a7778d67 100644
--- a/servers/rendering/renderer_storage.h
+++ b/servers/rendering/renderer_storage.h
@@ -620,6 +620,7 @@ public:
virtual uint64_t get_rendering_info(RS::RenderingInfo p_info) = 0;
virtual String get_video_adapter_name() const = 0;
virtual String get_video_adapter_vendor() const = 0;
+ virtual RenderingDevice::DeviceType get_video_adapter_type() const = 0;
static RendererStorage *base_singleton;
diff --git a/servers/rendering/rendering_device.cpp b/servers/rendering/rendering_device.cpp
index cc2856f159..88a8dfe694 100644
--- a/servers/rendering/rendering_device.cpp
+++ b/servers/rendering/rendering_device.cpp
@@ -490,6 +490,13 @@ void RenderingDevice::_bind_methods() {
BIND_CONSTANT(BARRIER_MASK_ALL);
BIND_CONSTANT(BARRIER_MASK_NO_BARRIER);
+ BIND_ENUM_CONSTANT(DEVICE_TYPE_OTHER);
+ BIND_ENUM_CONSTANT(DEVICE_TYPE_INTEGRATED_GPU);
+ BIND_ENUM_CONSTANT(DEVICE_TYPE_DISCRETE_GPU);
+ BIND_ENUM_CONSTANT(DEVICE_TYPE_VIRTUAL_GPU);
+ BIND_ENUM_CONSTANT(DEVICE_TYPE_CPU);
+ BIND_ENUM_CONSTANT(DEVICE_TYPE_MAX);
+
BIND_ENUM_CONSTANT(DRIVER_RESOURCE_VULKAN_DEVICE);
BIND_ENUM_CONSTANT(DRIVER_RESOURCE_VULKAN_PHYSICAL_DEVICE);
BIND_ENUM_CONSTANT(DRIVER_RESOURCE_VULKAN_INSTANCE);
diff --git a/servers/rendering/rendering_device.h b/servers/rendering/rendering_device.h
index 737c782776..313c0e11b2 100644
--- a/servers/rendering/rendering_device.h
+++ b/servers/rendering/rendering_device.h
@@ -60,6 +60,17 @@ public:
DEVICE_DIRECTX
};
+ // This enum matches VkPhysicalDeviceType (except for `DEVICE_TYPE_MAX`).
+ // Unlike VkPhysicalDeviceType, DeviceType is exposed to the scripting API.
+ enum DeviceType {
+ DEVICE_TYPE_OTHER,
+ DEVICE_TYPE_INTEGRATED_GPU,
+ DEVICE_TYPE_DISCRETE_GPU,
+ DEVICE_TYPE_VIRTUAL_GPU,
+ DEVICE_TYPE_CPU,
+ DEVICE_TYPE_MAX,
+ };
+
enum DriverResource {
DRIVER_RESOURCE_VULKAN_DEVICE = 0,
DRIVER_RESOURCE_VULKAN_PHYSICAL_DEVICE,
@@ -1199,6 +1210,7 @@ public:
virtual String get_device_vendor_name() const = 0;
virtual String get_device_name() const = 0;
+ virtual RenderingDevice::DeviceType get_device_type() const = 0;
virtual String get_device_pipeline_cache_uuid() const = 0;
virtual uint64_t get_driver_resource(DriverResource p_resource, RID p_rid = RID(), uint64_t p_index = 0) = 0;
@@ -1237,6 +1249,7 @@ protected:
Vector<int64_t> _draw_list_switch_to_next_pass_split(uint32_t p_splits);
};
+VARIANT_ENUM_CAST(RenderingDevice::DeviceType)
VARIANT_ENUM_CAST(RenderingDevice::DriverResource)
VARIANT_ENUM_CAST(RenderingDevice::ShaderStage)
VARIANT_ENUM_CAST(RenderingDevice::ShaderLanguage)
diff --git a/servers/rendering/rendering_server_default.cpp b/servers/rendering/rendering_server_default.cpp
index e60e507f87..d7e9d210db 100644
--- a/servers/rendering/rendering_server_default.cpp
+++ b/servers/rendering/rendering_server_default.cpp
@@ -255,6 +255,10 @@ String RenderingServerDefault::get_video_adapter_vendor() const {
return RSG::storage->get_video_adapter_vendor();
}
+RenderingDevice::DeviceType RenderingServerDefault::get_video_adapter_type() const {
+ return RSG::storage->get_video_adapter_type();
+}
+
void RenderingServerDefault::set_frame_profiling_enabled(bool p_enable) {
RSG::storage->capturing_timestamps = p_enable;
}
diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h
index 5a49733651..9e72a9983c 100644
--- a/servers/rendering/rendering_server_default.h
+++ b/servers/rendering/rendering_server_default.h
@@ -894,6 +894,7 @@ public:
virtual uint64_t get_rendering_info(RenderingInfo p_info) override;
virtual String get_video_adapter_name() const override;
virtual String get_video_adapter_vendor() const override;
+ virtual RenderingDevice::DeviceType get_video_adapter_type() const override;
virtual void set_frame_profiling_enabled(bool p_enable) override;
virtual Vector<FrameProfileArea> get_frame_profile() override;