wined3d: Raise the default max_gl_version for specific cases.

Effectively, this will enable Direct3D 11 by default on AMD and Intel
hardware.

Yes, this patch is awful.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2017-12-07 19:08:27 +03:30 committed by Alexandre Julliard
parent 0879b1730e
commit 62651d65f4
3 changed files with 26 additions and 8 deletions

View file

@ -6527,6 +6527,22 @@ static void wined3d_adapter_init_fb_cfgs(struct wined3d_adapter *adapter, HDC dc
}
}
static DWORD get_max_gl_version(const struct wined3d_gl_info *gl_info, DWORD flags)
{
const char *gl_vendor, *gl_renderer;
if (wined3d_settings.explicit_gl_version || (flags & WINED3D_PIXEL_CENTER_INTEGER))
return wined3d_settings.max_gl_version;
gl_vendor = (const char *)gl_info->gl_ops.gl.p_glGetString(GL_VENDOR);
gl_renderer = (const char *)gl_info->gl_ops.gl.p_glGetString(GL_RENDERER);
if (!gl_vendor || !gl_renderer
|| wined3d_guess_card_vendor(gl_vendor, gl_renderer) == HW_VENDOR_NVIDIA)
return wined3d_settings.max_gl_version;
return MAKEDWORD_VERSION(4, 4);
}
static BOOL wined3d_adapter_init(struct wined3d_adapter *adapter, UINT ordinal, DWORD wined3d_creation_flags)
{
static const DWORD supported_gl_versions[] =
@ -6539,6 +6555,7 @@ static BOOL wined3d_adapter_init(struct wined3d_adapter *adapter, UINT ordinal,
struct wined3d_caps_gl_ctx caps_gl_ctx = {0};
unsigned int i;
DISPLAY_DEVICEW display_device;
DWORD max_gl_version;
TRACE("adapter %p, ordinal %u.\n", adapter, ordinal);
@ -6583,15 +6600,16 @@ static BOOL wined3d_adapter_init(struct wined3d_adapter *adapter, UINT ordinal,
return FALSE;
}
max_gl_version = get_max_gl_version(gl_info, wined3d_creation_flags);
for (i = 0; i < ARRAY_SIZE(supported_gl_versions); ++i)
{
if (supported_gl_versions[i] <= wined3d_settings.max_gl_version)
if (supported_gl_versions[i] <= max_gl_version)
break;
}
if (i == ARRAY_SIZE(supported_gl_versions))
{
ERR_(winediag)("Requested invalid GL version %u.%u.\n",
wined3d_settings.max_gl_version >> 16, wined3d_settings.max_gl_version & 0xffff);
max_gl_version >> 16, max_gl_version & 0xffff);
i = ARRAY_SIZE(supported_gl_versions) - 1;
}

View file

@ -73,6 +73,7 @@ static CRITICAL_SECTION wined3d_wndproc_cs = {&wined3d_wndproc_cs_debug, -1, 0,
struct wined3d_settings wined3d_settings =
{
FALSE, /* No multithreaded CS by default. */
FALSE, /* explicit_gl_version */
MAKEDWORD_VERSION(1, 0), /* Default to legacy OpenGL */
TRUE, /* Use of GLSL enabled by default */
ORM_FBO, /* Use FBOs to do offscreen rendering */
@ -215,12 +216,10 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
ERR_(winediag)("Setting multithreaded command stream to %#x.\n", wined3d_settings.cs_multithreaded);
if (!get_config_key_dword(hkey, appkey, "MaxVersionGL", &tmpvalue))
{
if (tmpvalue != wined3d_settings.max_gl_version)
{
ERR_(winediag)("Setting maximum allowed wined3d GL version to %u.%u.\n",
tmpvalue >> 16, tmpvalue & 0xffff);
wined3d_settings.max_gl_version = tmpvalue;
}
ERR_(winediag)("Setting maximum allowed wined3d GL version to %u.%u.\n",
tmpvalue >> 16, tmpvalue & 0xffff);
wined3d_settings.explicit_gl_version = TRUE;
wined3d_settings.max_gl_version = tmpvalue;
}
if ( !get_config_key( hkey, appkey, "UseGLSL", buffer, size) )
{

View file

@ -382,6 +382,7 @@ static inline void wined3d_pause(void)
struct wined3d_settings
{
unsigned int cs_multithreaded;
BOOL explicit_gl_version;
DWORD max_gl_version;
BOOL glslRequested;
int offscreen_rendering_mode;