On Tue Jan 27 03:25:58 2026 +0000, Zhiyi Zhang wrote:
We are falling back to the backup DC in this case. It's just that using the backup DC failed as well. ``` 01ec:err:d3d:wined3d_context_gl_set_gl_context Fallback to backup window (dc 000000001701004A) failed too, last error 0x7d0. ``` The reason why this happens with the backup DC is that in the following if condition in wined3d_context_gl_set_pixel_format(), current is 0, and context_gl->internal_format_set is 1 due to step 1. The check was introduced by 8da023fe. ``` current = gl_info->gl_ops.wgl.p_wglGetPixelFormat(dc); if ((current == format) || (!current && context_gl->internal_format_set)) goto success; ``` Another way to avoid the crash is to reset internal_format_set to FALSE when using the backup DC in wined3d_context_gl_set_gl_context(). Is the following change better? ``` TRACE("Using backup DC %p.\n", context_gl->dc); context_gl->dc_is_private = TRUE; context_gl->dc_has_format = FALSE; + context_gl->internal_format_set = FALSE; ``` Sorry for the delay. Yeah, that makes sense, and I certainly like it better.
In theory, dc_has_format is basically the equivalent of internal_format_set for backup DCs (and yeah, the naming here sucks). But we do want to reset internal_format_set or prevent checking it if we were using a valid DC and then had to switch to the backup DC. So this looks good to me. However it caused test failures, so I sent !10024 that fixes those as well. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9956#note_128726