summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar Poly <marynczak.bartlomiej@gmail.com>2021-08-19 03:06:35 +0200
committerLibravatar Poly <marynczak.bartlomiej@gmail.com>2021-08-19 03:06:38 +0200
commit18753b77fc7a64292748fb303fa75fde1dd65f4d (patch)
tree13f1cc6a528ee1cffb2614ad7285d06c8223e84c /examples
parent663c3685da4140c9224ae6b189245c991508624b (diff)
downloadiced-18753b77fc7a64292748fb303fa75fde1dd65f4d.tar.gz
iced-18753b77fc7a64292748fb303fa75fde1dd65f4d.tar.bz2
iced-18753b77fc7a64292748fb303fa75fde1dd65f4d.zip
wgpu: Update to 0.10
Diffstat (limited to 'examples')
-rw-r--r--examples/integration_wgpu/Cargo.toml2
-rw-r--r--examples/integration_wgpu/src/main.rs34
-rw-r--r--examples/integration_wgpu/src/scene.rs2
3 files changed, 20 insertions, 18 deletions
diff --git a/examples/integration_wgpu/Cargo.toml b/examples/integration_wgpu/Cargo.toml
index 743c655e..26c5a07d 100644
--- a/examples/integration_wgpu/Cargo.toml
+++ b/examples/integration_wgpu/Cargo.toml
@@ -7,5 +7,5 @@ publish = false
[dependencies]
iced_winit = { path = "../../winit" }
-iced_wgpu = { path = "../../wgpu" }
+iced_wgpu = { path = "../../wgpu", features=["spirv"] }
env_logger = "0.8"
diff --git a/examples/integration_wgpu/src/main.rs b/examples/integration_wgpu/src/main.rs
index 6f319466..7ef148bc 100644
--- a/examples/integration_wgpu/src/main.rs
+++ b/examples/integration_wgpu/src/main.rs
@@ -31,7 +31,7 @@ pub fn main() {
let mut clipboard = Clipboard::connect(&window);
// Initialize wgpu
- let instance = wgpu::Instance::new(wgpu::BackendBit::PRIMARY);
+ let instance = wgpu::Instance::new(wgpu::Backends::PRIMARY);
let surface = unsafe { instance.create_surface(&window) };
let (format, (mut device, queue)) = futures::executor::block_on(async {
@@ -44,8 +44,8 @@ pub fn main() {
.expect("Request adapter");
(
- adapter
- .get_swap_chain_preferred_format(&surface)
+ surface
+ .get_preferred_format(&adapter)
.expect("Get preferred format"),
adapter
.request_device(
@@ -61,13 +61,13 @@ pub fn main() {
)
});
- let mut swap_chain = {
+ {
let size = window.inner_size();
- device.create_swap_chain(
- &surface,
- &wgpu::SwapChainDescriptor {
- usage: wgpu::TextureUsage::RENDER_ATTACHMENT,
+ surface.configure(
+ &device,
+ &wgpu::SurfaceConfiguration {
+ usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
format,
width: size.width,
height: size.height,
@@ -158,10 +158,10 @@ pub fn main() {
if resized {
let size = window.inner_size();
- swap_chain = device.create_swap_chain(
- &surface,
- &wgpu::SwapChainDescriptor {
- usage: wgpu::TextureUsage::RENDER_ATTACHMENT,
+ surface.configure(
+ &device,
+ &wgpu::SurfaceConfiguration {
+ usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
format: format,
width: size.width,
height: size.height,
@@ -172,7 +172,7 @@ pub fn main() {
resized = false;
}
- match swap_chain.get_current_frame() {
+ match surface.get_current_frame() {
Ok(frame) => {
let mut encoder = device.create_command_encoder(
&wgpu::CommandEncoderDescriptor { label: None },
@@ -180,10 +180,12 @@ pub fn main() {
let program = state.program();
+ let view = frame.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
+
{
// We clear the frame
let mut render_pass = scene.clear(
- &frame.output.view,
+ &view,
&mut encoder,
program.background_color(),
);
@@ -197,7 +199,7 @@ pub fn main() {
&mut device,
&mut staging_belt,
&mut encoder,
- &frame.output.view,
+ &view,
&viewport,
state.primitive(),
&debug.overlay(),
@@ -223,7 +225,7 @@ pub fn main() {
local_pool.run_until_stalled();
}
Err(error) => match error {
- wgpu::SwapChainError::OutOfMemory => {
+ wgpu::SurfaceError::OutOfMemory => {
panic!("Swapchain error: {}. Rendering cannot continue.", error)
}
_ => {
diff --git a/examples/integration_wgpu/src/scene.rs b/examples/integration_wgpu/src/scene.rs
index 3e8277c8..0b2b1fcd 100644
--- a/examples/integration_wgpu/src/scene.rs
+++ b/examples/integration_wgpu/src/scene.rs
@@ -79,7 +79,7 @@ fn build_pipeline(device: &wgpu::Device) -> wgpu::RenderPipeline {
color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
- write_mask: wgpu::ColorWrite::ALL,
+ write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {