Fix benchmarks for latest glium/glutin API master
authorBernie Innocenti <bernie@codewiz.org>
Mon, 1 Nov 2021 04:43:45 +0000 (21:43 -0700)
committerBernie Innocenti <bernie@codewiz.org>
Mon, 1 Nov 2021 04:43:45 +0000 (21:43 -0700)
Cargo.toml
benches/bounding_box.rs
benches/shaded_cube.rs
rust-rocket
timer.rs

index c360bb20ef164a0c9df973b911a31f76fa77f7a4..4143b23da253e3d88cdabc209280ca0dfca73074 100644 (file)
@@ -15,9 +15,9 @@ opt-level = 3
 [dependencies]
 cgmath = "*"
 #gleam = "*"
 [dependencies]
 cgmath = "*"
 #gleam = "*"
-glium = "0.29"
-glutin = "0.26"
-winit = { version = "0.24", features = ["web-sys"] }
+glium = "0.30"
+glutin = "0.27"
+winit = { version = "0.25", features = ["web-sys"] }
 image = { version = "*", features = ["png_codec"], optional = true }
 instant = { version = "0.1", features = ["wasm-bindgen"] }
 libxm = "1.0.0"
 image = { version = "*", features = ["png_codec"], optional = true }
 instant = { version = "0.1", features = ["wasm-bindgen"] }
 libxm = "1.0.0"
index 54351d9534c674f92e907cf70eed81dd6203e8db..7187354c800d9c22537c0f234c26f633b099b4c5 100644 (file)
@@ -4,17 +4,18 @@ extern crate test;
 use glium::uniform;
 use mandelwow_lib::Cube;
 use mandelwow_lib::bounding_box::*;
 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) {
 
 #[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 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]];
     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]];
index 842e290286cfb441cf8cf2b018ac78e1c2a67b3d..6c51ab27dd6e1b41a5c09739cb0d44c9ab6a730c 100644 (file)
@@ -3,16 +3,17 @@ extern crate test;
 
 use glium::uniform;
 use mandelwow_lib::shaded_cube::*;
 
 use glium::uniform;
 use mandelwow_lib::shaded_cube::*;
+use std::rc::Rc;
 
 #[bench]
 fn bench_shaded_cube(b: &mut test::Bencher) {
 
 #[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]];
     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]];
index 3ca2caba4878c73bfa4d2d7a36c2f3b943f9888a..006eaf1463af595aa11113b5e4f407e3223a40df 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 3ca2caba4878c73bfa4d2d7a36c2f3b943f9888a
+Subproject commit 006eaf1463af595aa11113b5e4f407e3223a40df
index 9f4abe0fa85ce830642c4a3f2e942f420a792375..93458388961fc272201867377c5357033cf2b947 100644 (file)
--- a/timer.rs
+++ b/timer.rs
@@ -4,7 +4,7 @@ use std::time::{Duration, Instant};
 use rust_rocket;
 
 #[cfg(feature = "editor")]
 use rust_rocket;
 
 #[cfg(feature = "editor")]
-type Rocket = rust_rocket::Rocket;
+type Rocket = rust_rocket::client::RocketClient;
 
 #[cfg(not(feature = "editor"))]
 type Rocket = ();
 
 #[cfg(not(feature = "editor"))]
 type Rocket = ();
@@ -100,17 +100,19 @@ impl Timer {
 
     #[cfg(feature = "editor")]
     fn poll_rocket(&mut self) {
 
     #[cfg(feature = "editor")]
     fn poll_rocket(&mut self) {
+        use rust_rocket::client::Event;
+
         match self.rocket {
             Some(ref mut rocket) => {
                 let current_row = (self.t * BPS) as u32;
         match self.rocket {
             Some(ref mut rocket) => {
                 let current_row = (self.t * BPS) as u32;
-                if let Some(event) = rocket.poll_events() {
+                if let Some(event) = rocket.poll_events().unwrap() {
                     match event {
                     match event {
-                        rust_rocket::Event::SetRow(row) => {
+                        Event::SetRow(row) => {
                             println!("SetRow (row: {:?})", row);
                             self.t = row as f32 / BPS;
                         }
                             println!("SetRow (row: {:?})", row);
                             self.t = row as f32 / BPS;
                         }
-                        rust_rocket::Event::Pause(_) => {
-                            let track1 = rocket.get_track_mut("test");
+                        Event::Pause(_) => {
+                            let track1 = rocket.get_track_mut("test").unwrap();
                             println!("Pause (value: {:?}) (row: {:?})", track1.get_value(current_row as f32), current_row);
                         }
                         _ => (),
                             println!("Pause (value: {:?}) (row: {:?})", track1.get_value(current_row as f32), current_row);
                         }
                         _ => (),