mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-04 18:08:26 +00:00
Simplify function parameter
This commit is contained in:
parent
770724ac44
commit
6fc4675011
@ -1,13 +1,10 @@
|
||||
use std::{io, mem::size_of, vec};
|
||||
use std::{io, mem::size_of, sync::Arc, vec};
|
||||
|
||||
use thiserror::Error;
|
||||
use tracing::{error, trace};
|
||||
use wgpu::util::DeviceExt as _;
|
||||
|
||||
use crate::{
|
||||
camera::Camera,
|
||||
window::{Window, WindowSize},
|
||||
};
|
||||
use crate::{camera::Camera, window::WindowSize};
|
||||
|
||||
use super::{
|
||||
DEPTH_FORMAT, DeviceError, SAMPLE_COUNT, device::Device,
|
||||
@ -37,14 +34,16 @@ pub struct Renderer {
|
||||
|
||||
impl Renderer {
|
||||
/// Returns a new `Renderer`.
|
||||
pub async fn new(window: &Window) -> Result<Self, RendererInitError> {
|
||||
let window_size = window.inner.inner_size();
|
||||
pub async fn new(
|
||||
window: Arc<winit::window::Window>,
|
||||
) -> Result<Self, RendererInitError> {
|
||||
let window_size = window.inner_size();
|
||||
|
||||
let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {
|
||||
backends: wgpu::Backends::all(),
|
||||
..Default::default()
|
||||
});
|
||||
let surface = instance.create_surface(window.inner.clone())?;
|
||||
let surface = instance.create_surface(window)?;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
for adapter in instance.enumerate_adapters(wgpu::Backends::all()) {
|
||||
|
@ -44,7 +44,7 @@ impl ViewerWindow {
|
||||
)?,
|
||||
),
|
||||
};
|
||||
let renderer = Renderer::new(&window).await?;
|
||||
let renderer = Renderer::new(window.inner.clone()).await?;
|
||||
|
||||
Ok(Self {
|
||||
new_screen_size: None,
|
||||
|
Loading…
Reference in New Issue
Block a user