Commit 8da023fe authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Do not set the pixel format if wglGetPixelFormat() returns zero and we…

wined3d: Do not set the pixel format if wglGetPixelFormat() returns zero and we already set the internal pixel format. 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.
parent 15f03ac3
......@@ -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;
}
}
}
......
......@@ -2346,8 +2346,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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment