From: Bernie Innocenti Date: Mon, 1 Nov 2021 04:43:45 +0000 (-0700) Subject: Fix benchmarks for latest glium/glutin API X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=HEAD;p=mandelwow.git Fix benchmarks for latest glium/glutin API --- diff --git a/benches/bounding_box.rs b/benches/bounding_box.rs index 54351d9..7187354 100644 --- a/benches/bounding_box.rs +++ b/benches/bounding_box.rs @@ -4,17 +4,18 @@ extern crate test; use glium::uniform; use mandelwow_lib::Cube; use mandelwow_lib::bounding_box::*; +use std::rc::Rc; #[bench] fn bench_bounding_box(b: &mut test::Bencher) { - let events_loop = glium::glutin::EventsLoop::new(); - let window = glium::glutin::WindowBuilder::new(); - let context = glium::glutin::ContextBuilder::new(); - let display = glium::Display::new(window, context, &events_loop).unwrap(); + let event_loop = glutin::event_loop::EventLoop::new(); + let window = glutin::window::WindowBuilder::new(); + let context = glutin::ContextBuilder::new(); + let display = glium::Display::new(window, context, &event_loop).unwrap(); - let program = solid_fill_program(&display); + let program = Rc::new(solid_fill_program(&display)); let bounds = Cube { xmin: -2., xmax: 0.7, ymin: -1., ymax: 1., zmin: -1.1, zmax: 1.1 }; - let bbox = BoundingBox::new(&display, &bounds, &program); + let bbox = BoundingBox::new(&display, &bounds, program); let mut frame = display.draw(); b.iter(|| { let mat = [[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.0f32]]; diff --git a/benches/shaded_cube.rs b/benches/shaded_cube.rs index 842e290..6c51ab2 100644 --- a/benches/shaded_cube.rs +++ b/benches/shaded_cube.rs @@ -3,16 +3,17 @@ extern crate test; use glium::uniform; use mandelwow_lib::shaded_cube::*; +use std::rc::Rc; #[bench] fn bench_shaded_cube(b: &mut test::Bencher) { - let events_loop = glium::glutin::EventsLoop::new(); - let window = glium::glutin::WindowBuilder::new(); - let context = glium::glutin::ContextBuilder::new(); - let display = glium::Display::new(window, context, &events_loop).unwrap(); + let event_loop = glutin::event_loop::EventLoop::new(); + let window = glutin::window::WindowBuilder::new(); + let context = glutin::ContextBuilder::new(); + let display = glium::Display::new(window, context, &event_loop).unwrap(); - let program = shaded_program(&display); - let cube = ShadedCube::new(&display, &program); + let program = Rc::new(shaded_program(&display)); + let cube = ShadedCube::new(&display, program); let mut frame = display.draw(); b.iter(|| { let model = [[0.7, 0.5, -0.5, 0.0], [0.0, 0.7, 0.7, 0.0], [0.7, -0.5, 0.5, 0.0], [0., 0., -3.0, 1.0f32]];