mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-22 15:15:52 +00:00
Merge pull request #1587 from hannobraun/update
Upgrade to latest wgpu, winit, egui
This commit is contained in:
commit
f835ba0cf5
764
Cargo.lock
generated
764
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -21,4 +21,4 @@ libloading = "0.7.4"
|
|||||||
notify = "5.1.0"
|
notify = "5.1.0"
|
||||||
thiserror = "1.0.35"
|
thiserror = "1.0.35"
|
||||||
tracing = "0.1.37"
|
tracing = "0.1.37"
|
||||||
winit = "0.27.5"
|
winit = "0.28.1"
|
||||||
|
@ -14,8 +14,8 @@ categories.workspace = true
|
|||||||
bytemuck = "1.13.0"
|
bytemuck = "1.13.0"
|
||||||
chrono = "0.4.23"
|
chrono = "0.4.23"
|
||||||
crossbeam-channel = "0.5.6"
|
crossbeam-channel = "0.5.6"
|
||||||
egui = "0.20.1"
|
egui = "0.21.0"
|
||||||
egui-wgpu = "0.20.0"
|
egui-wgpu = "0.21.0"
|
||||||
fj-interop.workspace = true
|
fj-interop.workspace = true
|
||||||
fj-math.workspace = true
|
fj-math.workspace = true
|
||||||
nalgebra = "0.32.1"
|
nalgebra = "0.32.1"
|
||||||
@ -23,7 +23,6 @@ tobj = "3.2.4"
|
|||||||
raw-window-handle = "0.5.0"
|
raw-window-handle = "0.5.0"
|
||||||
thiserror = "1.0.35"
|
thiserror = "1.0.35"
|
||||||
tracing = "0.1.37"
|
tracing = "0.1.37"
|
||||||
wgpu_glyph = "0.18.0"
|
|
||||||
|
|
||||||
[dependencies.image]
|
[dependencies.image]
|
||||||
version = "0.24"
|
version = "0.24"
|
||||||
@ -36,7 +35,7 @@ default_features = false
|
|||||||
features = ["xdg-portal"]
|
features = ["xdg-portal"]
|
||||||
|
|
||||||
[dependencies.wgpu]
|
[dependencies.wgpu]
|
||||||
version = "0.14.2"
|
version = "0.15.1"
|
||||||
features = ["webgl"]
|
features = ["webgl"]
|
||||||
|
|
||||||
# We don't depend on `getrandom` directly, but we need this to enable the `js`
|
# We don't depend on `getrandom` directly, but we need this to enable the `js`
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
use std::{io, mem::size_of};
|
use std::{io, mem::size_of, vec};
|
||||||
|
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
use wgpu::util::DeviceExt as _;
|
use wgpu::util::DeviceExt as _;
|
||||||
use wgpu_glyph::ab_glyph::InvalidFont;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
camera::Camera,
|
camera::Camera,
|
||||||
@ -42,10 +41,13 @@ pub struct Renderer {
|
|||||||
impl Renderer {
|
impl Renderer {
|
||||||
/// Returns a new `Renderer`.
|
/// Returns a new `Renderer`.
|
||||||
pub async fn new(screen: &impl Screen) -> Result<Self, RendererInitError> {
|
pub async fn new(screen: &impl Screen) -> Result<Self, RendererInitError> {
|
||||||
let instance = wgpu::Instance::new(wgpu::Backends::PRIMARY);
|
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
|
||||||
|
backends: wgpu::Backends::PRIMARY,
|
||||||
|
..Default::default()
|
||||||
|
});
|
||||||
|
|
||||||
// This is sound, as `window` is an object to create a surface upon.
|
// This is sound, as `window` is an object to create a surface upon.
|
||||||
let surface = unsafe { instance.create_surface(screen.window()) };
|
let surface = unsafe { instance.create_surface(screen.window()) }?;
|
||||||
|
|
||||||
let adapter = instance
|
let adapter = instance
|
||||||
.request_adapter(&wgpu::RequestAdapterOptions {
|
.request_adapter(&wgpu::RequestAdapterOptions {
|
||||||
@ -95,7 +97,8 @@ impl Renderer {
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let color_format = 'color_format: {
|
let color_format = 'color_format: {
|
||||||
let supported_formats = surface.get_supported_formats(&adapter);
|
let capabilities = surface.get_capabilities(&adapter);
|
||||||
|
let supported_formats = capabilities.formats;
|
||||||
|
|
||||||
// We don't really care which color format we use, as long as we
|
// We don't really care which color format we use, as long as we
|
||||||
// find one that's supported. `egui_wgpu` prints a warning though,
|
// find one that's supported. `egui_wgpu` prints a warning though,
|
||||||
@ -137,6 +140,7 @@ impl Renderer {
|
|||||||
//
|
//
|
||||||
// @hannobraun
|
// @hannobraun
|
||||||
alpha_mode: wgpu::CompositeAlphaMode::Auto,
|
alpha_mode: wgpu::CompositeAlphaMode::Auto,
|
||||||
|
view_formats: vec![],
|
||||||
};
|
};
|
||||||
surface.configure(&device, &surface_config);
|
surface.configure(&device, &surface_config);
|
||||||
|
|
||||||
@ -373,6 +377,7 @@ impl Renderer {
|
|||||||
dimension: wgpu::TextureDimension::D2,
|
dimension: wgpu::TextureDimension::D2,
|
||||||
format: surface_config.format,
|
format: surface_config.format,
|
||||||
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
|
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
|
||||||
|
view_formats: &[],
|
||||||
});
|
});
|
||||||
texture.create_view(&wgpu::TextureViewDescriptor::default())
|
texture.create_view(&wgpu::TextureViewDescriptor::default())
|
||||||
}
|
}
|
||||||
@ -393,6 +398,7 @@ impl Renderer {
|
|||||||
dimension: wgpu::TextureDimension::D2,
|
dimension: wgpu::TextureDimension::D2,
|
||||||
format: DEPTH_FORMAT,
|
format: DEPTH_FORMAT,
|
||||||
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
|
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
|
||||||
|
view_formats: &[],
|
||||||
});
|
});
|
||||||
|
|
||||||
texture.create_view(&wgpu::TextureViewDescriptor::default())
|
texture.create_view(&wgpu::TextureViewDescriptor::default())
|
||||||
@ -411,6 +417,10 @@ pub enum RendererInitError {
|
|||||||
#[error("I/O error: {0}")]
|
#[error("I/O error: {0}")]
|
||||||
Io(#[from] io::Error),
|
Io(#[from] io::Error),
|
||||||
|
|
||||||
|
/// Surface creating error
|
||||||
|
#[error("Error creating surface: {0}")]
|
||||||
|
CreateSurface(#[from] wgpu::CreateSurfaceError),
|
||||||
|
|
||||||
/// Graphics accelerator acquisition error
|
/// Graphics accelerator acquisition error
|
||||||
#[error("Error request adapter")]
|
#[error("Error request adapter")]
|
||||||
RequestAdapter,
|
RequestAdapter,
|
||||||
@ -420,12 +430,6 @@ pub enum RendererInitError {
|
|||||||
/// See: [wgpu::RequestDeviceError](https://docs.rs/wgpu/latest/wgpu/struct.RequestDeviceError.html)
|
/// See: [wgpu::RequestDeviceError](https://docs.rs/wgpu/latest/wgpu/struct.RequestDeviceError.html)
|
||||||
#[error("Error requesting device: {0}")]
|
#[error("Error requesting device: {0}")]
|
||||||
RequestDevice(#[from] wgpu::RequestDeviceError),
|
RequestDevice(#[from] wgpu::RequestDeviceError),
|
||||||
|
|
||||||
/// Error loading font
|
|
||||||
///
|
|
||||||
/// See: [ab_glyph::InvalidFont](https://docs.rs/ab_glyph/latest/ab_glyph/struct.InvalidFont.html)
|
|
||||||
#[error("Error loading font: {0}")]
|
|
||||||
InvalidFont(#[from] InvalidFont),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Graphics rendering error
|
/// Graphics rendering error
|
||||||
|
@ -33,7 +33,7 @@ fn vertex(in: VertexInput) -> VertexOutput {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
let pi: f32 = 3.14159265359;
|
const pi: f32 = 3.14159265359;
|
||||||
|
|
||||||
@fragment
|
@fragment
|
||||||
fn frag_model(in: VertexOutput) -> FragmentOutput {
|
fn frag_model(in: VertexOutput) -> FragmentOutput {
|
||||||
|
@ -48,6 +48,7 @@ impl Texture {
|
|||||||
format: wgpu::TextureFormat::Rgba8UnormSrgb,
|
format: wgpu::TextureFormat::Rgba8UnormSrgb,
|
||||||
usage: wgpu::TextureUsages::TEXTURE_BINDING
|
usage: wgpu::TextureUsages::TEXTURE_BINDING
|
||||||
| wgpu::TextureUsages::COPY_DST,
|
| wgpu::TextureUsages::COPY_DST,
|
||||||
|
view_formats: &[],
|
||||||
});
|
});
|
||||||
|
|
||||||
queue.write_texture(
|
queue.write_texture(
|
||||||
|
@ -181,7 +181,7 @@ impl Gui {
|
|||||||
&& self.options.show_debug_text_example
|
&& self.options.show_debug_text_example
|
||||||
{
|
{
|
||||||
let hover_pos =
|
let hover_pos =
|
||||||
ui.input().pointer.hover_pos().unwrap_or_default();
|
ui.input(|input| input.pointer.hover_pos().unwrap_or_default());
|
||||||
ui.painter().debug_text(
|
ui.painter().debug_text(
|
||||||
hover_pos,
|
hover_pos,
|
||||||
egui::Align2::LEFT_TOP,
|
egui::Align2::LEFT_TOP,
|
||||||
|
@ -19,8 +19,8 @@ crossbeam-channel = "0.5.6"
|
|||||||
futures = "0.3.26"
|
futures = "0.3.26"
|
||||||
thiserror = "1.0.35"
|
thiserror = "1.0.35"
|
||||||
tracing = "0.1.37"
|
tracing = "0.1.37"
|
||||||
winit = "0.27.5"
|
winit = "0.28.1"
|
||||||
|
|
||||||
[dependencies.egui-winit]
|
[dependencies.egui-winit]
|
||||||
version = "0.20.1"
|
version = "0.21.1"
|
||||||
default-features = false
|
default-features = false
|
||||||
|
Loading…
Reference in New Issue
Block a user