mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-24 02:46:33 +11:00
Fix creating non-hardware-accelerated contexts
This commit is contained in:
parent
cf252c29b4
commit
7ba8fdf3f3
2 changed files with 8 additions and 6 deletions
|
@ -197,6 +197,7 @@ pub enum MouseCursor {
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct PixelFormat {
|
pub struct PixelFormat {
|
||||||
|
pub hardware_accelerated: bool,
|
||||||
pub red_bits: u8,
|
pub red_bits: u8,
|
||||||
pub green_bits: u8,
|
pub green_bits: u8,
|
||||||
pub blue_bits: u8,
|
pub blue_bits: u8,
|
||||||
|
@ -286,6 +287,10 @@ impl<'a> BuilderAttribs<'a> {
|
||||||
|
|
||||||
// TODO: do this more properly
|
// TODO: do this more properly
|
||||||
for (id, format) in iter {
|
for (id, format) in iter {
|
||||||
|
if !format.hardware_accelerated {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if format.red_bits + format.green_bits + format.blue_bits < self.color_bits.unwrap_or(0) {
|
if format.red_bits + format.green_bits + format.blue_bits < self.color_bits.unwrap_or(0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -411,13 +411,8 @@ fn enumerate_native_pixel_formats(hdc: winapi::HDC) -> Vec<(PixelFormat, libc::c
|
||||||
if (output.dwFlags & winapi::PFD_DRAW_TO_WINDOW) == 0 {
|
if (output.dwFlags & winapi::PFD_DRAW_TO_WINDOW) == 0 {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (output.dwFlags & winapi::PFD_SUPPORT_OPENGL) == 0 {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (output.dwFlags & winapi::PFD_GENERIC_ACCELERATED) == 0 &&
|
if (output.dwFlags & winapi::PFD_SUPPORT_OPENGL) == 0 {
|
||||||
(output.dwFlags & winapi::PFD_GENERIC_FORMAT) == 0
|
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,6 +421,7 @@ fn enumerate_native_pixel_formats(hdc: winapi::HDC) -> Vec<(PixelFormat, libc::c
|
||||||
}
|
}
|
||||||
|
|
||||||
result.push((PixelFormat {
|
result.push((PixelFormat {
|
||||||
|
hardware_accelerated: (output.dwFlags & winapi::PFD_GENERIC_FORMAT) == 0,
|
||||||
red_bits: output.cRedBits,
|
red_bits: output.cRedBits,
|
||||||
green_bits: output.cGreenBits,
|
green_bits: output.cGreenBits,
|
||||||
blue_bits: output.cBlueBits,
|
blue_bits: output.cBlueBits,
|
||||||
|
@ -476,6 +472,7 @@ fn enumerate_arb_pixel_formats(extra: &gl::wgl_extra::Wgl, hdc: winapi::HDC)
|
||||||
}
|
}
|
||||||
|
|
||||||
result.push((PixelFormat {
|
result.push((PixelFormat {
|
||||||
|
hardware_accelerated: true,
|
||||||
red_bits: get_info(index, gl::wgl_extra::RED_BITS_ARB) as u8,
|
red_bits: get_info(index, gl::wgl_extra::RED_BITS_ARB) as u8,
|
||||||
green_bits: get_info(index, gl::wgl_extra::GREEN_BITS_ARB) as u8,
|
green_bits: get_info(index, gl::wgl_extra::GREEN_BITS_ARB) as u8,
|
||||||
blue_bits: get_info(index, gl::wgl_extra::BLUE_BITS_ARB) as u8,
|
blue_bits: get_info(index, gl::wgl_extra::BLUE_BITS_ARB) as u8,
|
||||||
|
|
Loading…
Add table
Reference in a new issue