diff options
Diffstat (limited to 'examples/integration_wgpu')
-rw-r--r-- | examples/integration_wgpu/src/controls.rs | 2 | ||||
-rw-r--r-- | examples/integration_wgpu/src/main.rs | 10 | ||||
-rw-r--r-- | examples/integration_wgpu/src/scene.rs | 69 |
3 files changed, 39 insertions, 42 deletions
diff --git a/examples/integration_wgpu/src/controls.rs b/examples/integration_wgpu/src/controls.rs index cb2c423f..2f1daa91 100644 --- a/examples/integration_wgpu/src/controls.rs +++ b/examples/integration_wgpu/src/controls.rs @@ -112,7 +112,7 @@ impl Program for Controls { t, "Placeholder", text, - move |text| Message::TextChanged(text), + Message::TextChanged, )), ), ) diff --git a/examples/integration_wgpu/src/main.rs b/examples/integration_wgpu/src/main.rs index 3d27a0f0..86a0d6a4 100644 --- a/examples/integration_wgpu/src/main.rs +++ b/examples/integration_wgpu/src/main.rs @@ -73,7 +73,7 @@ pub fn main() { let instance = wgpu::Instance::new(backend); let surface = unsafe { instance.create_surface(&window) }; - let (format, (mut device, queue)) = futures::executor::block_on(async { + let (format, (device, queue)) = futures::executor::block_on(async { let adapter = wgpu::util::initialize_adapter_from_env_or_default( &instance, backend, @@ -128,13 +128,13 @@ pub fn main() { let mut staging_belt = wgpu::util::StagingBelt::new(5 * 1024); // Initialize scene and GUI controls - let scene = Scene::new(&mut device, format); + let scene = Scene::new(&device, format); let controls = Controls::new(); // Initialize iced let mut debug = Debug::new(); let mut renderer = - Renderer::new(Backend::new(&mut device, Settings::default(), format)); + Renderer::new(Backend::new(&device, Settings::default(), format)); let mut state = program::State::new( controls, @@ -208,8 +208,8 @@ pub fn main() { surface.configure( &device, &wgpu::SurfaceConfiguration { + format, usage: wgpu::TextureUsages::RENDER_ATTACHMENT, - format: format, width: size.width, height: size.height, present_mode: wgpu::PresentMode::AutoVsync, @@ -244,7 +244,7 @@ pub fn main() { // And then iced on top renderer.with_primitives(|backend, primitive| { backend.present( - &mut device, + &device, &mut staging_belt, &mut encoder, &view, diff --git a/examples/integration_wgpu/src/scene.rs b/examples/integration_wgpu/src/scene.rs index af75e67c..3e41fbda 100644 --- a/examples/integration_wgpu/src/scene.rs +++ b/examples/integration_wgpu/src/scene.rs @@ -66,40 +66,37 @@ fn build_pipeline( bind_group_layouts: &[], }); - let pipeline = - device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { - label: None, - layout: Some(&pipeline_layout), - vertex: wgpu::VertexState { - module: &vs_module, - entry_point: "main", - buffers: &[], - }, - fragment: Some(wgpu::FragmentState { - module: &fs_module, - entry_point: "main", - targets: &[Some(wgpu::ColorTargetState { - format: texture_format, - blend: Some(wgpu::BlendState { - color: wgpu::BlendComponent::REPLACE, - alpha: wgpu::BlendComponent::REPLACE, - }), - write_mask: wgpu::ColorWrites::ALL, - })], - }), - primitive: wgpu::PrimitiveState { - topology: wgpu::PrimitiveTopology::TriangleList, - front_face: wgpu::FrontFace::Ccw, - ..Default::default() - }, - depth_stencil: None, - multisample: wgpu::MultisampleState { - count: 1, - mask: !0, - alpha_to_coverage_enabled: false, - }, - multiview: None, - }); - - pipeline + device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { + label: None, + layout: Some(&pipeline_layout), + vertex: wgpu::VertexState { + module: &vs_module, + entry_point: "main", + buffers: &[], + }, + fragment: Some(wgpu::FragmentState { + module: &fs_module, + entry_point: "main", + targets: &[Some(wgpu::ColorTargetState { + format: texture_format, + blend: Some(wgpu::BlendState { + color: wgpu::BlendComponent::REPLACE, + alpha: wgpu::BlendComponent::REPLACE, + }), + write_mask: wgpu::ColorWrites::ALL, + })], + }), + primitive: wgpu::PrimitiveState { + topology: wgpu::PrimitiveTopology::TriangleList, + front_face: wgpu::FrontFace::Ccw, + ..Default::default() + }, + depth_stencil: None, + multisample: wgpu::MultisampleState { + count: 1, + mask: !0, + alpha_to_coverage_enabled: false, + }, + multiview: None, + }) } |