On 23 June 2014 21:10, Andrei Slăvoiu <andrei.slavoiu(a)gmail.com> wrote:
+static UINT d3d_level_from_gl_info(const struct wined3d_gl_info *gl_info) +{ + struct shader_caps shader_caps; + struct fragment_caps fragment_caps; + const struct wined3d_shader_backend_ops *shader_backend; + const struct fragment_pipeline *fragment_pipeline; + + shader_backend = select_shader_backend(gl_info); + shader_backend->shader_get_caps(gl_info, &shader_caps); + + if (shader_caps.vs_version >= 4) + return 10; + //wine can not use SM 4 on mesa drivers as the necessary functionality is not exposed on compatibility contexts, but still set the pci id accordingly Please avoid C99 features like // comments.
+ if (shader_caps.vs_version == 3 && gl_info->glsl_version >= MAKEDWORD_VERSION(1, 30)) + return 10; + if (shader_caps.vs_version >= 2) + return 9; + if (shader_caps.vs_version == 1) + return 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 7; + if (gl_info->limits.textures > 1) + return 6; That's "fragment_caps.MaxSimultaneousTextures".
It probably makes sense to reorganize things a bit. For example, the gl_info parameter to the select_card() callbacks in struct gl_vendor_selection is really only used by select_card_nvidia_binary() and select_card_amd_binary() to call d3d_level_from_gl_info(), but I don't think anything of value would be lost if those used a plain table like e.g. select_card_amd_mesa(). (At which point you wouldn't need a callback there anymore either.) d3d_level_from_gl_info() should probably get the shader and fragment caps passed as parameters, and be renamed. It probably makes sense to make it return some kind of enum instead of a plain number, so you can e.g. distinguish between D3D9 SM2 and D3D9 SM3. That would also allow the fallback card selection code to use plain tables instead of callbacks.