From a546d94d22d82d6b871e6c59719320bcbb0e3889 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 7 Sep 2023 17:22:00 +0200 Subject: [PATCH 1/4] Express no power preference when choosing adapter Power preference shouldn't influence whether an adapter is returned or not, but this still seems safer. --- crates/fj-viewer/src/graphics/renderer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-viewer/src/graphics/renderer.rs b/crates/fj-viewer/src/graphics/renderer.rs index fada903f8..a2e3bf208 100644 --- a/crates/fj-viewer/src/graphics/renderer.rs +++ b/crates/fj-viewer/src/graphics/renderer.rs @@ -50,7 +50,7 @@ impl Renderer { let adapter = instance .request_adapter(&wgpu::RequestAdapterOptions { - power_preference: wgpu::PowerPreference::HighPerformance, + power_preference: wgpu::PowerPreference::None, force_fallback_adapter: false, compatible_surface: Some(&surface), }) From 97c093a5742c8c782e4240e423d25a5f66633891 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 7 Sep 2023 17:45:47 +0200 Subject: [PATCH 2/4] Add log message in `Renderer::new` --- crates/fj-viewer/src/graphics/renderer.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/fj-viewer/src/graphics/renderer.rs b/crates/fj-viewer/src/graphics/renderer.rs index a2e3bf208..b8c7930e5 100644 --- a/crates/fj-viewer/src/graphics/renderer.rs +++ b/crates/fj-viewer/src/graphics/renderer.rs @@ -57,6 +57,8 @@ impl Renderer { .await .ok_or(RendererInitError::RequestAdapter)?; + debug!("Using adapter: {:?}", adapter.get_info()); + let features = { let desired_features = wgpu::Features::POLYGON_MODE_LINE; let available_features = adapter.features(); From 36a23f4a492e74f245b78b98ae58d59491af51bf Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 7 Sep 2023 17:47:01 +0200 Subject: [PATCH 3/4] Downgrade noisy log output --- crates/fj-viewer/src/graphics/renderer.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-viewer/src/graphics/renderer.rs b/crates/fj-viewer/src/graphics/renderer.rs index b8c7930e5..e77362b4e 100644 --- a/crates/fj-viewer/src/graphics/renderer.rs +++ b/crates/fj-viewer/src/graphics/renderer.rs @@ -1,7 +1,7 @@ use std::{io, mem::size_of, vec}; use thiserror::Error; -use tracing::debug; +use tracing::{debug, trace}; use wgpu::util::DeviceExt as _; use crate::{ @@ -327,10 +327,10 @@ impl Renderer { let command_buffer = encoder.finish(); self.queue.submit(Some(command_buffer)); - debug!("Presenting..."); + trace!("Presenting..."); surface_texture.present(); - debug!("Finished drawing."); + trace!("Finished drawing."); Ok(()) } From 7728514a1ce409bd48c07b9e9d04c8a7a5b463e0 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 7 Sep 2023 17:53:42 +0200 Subject: [PATCH 4/4] Accept all backends The primary backends might not be available everywhere, and I hope there's no problem with supporting the secondary ones. --- crates/fj-viewer/src/graphics/renderer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-viewer/src/graphics/renderer.rs b/crates/fj-viewer/src/graphics/renderer.rs index e77362b4e..02b68257e 100644 --- a/crates/fj-viewer/src/graphics/renderer.rs +++ b/crates/fj-viewer/src/graphics/renderer.rs @@ -41,7 +41,7 @@ impl Renderer { /// Returns a new `Renderer`. pub async fn new(screen: &impl Screen) -> Result { let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { - backends: wgpu::Backends::PRIMARY, + backends: wgpu::Backends::all(), ..Default::default() });