From 6edf455a185180c82f1052dbe11247280efe80ae Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 29 Sep 2023 16:04:49 +0200 Subject: [PATCH] Refactor to prepare for follow-on change --- crates/fj-viewer/src/graphics/device.rs | 4 ++++ crates/fj-viewer/src/graphics/renderer.rs | 6 +----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/fj-viewer/src/graphics/device.rs b/crates/fj-viewer/src/graphics/device.rs index d1438fe52..d7972a351 100644 --- a/crates/fj-viewer/src/graphics/device.rs +++ b/crates/fj-viewer/src/graphics/device.rs @@ -53,6 +53,10 @@ impl Device { /// Render device initialization error #[derive(Debug, thiserror::Error)] pub enum DeviceError { + /// Failed to request adapter + #[error("Failed to request adapter")] + RequestAdapter, + /// Failed to request device #[error("Failed to request device")] RequestDevice(#[from] wgpu::RequestDeviceError), diff --git a/crates/fj-viewer/src/graphics/renderer.rs b/crates/fj-viewer/src/graphics/renderer.rs index a73590191..26fa5884f 100644 --- a/crates/fj-viewer/src/graphics/renderer.rs +++ b/crates/fj-viewer/src/graphics/renderer.rs @@ -57,7 +57,7 @@ impl Renderer { compatible_surface: Some(&surface), }) .await - .ok_or(RendererInitError::RequestAdapter)?; + .ok_or(RendererInitError::Device(DeviceError::RequestAdapter))?; debug!("Using adapter: {:?}", adapter.get_info()); @@ -374,10 +374,6 @@ pub enum RendererInitError { #[error("Error creating surface")] CreateSurface(#[from] wgpu::CreateSurfaceError), - /// Graphics accelerator acquisition error - #[error("Error request adapter")] - RequestAdapter, - /// Device error #[error(transparent)] Device(#[from] DeviceError),