Add debug option to disable vsync for profiling.

This commit is contained in:
Glenn Watson 2015-12-01 05:40:00 +10:00
parent 0f72049363
commit 6c8905126f
2 changed files with 26 additions and 11 deletions

View file

@ -86,17 +86,21 @@ impl Window {
pub fn new(is_foreground: bool,
window_size: TypedSize2D<DevicePixel, u32>,
parent: Option<glutin::WindowID>) -> Rc<Window> {
let mut glutin_window = glutin::WindowBuilder::new()
.with_title("Servo".to_string())
.with_decorations(!opts::get().no_native_titlebar)
.with_vsync()
.with_dimensions(window_size.to_untyped().width, window_size.to_untyped().height)
.with_gl(Window::gl_version())
.with_visibility(is_foreground)
.with_parent(parent)
.with_multitouch()
.build()
.unwrap();
let width = window_size.to_untyped().width;
let height = window_size.to_untyped().height;
let mut builder = glutin::WindowBuilder::new().with_title("Servo".to_string())
.with_decorations(!opts::get().no_native_titlebar)
.with_dimensions(width, height)
.with_gl(Window::gl_version())
.with_visibility(is_foreground)
.with_parent(parent)
.with_multitouch();
if opts::get().enable_vsync {
builder = builder.with_vsync();
}
let mut glutin_window = builder.build().unwrap();
unsafe { glutin_window.make_current().expect("Failed to make context current!") }