diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-12-10 17:01:51 +0100 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-12-10 17:10:47 +0100 |
commit | b3174e7af93e9840698bba53a5d866a61c37d2da (patch) | |
tree | 794c5807f2a043bdc57ee7d1c66d2070cb484536 /doc/classes | |
parent | 85380c52073d679c088d61fc663ec62cbd85b453 (diff) |
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.
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/RenderingDevice.xml | 18 | ||||
-rw-r--r-- | doc/classes/RenderingServer.xml | 7 |
2 files changed, 25 insertions, 0 deletions
diff --git a/doc/classes/RenderingDevice.xml b/doc/classes/RenderingDevice.xml index 442dcc7d18..a15028b3fc 100644 --- a/doc/classes/RenderingDevice.xml +++ b/doc/classes/RenderingDevice.xml @@ -654,6 +654,24 @@ </constant> <constant name="BARRIER_MASK_NO_BARRIER" value="8"> </constant> + <constant name="DEVICE_TYPE_OTHER" value="0" enum="DeviceType"> + Rendering device type does not match any of the other enum values or is unknown. + </constant> + <constant name="DEVICE_TYPE_INTEGRATED_GPU" value="1" enum="DeviceType"> + Rendering device is an integrated GPU, which is typically [i](but not always)[/i] slower than dedicated GPUs ([constant DEVICE_TYPE_DISCRETE_GPU]). On Android and iOS, the rendering device type is always considered to be [constant DEVICE_TYPE_INTEGRATED_GPU]. + </constant> + <constant name="DEVICE_TYPE_DISCRETE_GPU" value="2" enum="DeviceType"> + Rendering device is a dedicated GPU, which is typically [i](but not always)[/i] faster than integrated GPUs ([constant DEVICE_TYPE_INTEGRATED_GPU]). + </constant> + <constant name="DEVICE_TYPE_VIRTUAL_GPU" value="3" enum="DeviceType"> + Rendering device is an emulated GPU in a virtual environment. This is typically much slower than the host GPU, which means the expected performance level on a dedicated GPU will be roughly equivalent to [constant DEVICE_TYPE_INTEGRATED_GPU]. Virtual machine GPU passthrough (such as VFIO) will not report the device type as [constant DEVICE_TYPE_VIRTUAL_GPU]. Instead, the host GPU's device type will be reported as if the GPU was not emulated. + </constant> + <constant name="DEVICE_TYPE_CPU" value="4" enum="DeviceType"> + Rendering device is provided by software emulation (such as Lavapipe or [url=https://github.com/google/swiftshader]SwiftShader[/url]). This is the slowest kind of rendering device available; it's typically much slower than [constant DEVICE_TYPE_INTEGRATED_GPU]. + </constant> + <constant name="DEVICE_TYPE_MAX" value="5" enum="DeviceType"> + Represents the size of the [enum DeviceType] enum. + </constant> <constant name="DRIVER_RESOURCE_VULKAN_DEVICE" value="0" enum="DriverResource"> </constant> <constant name="DRIVER_RESOURCE_VULKAN_PHYSICAL_DEVICE" value="1" enum="DriverResource"> diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml index 0700650a91..3dc4f4799b 100644 --- a/doc/classes/RenderingServer.xml +++ b/doc/classes/RenderingServer.xml @@ -1232,6 +1232,13 @@ [b]Note:[/b] When running a headless or server binary, this function returns an empty string. </description> </method> + <method name="get_video_adapter_type" qualifiers="const"> + <return type="int" enum="RenderingDevice.DeviceType" /> + <description> + Returns the type of the video adapter. Since dedicated graphics cards from a given generation will [i]usually[/i] be significantly faster than integrated graphics made in the same generation, the device type can be used as a basis for automatic graphics settings adjustment. However, this is not always true, so make sure to provide users with a way to manually override graphics settings. + [b]Note:[/b] When using the OpenGL backend or when running in headless mode, this function always returns [constant RenderingDevice.DEVICE_TYPE_OTHER]. + </description> + </method> <method name="get_video_adapter_vendor" qualifiers="const"> <return type="String" /> <description> |