Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: Move wined3d_driver_info_init() call after wined3d_adapter_gl_init_d3d_info() / wined3d_adapter_vk_init_d3d_info().
dlls/wined3d/adapter_gl.c | 29 +++---- dlls/wined3d/adapter_vk.c | 19 +++-- dlls/wined3d/directx.c | 135 +++++++++++++++++++++++---------- dlls/wined3d/wined3d_private.h | 5 +- 4 files changed, 123 insertions(+), 65 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index bc59d1b7439e..cc78c9046b6c 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -1034,9 +1034,10 @@ static const struct wined3d_gpu_description *query_gpu_description(const struct
/* Context activation is done by the caller. */ static void fixup_extensions(struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx, - const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, - enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device) + const char *gl_renderer, enum wined3d_gl_vendor gl_vendor) { + enum wined3d_pci_vendor card_vendor = ctx->gpu_description->vendor; + enum wined3d_pci_device device = ctx->gpu_description->device; unsigned int i;
static const struct driver_quirk @@ -3393,15 +3394,12 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, {ARB_POLYGON_OFFSET_CLAMP, MAKEDWORD_VERSION(4, 6)}, {ARB_TEXTURE_FILTER_ANISOTROPIC, MAKEDWORD_VERSION(4, 6)}, }; - struct wined3d_driver_info *driver_info = &adapter->driver_info; const char *gl_vendor_str, *gl_renderer_str, *gl_version_str; - const struct wined3d_gpu_description *gpu_description; struct wined3d_gl_info *gl_info = &adapter->gl_info; + DWORD gl_version, gl_ext_emul_mask; const char *WGL_Extensions = NULL; enum wined3d_gl_vendor gl_vendor; - DWORD gl_version, gl_ext_emul_mask; GLint context_profile = 0; - UINT64 vram_bytes = 0; unsigned int i, j; HDC hdc;
@@ -3829,7 +3827,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, gl_vendor = wined3d_guess_gl_vendor(gl_info, gl_vendor_str, gl_renderer_str, gl_version_str); TRACE("Guessed GL vendor %#x.\n", gl_vendor);
- if (!(gpu_description = query_gpu_description(gl_info, &vram_bytes))) + if (!(caps_gl_ctx->gpu_description = query_gpu_description(gl_info, &caps_gl_ctx->vram_bytes))) { enum wined3d_feature_level feature_level; struct fragment_caps fragment_caps; @@ -3847,20 +3845,16 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, device = wined3d_guess_card(feature_level, gl_renderer_str, &gl_vendor, &vendor); TRACE("Guessed device PCI ID 0x%04x.\n", device);
- if (!(gpu_description = wined3d_get_gpu_description(vendor, device))) + if (!(caps_gl_ctx->gpu_description = wined3d_get_gpu_description(vendor, device))) { ERR("Card %04x:%04x not found in driver DB.\n", vendor, device); return FALSE; } } - fixup_extensions(gl_info, caps_gl_ctx, gl_renderer_str, gl_vendor, - gpu_description->vendor, gpu_description->device); - wined3d_driver_info_init(driver_info, gpu_description, vram_bytes, 0); - TRACE("Reporting (fake) driver version 0x%08x-0x%08x.\n", - driver_info->version_high, driver_info->version_low); + fixup_extensions(gl_info, caps_gl_ctx, gl_renderer_str, gl_vendor);
adapter->vram_bytes_used = 0; - TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(driver_info->vram_bytes)); + TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(caps_gl_ctx->vram_bytes));
if (gl_info->supported[EXT_MEMORY_OBJECT]) { @@ -5134,6 +5128,7 @@ static BOOL wined3d_adapter_gl_init(struct wined3d_adapter_gl *adapter_gl, MAKEDWORD_VERSION(3, 2), MAKEDWORD_VERSION(1, 0), }; + struct wined3d_driver_info *driver_info = &adapter_gl->a.driver_info; struct wined3d_gl_info *gl_info = &adapter_gl->a.gl_info; struct wined3d_caps_gl_ctx caps_gl_ctx = {0}; LUID primary_luid, *luid = NULL; @@ -5210,6 +5205,7 @@ static BOOL wined3d_adapter_gl_init(struct wined3d_adapter_gl *adapter_gl, }
wined3d_adapter_gl_init_d3d_info(adapter_gl, wined3d_creation_flags); + if (!adapter_gl->a.d3d_info.shader_color_key) { /* We do not want to deal with re-creating immutable texture storage @@ -5218,6 +5214,11 @@ static BOOL wined3d_adapter_gl_init(struct wined3d_adapter_gl *adapter_gl, gl_info->supported[ARB_TEXTURE_STORAGE] = FALSE; }
+ wined3d_driver_info_init(driver_info, caps_gl_ctx.gpu_description, adapter_gl->a.d3d_info.feature_level, + caps_gl_ctx.vram_bytes, 0); + TRACE("Reporting (fake) driver version 0x%08x-0x%08x.\n", + driver_info->version_high, driver_info->version_low); + if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER) ERR_(winediag)("You are using the backbuffer for offscreen rendering. " "This is unsupported, and will be removed in a future version.\n"); diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index 57972dbb7e7a..cbfb29cdd43b 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -2082,7 +2082,10 @@ static void adapter_vk_init_driver_info(struct wined3d_adapter_vk *adapter_vk, gpu_description = &description; }
- wined3d_driver_info_init(&adapter_vk->a.driver_info, gpu_description, vram_bytes, sysmem_bytes); + wined3d_driver_info_init(&adapter_vk->a.driver_info, gpu_description, adapter_vk->a.d3d_info.feature_level, + vram_bytes, sysmem_bytes); + TRACE("Reporting (fake) driver version 0x%08x-0x%08x.\n", + adapter_vk->a.driver_info.version_high, adapter_vk->a.driver_info.version_low); }
static enum wined3d_feature_level feature_level_from_caps(const struct shader_caps *shader_caps) @@ -2199,6 +2202,13 @@ static BOOL wined3d_adapter_vk_init(struct wined3d_adapter_vk *adapter_vk, if (!wined3d_adapter_init(adapter, ordinal, luid, &wined3d_adapter_vk_ops)) goto fail_vulkan;
+ adapter->vertex_pipe = wined3d_spirv_vertex_pipe_init_vk(); + adapter->fragment_pipe = wined3d_spirv_fragment_pipe_init_vk(); + adapter->misc_state_template = misc_state_template_vk; + adapter->shader_backend = wined3d_spirv_shader_backend_init_vk(); + + wined3d_adapter_vk_init_d3d_info(adapter_vk, wined3d_creation_flags); + adapter_vk_init_driver_info(adapter_vk, &properties2.properties); adapter->vram_bytes_used = 0; TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter->driver_info.vram_bytes)); @@ -2209,13 +2219,6 @@ static BOOL wined3d_adapter_vk_init(struct wined3d_adapter_vk *adapter_vk, if (!wined3d_adapter_vk_init_format_info(adapter_vk, vk_info)) goto fail;
- adapter->vertex_pipe = wined3d_spirv_vertex_pipe_init_vk(); - adapter->fragment_pipe = wined3d_spirv_fragment_pipe_init_vk(); - adapter->misc_state_template = misc_state_template_vk; - adapter->shader_backend = wined3d_spirv_shader_backend_init_vk(); - - wined3d_adapter_vk_init_d3d_info(adapter_vk, wined3d_creation_flags); - return TRUE;
fail: diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 45f3f61f2fe7..dff821927099 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -219,27 +219,34 @@ ULONG CDECL wined3d_decref(struct wined3d *wined3d) * 25 -> Windows 10 October 2018 Update - WDDM 2.5 * 26 -> Windows 10 May 2019 Update - WDDM 2.6 * - * "y" is the maximum Direct3D version the driver supports. - * y -> d3d version mapping: - * 11 -> d3d6 - * 12 -> d3d7 - * 13 -> d3d8 - * 14 -> d3d9 - * 15 -> d3d10 - * 16 -> d3d10.1 - * 17 -> d3d11 + * "y" is the maximum Direct3D version / feature level the driver supports. + * 11 -> 6 + * 12 -> 7 + * 13 -> 8 + * 14 -> 9 + * 15 -> 10_0 + * 16 -> 10_1 + * 17 -> 11_0 + * 18 -> 11_1 + * 19 -> 12_0 + * 20 -> 12_1 + * 21 -> 12_x * * "z" is the subversion number. * * "w" is the vendor specific driver build number. - */ + * + * In practice the reported version is tied to the driver, not the actual + * Windows version or feature level. E.g. NVIDIA driver 445.87 advertises the + * exact same version 26.21.14.4587 on Windows 7 as it does on Windows 10 + * (it's in fact the same driver). Similarly for driver 310.90 that advertises + * itself as 9.18.13.1090 on Windows Vista with a GeForce 9600M. */
struct driver_version_information { enum wined3d_display_driver driver; enum wined3d_driver_model driver_model; const char *driver_name; /* name of Windows driver */ - WORD version; /* version word ('y'), contained in low word of DriverVersion.HighPart */ WORD subversion; /* subversion word ('z'), contained in high word of DriverVersion.LowPart */ WORD build; /* build number ('w'), contained in low word of DriverVersion.LowPart */ }; @@ -252,25 +259,25 @@ static const struct driver_version_information driver_version_table[] = * - Radeon 9500 (R300) - X1*00 (R5xx) supported up to Catalyst 9.3 (Linux) and 10.2 (XP/Vista/Win7) * - Radeon 7xxx (R100) - 9250 (RV250) supported up to Catalyst 6.11 (XP) * - Rage 128 supported up to XP, latest official build 6.13.3279 dated October 2001 */ - {DRIVER_AMD_RAGE_128PRO, DRIVER_MODEL_NT5X, "ati2dvaa.dll", 13, 3279, 0}, - {DRIVER_AMD_R100, DRIVER_MODEL_NT5X, "ati2dvag.dll", 14, 10, 6614}, - {DRIVER_AMD_R300, DRIVER_MODEL_NT5X, "ati2dvag.dll", 14, 10, 6764}, - {DRIVER_AMD_R600, DRIVER_MODEL_NT5X, "ati2dvag.dll", 17, 10, 1280}, - {DRIVER_AMD_R300, DRIVER_MODEL_NT6X, "atiumdag.dll", 14, 10, 741 }, - {DRIVER_AMD_R600, DRIVER_MODEL_NT6X, "atiumdag.dll", 17, 10, 1280}, - {DRIVER_AMD_RX, DRIVER_MODEL_NT6X, "aticfx32.dll", 17, 10, 1474}, + {DRIVER_AMD_RAGE_128PRO, DRIVER_MODEL_NT5X, "ati2dvaa.dll", 3279, 0}, + {DRIVER_AMD_R100, DRIVER_MODEL_NT5X, "ati2dvag.dll", 10, 6614}, + {DRIVER_AMD_R300, DRIVER_MODEL_NT5X, "ati2dvag.dll", 10, 6764}, + {DRIVER_AMD_R600, DRIVER_MODEL_NT5X, "ati2dvag.dll", 10, 1280}, + {DRIVER_AMD_R300, DRIVER_MODEL_NT6X, "atiumdag.dll", 10, 741 }, + {DRIVER_AMD_R600, DRIVER_MODEL_NT6X, "atiumdag.dll", 10, 1280}, + {DRIVER_AMD_RX, DRIVER_MODEL_NT6X, "aticfx32.dll", 10, 1474},
/* Intel * The drivers are unified but not all versions support all GPUs. At some point the 2k/xp * drivers used ialmrnt5.dll for GMA800/GMA900 but at some point the file was renamed to * igxprd32.dll but the GMA800 driver was never updated. */ - {DRIVER_INTEL_GMA800, DRIVER_MODEL_NT5X, "ialmrnt5.dll", 14, 10, 3889}, - {DRIVER_INTEL_GMA900, DRIVER_MODEL_NT5X, "igxprd32.dll", 14, 10, 4764}, - {DRIVER_INTEL_GMA950, DRIVER_MODEL_NT5X, "igxprd32.dll", 14, 10, 4926}, - {DRIVER_INTEL_GMA3000, DRIVER_MODEL_NT5X, "igxprd32.dll", 14, 10, 5218}, - {DRIVER_INTEL_GMA950, DRIVER_MODEL_NT6X, "igdumd32.dll", 14, 10, 1504}, - {DRIVER_INTEL_GMA3000, DRIVER_MODEL_NT6X, "igdumd32.dll", 15, 10, 1666}, - {DRIVER_INTEL_HD4000, DRIVER_MODEL_NT6X, "igdumdim32.dll", 19, 15, 4352}, + {DRIVER_INTEL_GMA800, DRIVER_MODEL_NT5X, "ialmrnt5.dll", 10, 3889}, + {DRIVER_INTEL_GMA900, DRIVER_MODEL_NT5X, "igxprd32.dll", 10, 4764}, + {DRIVER_INTEL_GMA950, DRIVER_MODEL_NT5X, "igxprd32.dll", 10, 4926}, + {DRIVER_INTEL_GMA3000, DRIVER_MODEL_NT5X, "igxprd32.dll", 10, 5218}, + {DRIVER_INTEL_GMA950, DRIVER_MODEL_NT6X, "igdumd32.dll", 10, 1504}, + {DRIVER_INTEL_GMA3000, DRIVER_MODEL_NT6X, "igdumd32.dll", 10, 1666}, + {DRIVER_INTEL_HD4000, DRIVER_MODEL_NT6X, "igdumdim32.dll", 15, 4352},
/* Nvidia * - Geforce8 and newer is supported by the current 340.52 driver on XP-Win8 @@ -279,22 +286,22 @@ static const struct driver_version_information driver_version_table[] = * - Geforce2MX/3/4 up to 96.x on <= XP * - TNT/Geforce1/2 up to 71.x on <= XP * All version numbers used below are from the Linux nvidia drivers. */ - {DRIVER_NVIDIA_TNT, DRIVER_MODEL_NT5X, "nv4_disp.dll", 14, 10, 7186}, - {DRIVER_NVIDIA_GEFORCE2MX, DRIVER_MODEL_NT5X, "nv4_disp.dll", 14, 10, 9371}, - {DRIVER_NVIDIA_GEFORCEFX, DRIVER_MODEL_NT5X, "nv4_disp.dll", 14, 11, 7516}, - {DRIVER_NVIDIA_GEFORCE6, DRIVER_MODEL_NT5X, "nv4_disp.dll", 18, 13, 783}, - {DRIVER_NVIDIA_GEFORCE8, DRIVER_MODEL_NT5X, "nv4_disp.dll", 18, 13, 4052}, - {DRIVER_NVIDIA_GEFORCE6, DRIVER_MODEL_NT6X, "nvd3dum.dll", 18, 13, 783}, - {DRIVER_NVIDIA_GEFORCE8, DRIVER_MODEL_NT6X, "nvd3dum.dll", 18, 13, 4052}, + {DRIVER_NVIDIA_TNT, DRIVER_MODEL_NT5X, "nv4_disp.dll", 10, 7186}, + {DRIVER_NVIDIA_GEFORCE2MX, DRIVER_MODEL_NT5X, "nv4_disp.dll", 10, 9371}, + {DRIVER_NVIDIA_GEFORCEFX, DRIVER_MODEL_NT5X, "nv4_disp.dll", 11, 7516}, + {DRIVER_NVIDIA_GEFORCE6, DRIVER_MODEL_NT5X, "nv4_disp.dll", 13, 783}, + {DRIVER_NVIDIA_GEFORCE8, DRIVER_MODEL_NT5X, "nv4_disp.dll", 13, 4052}, + {DRIVER_NVIDIA_GEFORCE6, DRIVER_MODEL_NT6X, "nvd3dum.dll", 13, 783}, + {DRIVER_NVIDIA_GEFORCE8, DRIVER_MODEL_NT6X, "nvd3dum.dll", 13, 4052},
/* Red Hat */ - {DRIVER_REDHAT_VIRGL, DRIVER_MODEL_GENERIC, "virgl.dll", 0, 0, 0}, + {DRIVER_REDHAT_VIRGL, DRIVER_MODEL_GENERIC, "virgl.dll", 0, 0},
/* VMware */ - {DRIVER_VMWARE, DRIVER_MODEL_NT5X, "vm3dum.dll", 14, 1, 1134}, + {DRIVER_VMWARE, DRIVER_MODEL_NT5X, "vm3dum.dll", 1, 1134},
/* Wine */ - {DRIVER_WINE, DRIVER_MODEL_GENERIC, "wined3d.dll", 0, 0, 0}, + {DRIVER_WINE, DRIVER_MODEL_GENERIC, "wined3d.dll", 0, 0}, };
/* The amount of video memory stored in the gpu description table is the minimum amount of video memory @@ -602,8 +609,8 @@ static const struct driver_version_information *get_driver_version_info(enum win if (entry->driver == driver && (driver_model == DRIVER_MODEL_GENERIC || entry->driver_model == driver_model)) { - TRACE("Found driver "%s", version %u, subversion %u, build %u.\n", - entry->driver_name, entry->version, entry->subversion, entry->build); + TRACE("Found driver "%s", subversion %u, build %u.\n", + entry->driver_name, entry->subversion, entry->build); return entry; } } @@ -663,14 +670,15 @@ static void wined3d_copy_name(char *dst, const char *src, unsigned int dst_size) }
void wined3d_driver_info_init(struct wined3d_driver_info *driver_info, - const struct wined3d_gpu_description *gpu_desc, UINT64 vram_bytes, UINT64 sysmem_bytes) + const struct wined3d_gpu_description *gpu_desc, enum wined3d_feature_level feature_level, + UINT64 vram_bytes, UINT64 sysmem_bytes) { const struct driver_version_information *version_info; + WORD driver_os_version, driver_feature_level = 10; enum wined3d_driver_model driver_model; enum wined3d_display_driver driver; MEMORYSTATUSEX memory_status; OSVERSIONINFOW os_version; - WORD driver_os_version;
memset(&os_version, 0, sizeof(os_version)); os_version.dwOSVersionInfoSize = sizeof(os_version); @@ -742,6 +750,49 @@ void wined3d_driver_info_init(struct wined3d_driver_info *driver_info, } }
+ TRACE("GPU maximum feature level %#x.\n", feature_level); + switch (feature_level) + { + case WINED3D_FEATURE_LEVEL_NONE: + case WINED3D_FEATURE_LEVEL_5: + if (driver_model == DRIVER_MODEL_WIN9X) + driver_feature_level = 5; + else + driver_feature_level = 10; + break; + case WINED3D_FEATURE_LEVEL_6: + driver_feature_level = 11; + break; + case WINED3D_FEATURE_LEVEL_7: + driver_feature_level = 12; + break; + case WINED3D_FEATURE_LEVEL_8: + driver_feature_level = 13; + break; + case WINED3D_FEATURE_LEVEL_9_1: + case WINED3D_FEATURE_LEVEL_9_2: + case WINED3D_FEATURE_LEVEL_9_3: + driver_feature_level = 14; + break; + case WINED3D_FEATURE_LEVEL_10: + driver_feature_level = 15; + break; + case WINED3D_FEATURE_LEVEL_10_1: + driver_feature_level = 16; + break; + case WINED3D_FEATURE_LEVEL_11: + driver_feature_level = 17; + break; + case WINED3D_FEATURE_LEVEL_11_1: + /* Advertise support for everything up to FL 12_x. */ + driver_feature_level = 21; + break; + } + if (os_version.dwMajorVersion == 6 && !os_version.dwMinorVersion) + driver_feature_level = min(driver_feature_level, 18); + else if (os_version.dwMajorVersion < 6) + driver_feature_level = min(driver_feature_level, 14); + driver_info->vendor = gpu_desc->vendor; driver_info->device = gpu_desc->device; wined3d_copy_name(driver_info->description, gpu_desc->description, ARRAY_SIZE(driver_info->description)); @@ -793,7 +844,7 @@ void wined3d_driver_info_init(struct wined3d_driver_info *driver_info, || (version_info = get_driver_version_info(driver, DRIVER_MODEL_GENERIC))) { driver_info->name = version_info->driver_name; - driver_info->version_high = MAKEDWORD_VERSION(driver_os_version, version_info->version); + driver_info->version_high = MAKEDWORD_VERSION(driver_os_version, driver_feature_level); driver_info->version_low = MAKEDWORD_VERSION(version_info->subversion, version_info->build); } else @@ -801,7 +852,7 @@ void wined3d_driver_info_init(struct wined3d_driver_info *driver_info, ERR("No driver version info found for device %04x:%04x, driver model %#x.\n", driver_info->vendor, driver_info->device, driver_model); driver_info->name = "Display"; - driver_info->version_high = MAKEDWORD_VERSION(driver_os_version, 15); + driver_info->version_high = MAKEDWORD_VERSION(driver_os_version, driver_feature_level); driver_info->version_low = MAKEDWORD_VERSION(8, 6); /* NVIDIA RIVA TNT, arbitrary */ } } @@ -2941,7 +2992,7 @@ static struct wined3d_adapter *wined3d_adapter_no3d_create(unsigned int ordinal, return NULL; }
- wined3d_driver_info_init(&adapter->driver_info, &gpu_description, 0, 0); + wined3d_driver_info_init(&adapter->driver_info, &gpu_description, WINED3D_FEATURE_LEVEL_NONE, 0, 0); adapter->vram_bytes_used = 0; TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter->driver_info.vram_bytes));
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 342aee64f316..242d3e7505ef 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3197,7 +3197,7 @@ struct wined3d_driver_info };
void wined3d_driver_info_init(struct wined3d_driver_info *driver_info, - const struct wined3d_gpu_description *gpu_description, + const struct wined3d_gpu_description *gpu_description, enum wined3d_feature_level feature_level, UINT64 vram_bytes, UINT64 sysmem_bytes) DECLSPEC_HIDDEN;
struct wined3d_adapter_ops @@ -3358,6 +3358,9 @@ struct wined3d_caps_gl_ctx const struct wined3d_gl_info *gl_info; GLuint test_vbo; GLuint test_program_id; + + const struct wined3d_gpu_description *gpu_description; + UINT64 vram_bytes; };
BOOL wined3d_adapter_gl_init_format_info(struct wined3d_adapter *adapter,