Skip to content

Commit

Permalink
Pass 3 on examples (#4640)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwfitzgerald authored Nov 6, 2023
1 parent 0004e96 commit 0dad159
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified examples/bunnymark/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions examples/bunnymark/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct Example {

impl Example {
fn spawn_bunnies(&mut self) {
let spawn_count = 64 + self.bunnies.len() / 2;
let spawn_count = 64;
let color = self.rng.generate::<u32>();
println!(
"Spawning {} bunnies, total at {}",
Expand Down Expand Up @@ -331,15 +331,19 @@ impl wgpu_example::framework::Example for Example {

let rng = WyRand::new_seed(42);

Example {
let mut ex = Example {
pipeline,
global_group,
local_group,
bunnies: Vec::new(),
local_buffer,
extent: [config.width, config.height],
rng,
}
};

ex.spawn_bunnies();

ex
}

fn update(&mut self, event: winit::event::WindowEvent) {
Expand Down Expand Up @@ -367,11 +371,7 @@ impl wgpu_example::framework::Example for Example {
}

fn render(&mut self, view: &wgpu::TextureView, device: &wgpu::Device, queue: &wgpu::Queue) {
self.spawn_bunnies();

for _frame_number in 0..3 {
self.render_inner(view, device, queue);
}
self.render_inner(view, device, queue);
}
}

Expand Down
8 changes: 4 additions & 4 deletions examples/uniform-values/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,14 @@ fn main() {
console_log::init().expect("could not initialize logger");
use winit::platform::web::WindowExtWebSys;

let canvas = window.canvas().expect("Couldn't get canvas");
canvas.style().set_css_text("height: 100%; width: 100%;");

let document = web_sys::window()
.and_then(|win| win.document())
.expect("Failed to get document.");
let body = document.body().unwrap();
body.append_child(&web_sys::Element::from(
window.canvas().expect("Couldn't get canvas"),
))
.unwrap();
body.append_child(&canvas).unwrap();
let controls_text = document
.create_element("p")
.expect("Failed to create controls text as element.");
Expand Down

0 comments on commit 0dad159

Please sign in to comment.