From 4d81cc2df1e1a4867a8c874a39365f90b26e2cdb Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 2 Apr 2015 13:53:15 +0200 Subject: [PATCH] Fix missing parameter for pixel formats infos on win32 --- build.rs | 1 + src/lib.rs | 4 ---- src/win32/init.rs | 17 +++++++++++++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/build.rs b/build.rs index 7aeeda91..4914e2de 100644 --- a/build.rs +++ b/build.rs @@ -29,6 +29,7 @@ fn main() { "WGL_ARB_create_context_profile".to_string(), "WGL_ARB_extensions_string".to_string(), "WGL_ARB_framebuffer_sRGB".to_string(), + "WGL_ARB_multisample".to_string(), "WGL_ARB_pixel_format".to_string(), "WGL_EXT_create_context_es2_profile".to_string(), "WGL_EXT_extensions_string".to_string(), diff --git a/src/lib.rs b/src/lib.rs index c97f7699..813ec0c1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -332,10 +332,6 @@ impl<'a> BuilderAttribs<'a> { continue; } - if self.multisampling.is_some() && format.multisampling.is_none() { - continue; - } - current_software_result = Some((id.clone(), format.clone())); if format.hardware_accelerated { current_result = Some((id, format)); diff --git a/src/win32/init.rs b/src/win32/init.rs index d0012e27..c296a9de 100644 --- a/src/win32/init.rs +++ b/src/win32/init.rs @@ -491,8 +491,21 @@ unsafe fn enumerate_arb_pixel_formats(extra: &gl::wgl_extra::Wgl, hdc: &WindowWr stencil_bits: get_info(index, gl::wgl_extra::STENCIL_BITS_ARB) as u8, stereoscopy: get_info(index, gl::wgl_extra::STEREO_ARB) != 0, double_buffer: get_info(index, gl::wgl_extra::DOUBLE_BUFFER_ARB) != 0, - multisampling: None, // FIXME: - srgb: false, // FIXME: + multisampling: { + if is_extension_supported(extra, hdc, "WGL_ARB_multisample") { + match get_info(index, gl::wgl_extra::SAMPLES_ARB) { + 0 => None, + a => Some(a as u16), + } + } else { + None + } + }, + srgb: if is_extension_supported(extra, hdc, "WGL_ARB_framebuffer_sRGB") { + get_info(index, gl::wgl_extra::FRAMEBUFFER_SRGB_CAPABLE_ARB) != 0 + } else { + false + }, }, index as libc::c_int)); }