Skip to content

Commit

Permalink
Support wgpu 0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
cwfitzgerald committed Oct 8, 2021
1 parent e04038f commit 685c876
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ Per Keep a Changelog there are 6 main categories of changes:

## Unreleased

#### Updated
- updated wgpu dependency to `>=0.10,<0.12`

## v0.17.1

Released 2021-09-22
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ bytemuck = "1"
imgui = ">=0.1, <0.9"
log = "0.4"
smallvec = "1"
wgpu = "0.10"
wgpu = ">=0.10, <0.12"

[dev-dependencies]
bytemuck = { version = "1.4", features = ["derive"] }
Expand Down
5 changes: 4 additions & 1 deletion examples/hello-world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ fn main() {
let adapter = block_on(instance.request_adapter(&wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::HighPerformance,
compatible_surface: Some(&surface),
force_fallback_adapter: false,
}))
.unwrap();

Expand Down Expand Up @@ -152,7 +153,7 @@ fn main() {
imgui.io_mut().update_delta_time(now - last_frame);
last_frame = now;

let frame = match surface.get_current_frame() {
let frame = match surface.get_current_texture() {
Ok(frame) => frame,
Err(e) => {
eprintln!("dropped frame: {:?}", e);
Expand Down Expand Up @@ -222,6 +223,8 @@ fn main() {
drop(rpass);

queue.submit(Some(encoder.finish()));

frame.submit();
}
_ => (),
}
Expand Down
2 changes: 1 addition & 1 deletion simple-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ imgui-wgpu = { path = ".." }
imgui-winit-support = "0.8"
pollster = "0.2" # for block_on executor
winit = "0.25"
wgpu = "0.10"
wgpu = "0.11"

5 changes: 3 additions & 2 deletions simple-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ pub fn run<YourState: 'static, UiFunction: 'static + Fn(&imgui::Ui, &mut YourSta
let adapter = block_on(instance.request_adapter(&wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::HighPerformance,
compatible_surface: Some(&surface),
force_fallback_adapter: false,
}))
.unwrap();

Expand Down Expand Up @@ -205,7 +206,7 @@ pub fn run<YourState: 'static, UiFunction: 'static + Fn(&imgui::Ui, &mut YourSta
imgui.io_mut().update_delta_time(now - last_frame);
last_frame = now;

let frame = match surface.get_current_frame() {
let frame = match surface.get_current_texture() {
Ok(frame) => frame,
Err(e) => {
eprintln!("dropped frame: {:?}", e);
Expand All @@ -228,7 +229,6 @@ pub fn run<YourState: 'static, UiFunction: 'static + Fn(&imgui::Ui, &mut YourSta
}

let view = frame
.output
.texture
.create_view(&wgpu::TextureViewDescriptor::default());
let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
Expand All @@ -251,6 +251,7 @@ pub fn run<YourState: 'static, UiFunction: 'static + Fn(&imgui::Ui, &mut YourSta
drop(rpass);

queue.submit(Some(encoder.finish()));
frame.present();
}
Event::WindowEvent { ref event, .. } => {
(config.on_event)(event, &mut state);
Expand Down

0 comments on commit 685c876

Please sign in to comment.