summaryrefslogtreecommitdiffstats
path: root/wgpu/src/window/compositor.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2021-11-07 15:15:33 +0700
committerLibravatar GitHub <noreply@github.com>2021-11-07 15:15:33 +0700
commiteafad00af2a9bae9f3ed8124e2a6f6e59ee5d253 (patch)
tree76413948c9c9723075189d51d4c2e02c0f8fdd23 /wgpu/src/window/compositor.rs
parent61c747b53589d98f477fea95f85d2ea5349666d3 (diff)
parent07b5097bc92ced376d09115d787ff1d2ebe00836 (diff)
downloadiced-eafad00af2a9bae9f3ed8124e2a6f6e59ee5d253.tar.gz
iced-eafad00af2a9bae9f3ed8124e2a6f6e59ee5d253.tar.bz2
iced-eafad00af2a9bae9f3ed8124e2a6f6e59ee5d253.zip
Merge pull request #1110 from iced-rs/remove-renderer-traits
Reduce the surface of the `Renderer` APIs
Diffstat (limited to 'wgpu/src/window/compositor.rs')
-rw-r--r--wgpu/src/window/compositor.rs29
1 files changed, 15 insertions, 14 deletions
diff --git a/wgpu/src/window/compositor.rs b/wgpu/src/window/compositor.rs
index bd8e1f89..3b264475 100644
--- a/wgpu/src/window/compositor.rs
+++ b/wgpu/src/window/compositor.rs
@@ -1,7 +1,7 @@
use crate::{Backend, Color, Error, Renderer, Settings, Viewport};
use futures::task::SpawnExt;
-use iced_native::{futures, mouse};
+use iced_native::futures;
use raw_window_handle::HasRawWindowHandle;
/// A window graphics backend for iced powered by `wgpu`.
@@ -133,15 +133,14 @@ impl iced_graphics::window::Compositor for Compositor {
);
}
- fn draw<T: AsRef<str>>(
+ fn present<T: AsRef<str>>(
&mut self,
renderer: &mut Self::Renderer,
surface: &mut Self::Surface,
viewport: &Viewport,
background_color: Color,
- output: &<Self::Renderer as iced_native::Renderer>::Output,
overlay: &[T],
- ) -> Result<mouse::Interaction, iced_graphics::window::SurfaceError> {
+ ) -> Result<(), iced_graphics::window::SurfaceError> {
match surface.get_current_texture() {
Ok(frame) => {
let mut encoder = self.device.create_command_encoder(
@@ -180,15 +179,17 @@ impl iced_graphics::window::Compositor for Compositor {
depth_stencil_attachment: None,
});
- let mouse_interaction = renderer.backend_mut().draw(
- &mut self.device,
- &mut self.staging_belt,
- &mut encoder,
- view,
- viewport,
- output,
- overlay,
- );
+ renderer.with_primitives(|backend, primitives| {
+ backend.present(
+ &mut self.device,
+ &mut self.staging_belt,
+ &mut encoder,
+ view,
+ primitives,
+ viewport,
+ overlay,
+ );
+ });
// Submit work
self.staging_belt.finish();
@@ -203,7 +204,7 @@ impl iced_graphics::window::Compositor for Compositor {
self.local_pool.run_until_stalled();
- Ok(mouse_interaction)
+ Ok(())
}
Err(error) => match error {
wgpu::SurfaceError::Timeout => {