Commit 9f75b842 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Implement GPU description registry override for Vulkan adapter.

parent dda9037c
......@@ -991,41 +991,28 @@ static void quirk_broken_viewport_subpixel_bits(struct wined3d_gl_info *gl_info)
static const struct wined3d_gpu_description *query_gpu_description(const struct wined3d_gl_info *gl_info,
UINT64 *vram_bytes)
{
const struct wined3d_gpu_description *gpu_description;
const struct wined3d_gpu_description *gpu_description = NULL, *gpu_description_override;
enum wined3d_pci_vendor vendor = PCI_VENDOR_NONE;
enum wined3d_pci_device device = PCI_DEVICE_NONE;
static unsigned int once;
GLuint value;
if (gl_info->supported[WGL_WINE_QUERY_RENDERER])
{
GLuint value;
if (GL_EXTCALL(wglQueryCurrentRendererIntegerWINE(WGL_RENDERER_VENDOR_ID_WINE, &value)))
vendor = value;
if (GL_EXTCALL(wglQueryCurrentRendererIntegerWINE(WGL_RENDERER_DEVICE_ID_WINE, &value)))
device = value;
if (GL_EXTCALL(wglQueryCurrentRendererIntegerWINE(WGL_RENDERER_VIDEO_MEMORY_WINE, &value)))
*vram_bytes = (UINT64)value * 1024 * 1024;
TRACE("Card reports vendor PCI ID 0x%04x, device PCI ID 0x%04x, 0x%s bytes of video memory.\n",
vendor, device, wine_dbgstr_longlong(*vram_bytes));
}
if (wined3d_settings.pci_vendor_id != PCI_VENDOR_NONE)
{
vendor = wined3d_settings.pci_vendor_id;
TRACE("Overriding vendor PCI ID with 0x%04x.\n", vendor);
}
if (wined3d_settings.pci_device_id != PCI_DEVICE_NONE)
{
device = wined3d_settings.pci_device_id;
TRACE("Overriding device PCI ID with 0x%04x.\n", device);
gpu_description = wined3d_get_gpu_description(vendor, device);
}
if (!(gpu_description = wined3d_get_gpu_description(vendor, device))
&& (wined3d_settings.pci_vendor_id != PCI_VENDOR_NONE
|| wined3d_settings.pci_device_id != PCI_DEVICE_NONE) && !once++)
ERR_(winediag)("Invalid GPU override %04x:%04x specified, ignoring.\n", vendor, device);
if ((gpu_description_override = wined3d_get_user_override_gpu_description(vendor, device)))
gpu_description = gpu_description_override;
return gpu_description;
}
......
......@@ -627,13 +627,18 @@ const struct wined3d_gpu_description *get_vulkan_gpu_description(const VkPhysica
TRACE("Driver version: %#x.\n", properties->driverVersion);
TRACE("API version: %s.\n", debug_vk_version(properties->apiVersion));
if ((description = wined3d_get_gpu_description(properties->vendorID, properties->deviceID)))
return description;
if (!(description = wined3d_get_user_override_gpu_description(properties->vendorID, properties->deviceID)))
description = wined3d_get_gpu_description(properties->vendorID, properties->deviceID);
FIXME("Failed to retrieve GPU description for device %s %04x:%04x.\n",
debugstr_a(properties->deviceName), properties->vendorID, properties->deviceID);
if (!description)
{
FIXME("Failed to retrieve GPU description for device %s %04x:%04x.\n",
debugstr_a(properties->deviceName), properties->vendorID, properties->deviceID);
description = wined3d_get_gpu_description(HW_VENDOR_AMD, CARD_AMD_RADEON_RX_VEGA);
}
return wined3d_get_gpu_description(HW_VENDOR_AMD, CARD_AMD_RADEON_RX_VEGA);
return description;
}
static BOOL wined3d_adapter_vk_init(struct wined3d_adapter_vk *adapter_vk,
......
......@@ -28,6 +28,7 @@
#include "winternl.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
WINE_DECLARE_DEBUG_CHANNEL(winediag);
#define DEFAULT_REFRESH_RATE 0
......@@ -501,6 +502,32 @@ const struct wined3d_gpu_description *wined3d_get_gpu_description(enum wined3d_p
return NULL;
}
const struct wined3d_gpu_description *wined3d_get_user_override_gpu_description(enum wined3d_pci_vendor vendor,
enum wined3d_pci_device device)
{
const struct wined3d_gpu_description *gpu_desc;
static unsigned int once;
if (wined3d_settings.pci_vendor_id == PCI_VENDOR_NONE && wined3d_settings.pci_device_id == PCI_DEVICE_NONE)
return NULL;
if (wined3d_settings.pci_vendor_id != PCI_VENDOR_NONE)
{
vendor = wined3d_settings.pci_vendor_id;
TRACE("Overriding vendor PCI ID with 0x%04x.\n", vendor);
}
if (wined3d_settings.pci_device_id != PCI_DEVICE_NONE)
{
device = wined3d_settings.pci_device_id;
TRACE("Overriding device PCI ID with 0x%04x.\n", device);
}
if (!(gpu_desc = wined3d_get_gpu_description(vendor, device)) && !once++)
ERR_(winediag)("Invalid GPU override %04x:%04x specified, ignoring.\n", vendor, device);
return gpu_desc;
}
void wined3d_driver_info_init(struct wined3d_driver_info *driver_info,
const struct wined3d_gpu_description *gpu_desc, UINT64 vram_bytes)
{
......
......@@ -2670,6 +2670,8 @@ struct wined3d_gpu_description
const struct wined3d_gpu_description *wined3d_get_gpu_description(enum wined3d_pci_vendor vendor,
enum wined3d_pci_device device) DECLSPEC_HIDDEN;
const struct wined3d_gpu_description *wined3d_get_user_override_gpu_description(enum wined3d_pci_vendor vendor,
enum wined3d_pci_device device) DECLSPEC_HIDDEN;
enum wined3d_pci_device wined3d_gpu_from_feature_level(enum wined3d_pci_vendor *vendor,
enum wined3d_feature_level feature_level) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment