Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade dependencies related to wgpu/winit #975

Merged
merged 1 commit into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
639 changes: 444 additions & 195 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions crates/fj-viewer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ bytemuck = "1.12.1"
raw-window-handle = "0.4.3"
thiserror = "1.0.32"
tracing = "0.1.35"
wgpu = "0.12.0"
wgpu_glyph = "0.16.0"
wgpu = "0.13.1"
wgpu_glyph = "0.17.0"

[dependencies.fj-interop]
version = "0.12.0"
Expand All @@ -32,11 +32,11 @@ version = "0.12.0"
path = "../fj-math"

[dependencies.egui]
version = "0.18.1"
version = "0.19.0"

[dependencies.egui-wgpu]
version = "0.18.0"
version = "0.19.0"
features = ["winit"]

[dependencies.egui-winit]
version = "0.18.0"
version = "0.19.0"
4 changes: 2 additions & 2 deletions crates/fj-viewer/src/graphics/drawables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ impl<'r> Drawable<'r> {
let mut render_pass =
encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: None,
color_attachments: &[wgpu::RenderPassColorAttachment {
color_attachments: &[Some(wgpu::RenderPassColorAttachment {
view: color_view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Load,
store: true,
},
}],
})],
depth_stencil_attachment: Some(
wgpu::RenderPassDepthStencilAttachment {
view: depth_view,
Expand Down
4 changes: 2 additions & 2 deletions crates/fj-viewer/src/graphics/pipelines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ impl Pipeline {
fragment: Some(wgpu::FragmentState {
module: shader.module,
entry_point: shader.frag_entry,
targets: &[wgpu::ColorTargetState {
targets: &[Some(wgpu::ColorTargetState {
format: color_format,
blend: Some(
wgpu::BlendState::PREMULTIPLIED_ALPHA_BLENDING,
),
write_mask: wgpu::ColorWrites::ALL,
}],
})],
}),
multiview: None,
});
Expand Down
12 changes: 8 additions & 4 deletions crates/fj-viewer/src/graphics/renderer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{io, mem::size_of};

use egui_winit::winit::event_loop::EventLoop;
use fj_interop::status_report::StatusReport;
use fj_math::{Aabb, Point};
use thiserror::Error;
Expand Down Expand Up @@ -68,6 +69,7 @@ impl Renderer {
/// Returns a new `Renderer`.
pub async fn new(
screen: &impl Screen<Window = egui_winit::winit::window::Window>,
event_loop: &EventLoop<()>,
) -> Result<Self, InitError> {
let instance = wgpu::Instance::new(wgpu::Backends::PRIMARY);

Expand Down Expand Up @@ -121,7 +123,7 @@ impl Renderer {
// Don't ask me how I know.
//

let egui_winit_state = egui_winit::State::new(4096, screen.window());
let egui_winit_state = egui_winit::State::new(event_loop);
let egui_context = egui::Context::default();

// This is sound, as `window` is an object to create a surface upon.
Expand Down Expand Up @@ -163,7 +165,9 @@ impl Renderer {
.await?;

let color_format = surface
.get_preferred_format(&adapter)
.get_supported_formats(&adapter)
.get(0)
.copied()
.expect("Error determining preferred color format");

let Size { width, height } = screen.size();
Expand Down Expand Up @@ -635,14 +639,14 @@ impl Renderer {
) {
encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: None,
color_attachments: &[wgpu::RenderPassColorAttachment {
color_attachments: &[Some(wgpu::RenderPassColorAttachment {
view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::WHITE),
store: true,
},
}],
})],
depth_stencil_attachment: Some(
wgpu::RenderPassDepthStencilAttachment {
view: &self.depth_view,
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-viewer/src/graphics/shaders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub struct Shaders(wgpu::ShaderModule);
impl Shaders {
pub fn new(device: &wgpu::Device) -> Self {
let module =
device.create_shader_module(&wgpu::ShaderModuleDescriptor {
device.create_shader_module(wgpu::ShaderModuleDescriptor {
label: None,
source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!(
"shader.wgsl"
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-window/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ categories = ["encoding", "mathematics", "rendering"]
futures = "0.3.23"
thiserror = "1.0.32"
tracing = "0.1.35"
winit = "0.26.1"
winit = "0.27.2"

[dependencies.fj-host]
version = "0.12.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-window/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub fn run(
let mut focus_point = None;

let mut input_handler = input::Handler::default();
let mut renderer = block_on(Renderer::new(&window))?;
let mut renderer = block_on(Renderer::new(&window, &event_loop))?;

let mut draw_config = DrawConfig::default();

Expand Down