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.
This commit is contained in:
Hugo Locurcio
2021-12-10 17:01:51 +01:00
parent 85380c5207
commit b3174e7af9
18 changed files with 80 additions and 0 deletions

View File

@@ -762,6 +762,7 @@ Error VulkanContext::_create_physical_device() {
{ 0, nullptr },
};
device_name = gpu_props.deviceName;
device_type = gpu_props.deviceType;
pipeline_cache_id = String::hex_encode_buffer(gpu_props.pipelineCacheUUID, VK_UUID_SIZE);
pipeline_cache_id += "-driver-" + itos(gpu_props.driverVersion);
{
@@ -2210,6 +2211,11 @@ String VulkanContext::get_device_vendor_name() const {
String VulkanContext::get_device_name() const {
return device_name;
}
RenderingDevice::DeviceType VulkanContext::get_device_type() const {
return RenderingDevice::DeviceType(device_type);
}
String VulkanContext::get_device_pipeline_cache_uuid() const {
return pipeline_cache_id;
}