Update wgpu to 0.8 (#160)

- Also update other dependencies
This commit is contained in:
Jay Oster 2021-05-07 23:52:11 -07:00 committed by GitHub
parent 316400e6e0
commit f238814d12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 35 additions and 28 deletions

View file

@ -22,14 +22,15 @@ include = [
pollster = "0.2" pollster = "0.2"
raw-window-handle = "0.3" raw-window-handle = "0.3"
thiserror = "1.0" thiserror = "1.0"
ultraviolet = "0.7" ultraviolet = "0.8"
wgpu = "0.7" wgpu = "0.8.1"
[dev-dependencies] [dev-dependencies]
pixels-mocks = { path = "internals/pixels-mocks" } pixels-mocks = { path = "internals/pixels-mocks" }
winit = "0.24" winit = "0.24"
[workspace] [workspace]
resolver = "2"
members = [ members = [
"examples/*", "examples/*",
"internals/*", "internals/*",

View file

@ -147,7 +147,7 @@ fn create_noise_renderer(pixels: &Pixels) -> (wgpu::TextureView, NoiseRenderer)
size: pixels::wgpu::Extent3d { size: pixels::wgpu::Extent3d {
width: WIDTH, width: WIDTH,
height: HEIGHT, height: HEIGHT,
depth: 1, depth_or_array_layers: 1,
}, },
mip_level_count: 1, mip_level_count: 1,
sample_count: 1, sample_count: 1,

View file

@ -83,11 +83,11 @@ impl NoiseRenderer {
}, },
wgpu::BindGroupEntry { wgpu::BindGroupEntry {
binding: 2, binding: 2,
resource: wgpu::BindingResource::Buffer { resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding {
buffer: &time_buffer, buffer: &time_buffer,
offset: 0, offset: 0,
size: None, size: None,
}, }),
}, },
], ],
}); });
@ -114,8 +114,10 @@ impl NoiseRenderer {
entry_point: "main", entry_point: "main",
targets: &[wgpu::ColorTargetState { targets: &[wgpu::ColorTargetState {
format: wgpu::TextureFormat::Bgra8UnormSrgb, format: wgpu::TextureFormat::Bgra8UnormSrgb,
color_blend: wgpu::BlendState::REPLACE, blend: Some(wgpu::BlendState {
alpha_blend: wgpu::BlendState::REPLACE, color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL, write_mask: wgpu::ColorWrite::ALL,
}], }],
}), }),
@ -139,8 +141,8 @@ impl NoiseRenderer {
) { ) {
let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("NoiseRenderer render pass"), label: Some("NoiseRenderer render pass"),
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { color_attachments: &[wgpu::RenderPassColorAttachment {
attachment: render_target, view: render_target,
resolve_target: None, resolve_target: None,
ops: wgpu::Operations { ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::BLACK), load: wgpu::LoadOp::Clear(wgpu::Color::BLACK),

View file

@ -10,9 +10,9 @@ optimize = ["log/release_max_level_warn"]
default = ["optimize"] default = ["optimize"]
[dependencies] [dependencies]
egui = "0.10" egui = "0.11"
egui_wgpu_backend = { git = "https://github.com/hasenbanck/egui_wgpu_backend.git", rev = "9d03ad345d15d1e44165849b242d3562fdf3e859" } egui_wgpu_backend = "0.7"
egui_winit_platform = { git = "https://github.com/hasenbanck/egui_winit_platform.git", rev = "17298250e9721e8bf2c1d4a17b3e22777f8cb2e8" } egui_winit_platform = "0.6"
env_logger = "0.8" env_logger = "0.8"
log = "0.4" log = "0.4"
pixels = { path = "../.." } pixels = { path = "../.." }

View file

@ -96,7 +96,8 @@ impl Gui {
ui.separator(); ui.separator();
ui.horizontal_for_text(egui::TextStyle::Body, |ui| { ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x /= 2.0;
ui.label("Learn more about egui at"); ui.label("Learn more about egui at");
ui.hyperlink("https://docs.rs/egui"); ui.hyperlink("https://docs.rs/egui");
}); });

View file

@ -12,7 +12,7 @@ default = ["optimize"]
[dependencies] [dependencies]
env_logger = "0.8" env_logger = "0.8"
imgui = "0.7" imgui = "0.7"
imgui-wgpu = "0.14" imgui-wgpu = "0.15.1"
imgui-winit-support = "0.7" imgui-winit-support = "0.7"
log = "0.4" log = "0.4"
pixels = { path = "../.." } pixels = { path = "../.." }

View file

@ -115,8 +115,8 @@ impl Gui {
// Render Dear ImGui with WGPU // Render Dear ImGui with WGPU
let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("imgui"), label: Some("imgui"),
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { color_attachments: &[wgpu::RenderPassColorAttachment {
attachment: render_target, view: render_target,
resolve_target: None, resolve_target: None,
ops: wgpu::Operations { ops: wgpu::Operations {
load: wgpu::LoadOp::Load, load: wgpu::LoadOp::Load,

View file

@ -10,7 +10,7 @@ optimize = ["log/release_max_level_warn"]
default = ["optimize"] default = ["optimize"]
[dependencies] [dependencies]
fltk = { version = "0.15", features = ["no-pango"] } fltk = { version = "1.0", features = ["no-images", "no-pango"] }
env_logger = "0.8" env_logger = "0.8"
log = "0.4" log = "0.4"
pixels = { path = "../.." } pixels = { path = "../.." }

View file

@ -291,7 +291,7 @@ pub(crate) fn create_backing_texture(
let texture_extent = wgpu::Extent3d { let texture_extent = wgpu::Extent3d {
width, width,
height, height,
depth: 1, depth_or_array_layers: 1,
}; };
let texture = device.create_texture(&wgpu::TextureDescriptor { let texture = device.create_texture(&wgpu::TextureDescriptor {

View file

@ -31,6 +31,7 @@
pub use crate::builder::PixelsBuilder; pub use crate::builder::PixelsBuilder;
pub use crate::renderers::ScalingRenderer; pub use crate::renderers::ScalingRenderer;
pub use raw_window_handle; pub use raw_window_handle;
use std::num::NonZeroU32;
pub use wgpu; pub use wgpu;
use raw_window_handle::HasRawWindowHandle; use raw_window_handle::HasRawWindowHandle;
@ -359,16 +360,16 @@ impl Pixels {
let bytes_per_row = let bytes_per_row =
(self.context.texture_extent.width as f32 * self.context.texture_format_size) as u32; (self.context.texture_extent.width as f32 * self.context.texture_format_size) as u32;
self.context.queue.write_texture( self.context.queue.write_texture(
wgpu::TextureCopyView { wgpu::ImageCopyTexture {
texture: &self.context.texture, texture: &self.context.texture,
mip_level: 0, mip_level: 0,
origin: wgpu::Origin3d { x: 0, y: 0, z: 0 }, origin: wgpu::Origin3d { x: 0, y: 0, z: 0 },
}, },
&self.pixels, &self.pixels,
wgpu::TextureDataLayout { wgpu::ImageDataLayout {
offset: 0, offset: 0,
bytes_per_row, bytes_per_row: NonZeroU32::new(bytes_per_row),
rows_per_image: self.context.texture_extent.height, rows_per_image: NonZeroU32::new(self.context.texture_extent.height),
}, },
self.context.texture_extent, self.context.texture_extent,
); );

View file

@ -101,11 +101,11 @@ impl ScalingRenderer {
}, },
wgpu::BindGroupEntry { wgpu::BindGroupEntry {
binding: 2, binding: 2,
resource: wgpu::BindingResource::Buffer { resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding {
buffer: &uniform_buffer, buffer: &uniform_buffer,
offset: 0, offset: 0,
size: None, size: None,
}, }),
}, },
], ],
}); });
@ -132,8 +132,10 @@ impl ScalingRenderer {
entry_point: "main", entry_point: "main",
targets: &[wgpu::ColorTargetState { targets: &[wgpu::ColorTargetState {
format: render_texture_format, format: render_texture_format,
color_blend: wgpu::BlendState::REPLACE, blend: Some(wgpu::BlendState {
alpha_blend: wgpu::BlendState::REPLACE, color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL, write_mask: wgpu::ColorWrite::ALL,
}], }],
}), }),
@ -153,8 +155,8 @@ impl ScalingRenderer {
// Draw the updated texture to the render target // Draw the updated texture to the render target
let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("pixels_scaling_renderer_render_pass"), label: Some("pixels_scaling_renderer_render_pass"),
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { color_attachments: &[wgpu::RenderPassColorAttachment {
attachment: render_target, view: render_target,
resolve_target: None, resolve_target: None,
ops: wgpu::Operations { ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::BLACK), load: wgpu::LoadOp::Clear(wgpu::Color::BLACK),