From 851be630373b8bffddbfe201bcf713950226293b Mon Sep 17 00:00:00 2001 From: Matteo Bruni Date: Mon, 20 May 2019 18:49:49 +0200 Subject: [PATCH] wined3d: Assign 9_x feature levels more accurately. Signed-off-by: Matteo Bruni Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d9/device.c | 4 ++-- dlls/wined3d/adapter_gl.c | 20 +++++++++++++++----- dlls/wined3d/directx.c | 10 +++++----- dlls/wined3d/shader.c | 4 ++-- dlls/wined3d/utils.c | 4 ++-- include/wine/wined3d.h | 4 ++-- 6 files changed, 28 insertions(+), 18 deletions(-) diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index bef01a477f9..9fbdcebf075 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -4443,8 +4443,8 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine static const enum wined3d_feature_level feature_levels[] = { - WINED3D_FEATURE_LEVEL_9_SM3, - WINED3D_FEATURE_LEVEL_9_SM2, + WINED3D_FEATURE_LEVEL_9_3, + WINED3D_FEATURE_LEVEL_9_2, WINED3D_FEATURE_LEVEL_9_1, WINED3D_FEATURE_LEVEL_8, WINED3D_FEATURE_LEVEL_7, diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index 5524f948c62..818fa8407aa 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -1241,7 +1241,8 @@ static enum wined3d_pci_vendor wined3d_guess_card_vendor(const char *gl_vendor_s } static enum wined3d_feature_level feature_level_from_caps(const struct wined3d_gl_info *gl_info, - const struct shader_caps *shader_caps, const struct fragment_caps *fragment_caps) + const struct wined3d_d3d_limits *d3d_limits, const struct shader_caps *shader_caps, + const struct fragment_caps *fragment_caps) { unsigned int shader_model; @@ -1267,10 +1268,18 @@ static enum wined3d_feature_level feature_level_from_caps(const struct wined3d_g } } - if (shader_model >= 3) - return WINED3D_FEATURE_LEVEL_9_SM3; + if (shader_model >= 3 && d3d_limits->texture_size >= 4096 && d3d_limits->max_rt_count >= 4) + return WINED3D_FEATURE_LEVEL_9_3; if (shader_model >= 2) - return WINED3D_FEATURE_LEVEL_9_SM2; + { + if (gl_info->supported[ARB_OCCLUSION_QUERY] + && gl_info->supported[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE] + && gl_info->supported[EXT_BLEND_EQUATION_SEPARATE] + && gl_info->supported[EXT_BLEND_FUNC_SEPARATE]) + return WINED3D_FEATURE_LEVEL_9_2; + + return WINED3D_FEATURE_LEVEL_9_1; + } if (shader_model >= 1) return WINED3D_FEATURE_LEVEL_8; @@ -3722,7 +3731,6 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, d3d_info->limits.ffp_textures = fragment_caps.MaxSimultaneousTextures; d3d_info->shader_color_key = !!(fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_COLOR_KEY); d3d_info->wined3d_creation_flags = wined3d_creation_flags; - d3d_info->feature_level = feature_level_from_caps(gl_info, &shader_caps, &fragment_caps); d3d_info->texture_npot = !!gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO]; d3d_info->texture_npot_conditional = gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT] @@ -3737,6 +3745,8 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, else d3d_info->multisample_draw_location = WINED3D_LOCATION_RB_MULTISAMPLE; + d3d_info->feature_level = feature_level_from_caps(gl_info, &d3d_info->limits, &shader_caps, &fragment_caps); + TRACE("Max texture stages: %u.\n", d3d_info->limits.ffp_blend_stages); if (!d3d_info->shader_color_key) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 12c83bb2cd9..39dd13a9292 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -691,8 +691,8 @@ enum wined3d_pci_device wined3d_gpu_from_feature_level(enum wined3d_pci_vendor * {WINED3D_FEATURE_LEVEL_6, CARD_NVIDIA_RIVA_TNT}, {WINED3D_FEATURE_LEVEL_7, CARD_NVIDIA_GEFORCE}, {WINED3D_FEATURE_LEVEL_8, CARD_NVIDIA_GEFORCE3}, - {WINED3D_FEATURE_LEVEL_9_SM2, CARD_NVIDIA_GEFORCEFX_5800}, - {WINED3D_FEATURE_LEVEL_9_SM3, CARD_NVIDIA_GEFORCE_6800}, + {WINED3D_FEATURE_LEVEL_9_2, CARD_NVIDIA_GEFORCEFX_5800}, + {WINED3D_FEATURE_LEVEL_9_3, CARD_NVIDIA_GEFORCE_6800}, {WINED3D_FEATURE_LEVEL_10, CARD_NVIDIA_GEFORCE_8800GTX}, {WINED3D_FEATURE_LEVEL_11, CARD_NVIDIA_GEFORCE_GTX470}, {WINED3D_FEATURE_LEVEL_NONE}, @@ -702,8 +702,8 @@ enum wined3d_pci_device wined3d_gpu_from_feature_level(enum wined3d_pci_vendor * {WINED3D_FEATURE_LEVEL_5, CARD_AMD_RAGE_128PRO}, {WINED3D_FEATURE_LEVEL_7, CARD_AMD_RADEON_7200}, {WINED3D_FEATURE_LEVEL_8, CARD_AMD_RADEON_8500}, - {WINED3D_FEATURE_LEVEL_9_SM2, CARD_AMD_RADEON_9500}, - {WINED3D_FEATURE_LEVEL_9_SM3, CARD_AMD_RADEON_X1600}, + {WINED3D_FEATURE_LEVEL_9_1, CARD_AMD_RADEON_9500}, + {WINED3D_FEATURE_LEVEL_9_3, CARD_AMD_RADEON_X1600}, {WINED3D_FEATURE_LEVEL_10, CARD_AMD_RADEON_HD2900}, {WINED3D_FEATURE_LEVEL_11, CARD_AMD_RADEON_HD5600}, {WINED3D_FEATURE_LEVEL_NONE}, @@ -712,7 +712,7 @@ enum wined3d_pci_device wined3d_gpu_from_feature_level(enum wined3d_pci_vendor * { {WINED3D_FEATURE_LEVEL_5, CARD_INTEL_845G}, {WINED3D_FEATURE_LEVEL_8, CARD_INTEL_915G}, - {WINED3D_FEATURE_LEVEL_9_SM3, CARD_INTEL_945G}, + {WINED3D_FEATURE_LEVEL_9_3, CARD_INTEL_945G}, {WINED3D_FEATURE_LEVEL_10, CARD_INTEL_G45}, {WINED3D_FEATURE_LEVEL_11, CARD_INTEL_IVBD}, {WINED3D_FEATURE_LEVEL_NONE}, diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 609b574d461..a8fee07c6c3 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -3311,9 +3311,9 @@ static unsigned int shader_max_version_from_feature_level(enum wined3d_feature_l case WINED3D_FEATURE_LEVEL_10_1: case WINED3D_FEATURE_LEVEL_10: return 4; - case WINED3D_FEATURE_LEVEL_9_SM3: + case WINED3D_FEATURE_LEVEL_9_3: return 3; - case WINED3D_FEATURE_LEVEL_9_SM2: + case WINED3D_FEATURE_LEVEL_9_2: case WINED3D_FEATURE_LEVEL_9_1: return 2; default: diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index ef469100fdc..6a880bb2d70 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -6573,8 +6573,8 @@ const char *wined3d_debug_feature_level(enum wined3d_feature_level level) LEVEL_TO_STR(WINED3D_FEATURE_LEVEL_7); LEVEL_TO_STR(WINED3D_FEATURE_LEVEL_8); LEVEL_TO_STR(WINED3D_FEATURE_LEVEL_9_1); - LEVEL_TO_STR(WINED3D_FEATURE_LEVEL_9_SM2); - LEVEL_TO_STR(WINED3D_FEATURE_LEVEL_9_SM3); + LEVEL_TO_STR(WINED3D_FEATURE_LEVEL_9_2); + LEVEL_TO_STR(WINED3D_FEATURE_LEVEL_9_3); LEVEL_TO_STR(WINED3D_FEATURE_LEVEL_10); LEVEL_TO_STR(WINED3D_FEATURE_LEVEL_10_1); LEVEL_TO_STR(WINED3D_FEATURE_LEVEL_11); diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 958ade166c0..31afa46623f 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -96,8 +96,8 @@ enum wined3d_feature_level WINED3D_FEATURE_LEVEL_7 = 0x7000, WINED3D_FEATURE_LEVEL_8 = 0x8000, WINED3D_FEATURE_LEVEL_9_1 = 0x9100, - WINED3D_FEATURE_LEVEL_9_SM2 = 0x9200, - WINED3D_FEATURE_LEVEL_9_SM3 = 0x9300, + WINED3D_FEATURE_LEVEL_9_2 = 0x9200, + WINED3D_FEATURE_LEVEL_9_3 = 0x9300, WINED3D_FEATURE_LEVEL_10 = 0xa000, WINED3D_FEATURE_LEVEL_10_1 = 0xa100, WINED3D_FEATURE_LEVEL_11 = 0xb000,