[PATCH 1/3] wined3d: Separate feature level checks from shader model checks.

Józef Kucia jkucia at codeweavers.com
Fri Jul 13 06:52:22 CDT 2018


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 dlls/wined3d/directx.c     | 21 ++++++++++++++-------
 dlls/wined3d/glsl_shader.c |  4 ----
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 9ecc4ed71354..e4220058221b 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -1844,13 +1844,20 @@ static enum wined3d_pci_vendor wined3d_guess_card_vendor(const char *gl_vendor_s
     return HW_VENDOR_NVIDIA;
 }
 
-static enum wined3d_feature_level feature_level_from_caps(const struct shader_caps *shader_caps,
-        const struct fragment_caps *fragment_caps)
+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)
 {
-    if (shader_caps->vs_version >= 5)
-        return WINED3D_FEATURE_LEVEL_11;
-    if (shader_caps->vs_version == 4)
-        return WINED3D_FEATURE_LEVEL_10;
+    if (gl_info->supported[WINED3D_GL_VERSION_3_2] && gl_info->supported[ARB_SAMPLER_OBJECTS])
+    {
+        if (shader_caps->vs_version >= 5
+                && gl_info->supported[ARB_DRAW_INDIRECT]
+                && gl_info->supported[ARB_TEXTURE_COMPRESSION_BPTC])
+            return WINED3D_FEATURE_LEVEL_11;
+
+        if (shader_caps->vs_version == 4)
+            return WINED3D_FEATURE_LEVEL_10;
+    }
+
     if (shader_caps->vs_version == 3)
         return WINED3D_FEATURE_LEVEL_9_SM3;
     if (shader_caps->vs_version == 2)
@@ -4306,7 +4313,7 @@ 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(&shader_caps, &fragment_caps);
+    d3d_info->feature_level = feature_level_from_caps(gl_info, &shader_caps, &fragment_caps);
 
     TRACE("Max texture stages: %u.\n", d3d_info->limits.ffp_blend_stages);
 
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 1e922c80dff7..0c73aba81118 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -11242,8 +11242,6 @@ static void shader_glsl_init_context_state(struct wined3d_context *context)
 static unsigned int shader_glsl_get_shader_model(const struct wined3d_gl_info *gl_info)
 {
     BOOL shader_model_4 = gl_info->glsl_version >= MAKEDWORD_VERSION(1, 50)
-            && gl_info->supported[WINED3D_GL_VERSION_3_2]
-            && gl_info->supported[ARB_SAMPLER_OBJECTS]
             && gl_info->supported[ARB_SHADER_BIT_ENCODING]
             && gl_info->supported[ARB_TEXTURE_SWIZZLE];
 
@@ -11251,14 +11249,12 @@ static unsigned int shader_glsl_get_shader_model(const struct wined3d_gl_info *g
             && gl_info->supported[ARB_COMPUTE_SHADER]
             && gl_info->supported[ARB_CULL_DISTANCE]
             && gl_info->supported[ARB_DERIVATIVE_CONTROL]
-            && gl_info->supported[ARB_DRAW_INDIRECT]
             && gl_info->supported[ARB_GPU_SHADER5]
             && gl_info->supported[ARB_SHADER_ATOMIC_COUNTERS]
             && gl_info->supported[ARB_SHADER_IMAGE_LOAD_STORE]
             && gl_info->supported[ARB_SHADER_IMAGE_SIZE]
             && gl_info->supported[ARB_SHADING_LANGUAGE_PACKING]
             && gl_info->supported[ARB_TESSELLATION_SHADER]
-            && gl_info->supported[ARB_TEXTURE_COMPRESSION_BPTC]
             && gl_info->supported[ARB_TEXTURE_GATHER]
             && gl_info->supported[ARB_TRANSFORM_FEEDBACK3])
         return 5;
-- 
2.16.4




More information about the wine-devel mailing list