forked from Mirrors/wine-wine
wined3d: Make wined3d_gpu_description from Vulkan physical device properties.
This fallback for cards that are not present in wined3d database should be quite accurate. Almost all information required to fill wined3d_gpu_description can be retrieved from Vulkan. The GPU description string is expected to be slightly different from Windows. Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>stable
parent
ace408edb4
commit
cf9623e68f
|
@ -618,34 +618,53 @@ static VkPhysicalDevice get_vulkan_physical_device(struct wined3d_vk_info *vk_in
|
||||||
return physical_devices[0];
|
return physical_devices[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct wined3d_gpu_description *get_vulkan_gpu_description(const VkPhysicalDeviceProperties *properties)
|
static enum wined3d_display_driver guess_display_driver(enum wined3d_pci_vendor vendor)
|
||||||
{
|
{
|
||||||
const struct wined3d_gpu_description *description;
|
switch (vendor)
|
||||||
|
{
|
||||||
|
case HW_VENDOR_AMD: return DRIVER_AMD_RX;
|
||||||
|
case HW_VENDOR_INTEL: return DRIVER_INTEL_HD4000;
|
||||||
|
case HW_VENDOR_NVIDIA: return DRIVER_NVIDIA_GEFORCE8;
|
||||||
|
default: return DRIVER_WINE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void adapter_vk_init_driver_info(struct wined3d_adapter *adapter,
|
||||||
|
const VkPhysicalDeviceProperties *properties)
|
||||||
|
{
|
||||||
|
const struct wined3d_gpu_description *gpu_description;
|
||||||
|
struct wined3d_gpu_description description;
|
||||||
|
|
||||||
TRACE("Device name: %s.\n", debugstr_a(properties->deviceName));
|
TRACE("Device name: %s.\n", debugstr_a(properties->deviceName));
|
||||||
TRACE("Vendor ID: 0x%04x, Device ID: 0x%04x.\n", properties->vendorID, properties->deviceID);
|
TRACE("Vendor ID: 0x%04x, Device ID: 0x%04x.\n", properties->vendorID, properties->deviceID);
|
||||||
TRACE("Driver version: %#x.\n", properties->driverVersion);
|
TRACE("Driver version: %#x.\n", properties->driverVersion);
|
||||||
TRACE("API version: %s.\n", debug_vk_version(properties->apiVersion));
|
TRACE("API version: %s.\n", debug_vk_version(properties->apiVersion));
|
||||||
|
|
||||||
if (!(description = wined3d_get_user_override_gpu_description(properties->vendorID, properties->deviceID)))
|
if (!(gpu_description = wined3d_get_user_override_gpu_description(properties->vendorID, properties->deviceID)))
|
||||||
description = wined3d_get_gpu_description(properties->vendorID, properties->deviceID);
|
gpu_description = wined3d_get_gpu_description(properties->vendorID, properties->deviceID);
|
||||||
|
|
||||||
if (!description)
|
/* FIXME: Get vidmem from Vulkan. */
|
||||||
|
if (!gpu_description)
|
||||||
{
|
{
|
||||||
FIXME("Failed to retrieve GPU description for device %s %04x:%04x.\n",
|
FIXME("Failed to retrieve GPU description for device %s %04x:%04x.\n",
|
||||||
debugstr_a(properties->deviceName), properties->vendorID, properties->deviceID);
|
debugstr_a(properties->deviceName), properties->vendorID, properties->deviceID);
|
||||||
|
|
||||||
description = wined3d_get_gpu_description(HW_VENDOR_AMD, CARD_AMD_RADEON_RX_VEGA);
|
description.vendor = properties->vendorID;
|
||||||
|
description.device = properties->deviceID;
|
||||||
|
description.description = properties->deviceName;
|
||||||
|
description.driver = guess_display_driver(properties->vendorID);
|
||||||
|
description.vidmem = 0;
|
||||||
|
|
||||||
|
gpu_description = &description;
|
||||||
}
|
}
|
||||||
|
|
||||||
return description;
|
wined3d_driver_info_init(&adapter->driver_info, gpu_description, wined3d_settings.emulated_textureram);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL wined3d_adapter_vk_init(struct wined3d_adapter_vk *adapter_vk,
|
static BOOL wined3d_adapter_vk_init(struct wined3d_adapter_vk *adapter_vk,
|
||||||
unsigned int ordinal, unsigned int wined3d_creation_flags)
|
unsigned int ordinal, unsigned int wined3d_creation_flags)
|
||||||
{
|
{
|
||||||
struct wined3d_vk_info *vk_info = &adapter_vk->vk_info;
|
struct wined3d_vk_info *vk_info = &adapter_vk->vk_info;
|
||||||
const struct wined3d_gpu_description *gpu_description;
|
|
||||||
struct wined3d_adapter *adapter = &adapter_vk->a;
|
struct wined3d_adapter *adapter = &adapter_vk->a;
|
||||||
VkPhysicalDeviceIDProperties id_properties;
|
VkPhysicalDeviceIDProperties id_properties;
|
||||||
VkPhysicalDeviceProperties2 properties2;
|
VkPhysicalDeviceProperties2 properties2;
|
||||||
|
@ -676,12 +695,7 @@ static BOOL wined3d_adapter_vk_init(struct wined3d_adapter_vk *adapter_vk,
|
||||||
VK_CALL(vkGetPhysicalDeviceProperties(adapter_vk->physical_device, &properties2.properties));
|
VK_CALL(vkGetPhysicalDeviceProperties(adapter_vk->physical_device, &properties2.properties));
|
||||||
adapter_vk->device_limits = properties2.properties.limits;
|
adapter_vk->device_limits = properties2.properties.limits;
|
||||||
|
|
||||||
if (!(gpu_description = get_vulkan_gpu_description(&properties2.properties)))
|
adapter_vk_init_driver_info(adapter, &properties2.properties);
|
||||||
{
|
|
||||||
ERR("Failed to get GPU description.\n");
|
|
||||||
goto fail_vulkan;
|
|
||||||
}
|
|
||||||
wined3d_driver_info_init(&adapter->driver_info, gpu_description, wined3d_settings.emulated_textureram);
|
|
||||||
|
|
||||||
memcpy(&adapter->driver_uuid, id_properties.driverUUID, sizeof(adapter->driver_uuid));
|
memcpy(&adapter->driver_uuid, id_properties.driverUUID, sizeof(adapter->driver_uuid));
|
||||||
memcpy(&adapter->device_uuid, id_properties.deviceUUID, sizeof(adapter->device_uuid));
|
memcpy(&adapter->device_uuid, id_properties.deviceUUID, sizeof(adapter->device_uuid));
|
||||||
|
|
|
@ -615,7 +615,7 @@ void wined3d_driver_info_init(struct wined3d_driver_info *driver_info,
|
||||||
|
|
||||||
driver_info->vendor = gpu_desc->vendor;
|
driver_info->vendor = gpu_desc->vendor;
|
||||||
driver_info->device = gpu_desc->device;
|
driver_info->device = gpu_desc->device;
|
||||||
driver_info->description = gpu_desc->description;
|
wined3d_copy_name(driver_info->description, gpu_desc->description, ARRAY_SIZE(driver_info->description));
|
||||||
driver_info->vram_bytes = vram_bytes ? vram_bytes : (UINT64)gpu_desc->vidmem * 1024 * 1024;
|
driver_info->vram_bytes = vram_bytes ? vram_bytes : (UINT64)gpu_desc->vidmem * 1024 * 1024;
|
||||||
driver = gpu_desc->driver;
|
driver = gpu_desc->driver;
|
||||||
|
|
||||||
|
|
|
@ -2675,12 +2675,15 @@ const struct wined3d_gpu_description *wined3d_get_user_override_gpu_description(
|
||||||
enum wined3d_pci_device wined3d_gpu_from_feature_level(enum wined3d_pci_vendor *vendor,
|
enum wined3d_pci_device wined3d_gpu_from_feature_level(enum wined3d_pci_vendor *vendor,
|
||||||
enum wined3d_feature_level feature_level) DECLSPEC_HIDDEN;
|
enum wined3d_feature_level feature_level) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
|
/* 512 in Direct3D 8/9, 128 in DXGI. */
|
||||||
|
#define WINED3D_MAX_DEVICE_IDENTIFIER_LENGTH 512
|
||||||
|
|
||||||
struct wined3d_driver_info
|
struct wined3d_driver_info
|
||||||
{
|
{
|
||||||
enum wined3d_pci_vendor vendor;
|
enum wined3d_pci_vendor vendor;
|
||||||
enum wined3d_pci_device device;
|
enum wined3d_pci_device device;
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *description;
|
char description[WINED3D_MAX_DEVICE_IDENTIFIER_LENGTH];
|
||||||
UINT64 vram_bytes;
|
UINT64 vram_bytes;
|
||||||
UINT64 sysmem_bytes;
|
UINT64 sysmem_bytes;
|
||||||
DWORD version_high;
|
DWORD version_high;
|
||||||
|
|
Loading…
Reference in New Issue