Skip to content

Commit

Permalink
some added logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf committed Jan 26, 2024
1 parent 5ffd745 commit 0079c42
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/eframe/src/web/web_painter_wgpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ impl WebPainterWgpu {
}
}

log::debug!("Creating wgpu instance with backends {:?}", backends);

let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends,
..Default::default()
Expand All @@ -117,7 +119,9 @@ impl WebPainterWgpu {
RenderState::create(wgpu_options, &instance, &surface, depth_format, 1).await;

if let Err(egui_wgpu::WgpuError::NoSuitableAdapterFound) = &render_state_result {
if backends == wgpu::Backends::BROWSER_WEBGPU | wgpu::Backends::GL {
if backends.contains(wgpu::Backends::BROWSER_WEBGPU)
&& backends.contains(wgpu::Backends::GL)
{
// It can happen that a browser advertises WebGPU support, but then fails to create a
// suitable adapter. As of writing this happens for example on Linux with Chrome 121.
//
Expand All @@ -130,6 +134,8 @@ impl WebPainterWgpu {
// but this is currently not easily possible. See https://github.com/gfx-rs/wgpu/issues/5142
// In that case we'd be trying the same thing again which isn't ideal, but we're in a
// pretty bad situation anyway.
log::info!("Failed to create adapter, trying to use WebGL explicitly instead.");

let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::GL,
..Default::default()
Expand Down

0 comments on commit 0079c42

Please sign in to comment.