summaryrefslogtreecommitdiffstats
path: root/examples/integration/src
diff options
context:
space:
mode:
Diffstat (limited to 'examples/integration/src')
-rw-r--r--examples/integration/src/controls.rs2
-rw-r--r--examples/integration/src/main.rs29
-rw-r--r--examples/integration/src/scene.rs5
3 files changed, 20 insertions, 16 deletions
diff --git a/examples/integration/src/controls.rs b/examples/integration/src/controls.rs
index 14e53ede..4714c397 100644
--- a/examples/integration/src/controls.rs
+++ b/examples/integration/src/controls.rs
@@ -19,7 +19,7 @@ impl Controls {
pub fn new() -> Controls {
Controls {
background_color: Color::BLACK,
- text: Default::default(),
+ text: String::default(),
}
}
diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs
index 90beb097..276794c8 100644
--- a/examples/integration/src/main.rs
+++ b/examples/integration/src/main.rs
@@ -6,13 +6,17 @@ use scene::Scene;
use iced_wgpu::graphics::Viewport;
use iced_wgpu::{wgpu, Backend, Renderer, Settings};
+use iced_winit::conversion;
+use iced_winit::core::mouse;
use iced_winit::core::renderer;
-use iced_winit::core::{mouse, window};
-use iced_winit::core::{Color, Size};
+use iced_winit::core::window;
+use iced_winit::core::{Color, Font, Pixels, Size};
+use iced_winit::futures;
use iced_winit::runtime::program;
use iced_winit::runtime::Debug;
use iced_winit::style::Theme;
-use iced_winit::{conversion, futures, winit, Clipboard};
+use iced_winit::winit;
+use iced_winit::Clipboard;
use winit::{
event::{Event, ModifiersState, WindowEvent},
@@ -29,7 +33,7 @@ use winit::platform::web::WindowBuilderExtWebSys;
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
#[cfg(target_arch = "wasm32")]
let canvas_element = {
- console_log::init_with_level(log::Level::Debug)?;
+ console_log::init().expect("Initialize logger");
std::panic::set_hook(Box::new(console_error_panic_hook::hook));
@@ -41,7 +45,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
};
#[cfg(not(target_arch = "wasm32"))]
- env_logger::init();
+ tracing_subscriber::fmt::init();
// Initialize winit
let event_loop = EventLoop::new();
@@ -82,7 +86,6 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
futures::futures::executor::block_on(async {
let adapter = wgpu::util::initialize_adapter_from_env_or_default(
&instance,
- backend,
Some(&surface),
)
.await
@@ -143,12 +146,11 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize iced
let mut debug = Debug::new();
- let mut renderer = Renderer::new(Backend::new(
- &device,
- &queue,
- Settings::default(),
- format,
- ));
+ let mut renderer = Renderer::new(
+ Backend::new(&device, &queue, Settings::default(), format),
+ Font::default(),
+ Pixels(16.0),
+ );
let mut state = program::State::new(
controls,
@@ -257,7 +259,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
{
// We clear the frame
- let mut render_pass = scene.clear(
+ let mut render_pass = Scene::clear(
&view,
&mut encoder,
program.background_color(),
@@ -274,6 +276,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
&queue,
&mut encoder,
None,
+ frame.texture.format(),
&view,
primitive,
&viewport,
diff --git a/examples/integration/src/scene.rs b/examples/integration/src/scene.rs
index 90c7efbf..e29558bf 100644
--- a/examples/integration/src/scene.rs
+++ b/examples/integration/src/scene.rs
@@ -16,7 +16,6 @@ impl Scene {
}
pub fn clear<'a>(
- &self,
target: &'a wgpu::TextureView,
encoder: &'a mut wgpu::CommandEncoder,
background_color: Color,
@@ -37,10 +36,12 @@ impl Scene {
a: a as f64,
}
}),
- store: true,
+ store: wgpu::StoreOp::Store,
},
})],
depth_stencil_attachment: None,
+ timestamp_writes: None,
+ occlusion_query_set: None,
})
}