From: Zebediah Figura zfigura@codeweavers.com
Currently this does nothing, because wglGetPixelFormat() returns the pixel format set by wglSetPixelFormatWINE(). However, with the following changes to WGL_WINE_pixel_format_passthrough, wglGetPixelFormat() will only return the pixel format set by wglSetPixelFormat(). Hence we should avoid trying to set the "internal" pixel format more than once. --- dlls/wined3d/context_gl.c | 15 +++++++++++---- dlls/wined3d/wined3d_private.h | 3 ++- 2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index 5574997bf05..a59f7549cc2 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -1210,7 +1210,8 @@ static BOOL wined3d_context_gl_set_pixel_format(struct wined3d_context_gl *conte return FALSE;
current = gl_info->gl_ops.wgl.p_wglGetPixelFormat(dc); - if (current == format) goto success; + if ((current == format) || (!current && context_gl->internal_format_set)) + goto success;
/* By default WGL doesn't allow pixel format adjustments but we need it * here. For this reason there's a Wine specific wglSetPixelFormat() @@ -1225,6 +1226,7 @@ static BOOL wined3d_context_gl_set_pixel_format(struct wined3d_context_gl *conte format, dc); return FALSE; } + context_gl->internal_format_set = 1; } else if (current) { @@ -1346,6 +1348,7 @@ static void wined3d_context_gl_update_window(struct wined3d_context_gl *context_ context_gl->dc_has_format = FALSE; context_gl->needs_set = 1; context_gl->valid = 1; + context_gl->internal_format_set = 0;
if (!(context_gl->dc = GetDCEx(context_gl->window, 0, DCX_USESTYLE | DCX_CACHE))) { @@ -1673,9 +1676,13 @@ static void wined3d_context_gl_enter(struct wined3d_context_gl *context_gl) context_gl->restore_dc = wglGetCurrentDC(); context_gl->needs_set = 1; } - else if (!context_gl->needs_set && !(context_gl->dc_is_private && context_gl->dc_has_format) - && context_gl->pixel_format != context_gl->gl_info->gl_ops.wgl.p_wglGetPixelFormat(context_gl->dc)) - context_gl->needs_set = 1; + else if (!context_gl->needs_set && !(context_gl->dc_is_private && context_gl->dc_has_format)) + { + int current = context_gl->gl_info->gl_ops.wgl.p_wglGetPixelFormat(context_gl->dc); + + if ((current && current != context_gl->pixel_format) || (!current && !context_gl->internal_format_set)) + context_gl->needs_set = 1; + } } }
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 459ac7a19c8..920e98cd0eb 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2347,8 +2347,9 @@ struct wined3d_context_gl uint32_t rebind_fbo : 1; uint32_t untracked_material_count : 2; /* Max value 2 */ uint32_t needs_set : 1; + uint32_t internal_format_set : 1; uint32_t valid : 1; - uint32_t padding : 23; + uint32_t padding : 22;
uint32_t default_attrib_value_set;