Skip to content

Commit

Permalink
Use GLib instead of another local executor
Browse files Browse the repository at this point in the history
  • Loading branch information
valpackett committed Nov 13, 2020
1 parent 20d49fc commit 897c089
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
1 change: 1 addition & 0 deletions wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ raw-window-handle = "0.3"
log = "0.4"
guillotiere = "0.6"
futures = "0.3"
glib = "0"

[dependencies.bytemuck]
version = "1.4"
Expand Down
10 changes: 1 addition & 9 deletions wgpu/src/window/compositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub struct Compositor {
device: wgpu::Device,
queue: wgpu::Queue,
staging_belt: wgpu::util::StagingBelt,
local_pool: futures::executor::LocalPool,
}

impl Compositor {
Expand Down Expand Up @@ -54,15 +53,13 @@ impl Compositor {
.ok()?;

let staging_belt = wgpu::util::StagingBelt::new(Self::CHUNK_SIZE);
let local_pool = futures::executor::LocalPool::new();

Some(Compositor {
instance,
settings,
device,
queue,
staging_belt,
local_pool,
})
}

Expand Down Expand Up @@ -171,12 +168,7 @@ impl iced_graphics::window::Compositor for Compositor {
self.queue.submit(Some(encoder.finish()));

// Recall staging buffers
self.local_pool
.spawner()
.spawn(self.staging_belt.recall())
.expect("Recall staging belt");

self.local_pool.run_until_stalled();
glib::MainContext::default().spawn(self.staging_belt.recall());

mouse_interaction
}
Expand Down

0 comments on commit 897c089

Please sign in to comment.