Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/platform/win/gl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,24 @@ impl GlContextInner {
);
}

// if no num_formats are found which happens in Wine for child windows, use fallback
if num_formats == 0 {
let fallback_pfd = PIXELFORMATDESCRIPTOR {
nSize: std::mem::size_of::<PIXELFORMATDESCRIPTOR>() as u16,
nVersion: 1,
dwFlags: PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
iPixelType: PFD_TYPE_RGBA,
cColorBits: 32,
cAlphaBits: config.alpha_bits,
cDepthBits: config.depth_bits,
cStencilBits: config.stencil_bits,
iLayerType: PFD_MAIN_PLANE as u8,
..std::mem::zeroed()
};
pixel_format = ChoosePixelFormat(hdc, &fallback_pfd);
}

if pixel_format == 0 {
ReleaseDC(hwnd, hdc);
return Err(GlError::CreationFailed(()));
}
Expand Down