Signed-off-by: Józef Kucia [email protected] --- dlls/wined3d/adapter_gl.c | 25 ++++++------------------- dlls/wined3d/adapter_vk.c | 15 ++++++++++----- dlls/wined3d/directx.c | 27 +++++++++++++++++++++++++++ dlls/wined3d/wined3d_private.h | 2 ++ 4 files changed, 45 insertions(+), 24 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index 0f554e7cf2e4..cedd012c89d1 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -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; } diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index 464f7914098e..3709c940c984 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -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, diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index cacd9ac1849f..a1c0b8879763 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -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) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index cf46f808e25f..8e0aef5ba816 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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;