[2/5] wined3d: Use capabilities from the shader backend or the fragment pipeline to determine the D3D level
Andrei Slăvoiu
andrei.slavoiu at gmail.com
Fri Aug 1 13:25:49 CDT 2014
---
dlls/wined3d/directx.c | 59 +++++++++++++++++++++++++++++++++++---------------
1 file changed, 41 insertions(+), 18 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index c34ac11..b6ba769 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -1668,27 +1668,50 @@ static enum wined3d_pci_vendor wined3d_guess_card_vendor(const char *gl_vendor_s
return HW_VENDOR_NVIDIA;
}
+static const struct wined3d_shader_backend_ops *select_shader_backend(const struct wined3d_gl_info *gl_info);
+static const struct fragment_pipeline *select_fragment_implementation(const struct wined3d_gl_info *gl_info, const struct wined3d_shader_backend_ops *shader_backend_ops);
+
static enum wined3d_d3d_level d3d_level_from_gl_info(const struct wined3d_gl_info *gl_info)
{
- enum wined3d_d3d_level level = WINED3D_D3D_LEVEL_5;
+ struct shader_caps shader_caps;
+ struct fragment_caps fragment_caps;
+ const struct wined3d_shader_backend_ops *shader_backend;
+ const struct fragment_pipeline *fragment_pipeline;
- if (gl_info->supported[ARB_MULTITEXTURE])
- level = WINED3D_D3D_LEVEL_6;
- if (gl_info->supported[ARB_TEXTURE_COMPRESSION]
- && gl_info->supported[ARB_TEXTURE_CUBE_MAP]
- && gl_info->supported[ARB_TEXTURE_ENV_DOT3])
- level = WINED3D_D3D_LEVEL_7;
- if (level == WINED3D_D3D_LEVEL_7 && gl_info->supported[ARB_MULTISAMPLE]
- && gl_info->supported[ARB_TEXTURE_BORDER_CLAMP])
- level = WINED3D_D3D_LEVEL_8;
- if (level == WINED3D_D3D_LEVEL_8 && gl_info->supported[ARB_FRAGMENT_PROGRAM]
- && gl_info->supported[ARB_VERTEX_SHADER])
- level = WINED3D_D3D_LEVEL_9_SM2;
- if (level == WINED3D_D3D_LEVEL_9_SM2 && (gl_info->supported[EXT_GPU_SHADER4]
- || gl_info->glsl_version >= MAKEDWORD_VERSION(1, 30)))
- level = WINED3D_D3D_LEVEL_10;
-
- return level;
+ shader_backend = select_shader_backend(gl_info);
+ shader_backend->shader_get_caps(gl_info, &shader_caps);
+
+ if (shader_caps.vs_version >= 5)
+ return WINED3D_D3D_LEVEL_11;
+ if (shader_caps.vs_version == 4)
+ {
+ /* No backed supports SM 5 at the moment */
+ if (gl_info->glsl_version >= MAKEDWORD_VERSION(4, 00))
+ return WINED3D_D3D_LEVEL_11;
+ return WINED3D_D3D_LEVEL_10;
+ }
+ if (shader_caps.vs_version == 3)
+ {
+ /* Wine can not use SM 4 on mesa drivers as the necessary functionality is not exposed
+ * on compatibility contexts */
+ if (gl_info->glsl_version >= MAKEDWORD_VERSION(1, 30))
+ return WINED3D_D3D_LEVEL_10;
+ return WINED3D_D3D_LEVEL_9_SM3;
+ }
+ if (shader_caps.vs_version == 2)
+ return WINED3D_D3D_LEVEL_9_SM2;
+ if (shader_caps.vs_version == 1)
+ return WINED3D_D3D_LEVEL_8;
+
+ fragment_pipeline = select_fragment_implementation(gl_info, shader_backend);
+ fragment_pipeline->get_caps(gl_info, &fragment_caps);
+
+ if (fragment_caps.TextureOpCaps & WINED3DTEXOPCAPS_DOTPRODUCT3)
+ return WINED3D_D3D_LEVEL_7;
+ if (fragment_caps.MaxSimultaneousTextures > 1)
+ return WINED3D_D3D_LEVEL_6;
+
+ return WINED3D_D3D_LEVEL_5;
}
static const struct wined3d_renderer_table
--
2.0.0
More information about the wine-patches
mailing list