bevy/crates/bevy_render/src
Nicola Papale ffa489a846 Ignore Timeout errors on Linux AMD & Intel (#5957)
# Objective

- Fix #3606
- Fix #4579
- Fix #3380

## Solution

When running on a Linux machine with some AMD or Intel device, when calling
`surface.get_current_texture()`, ignore `wgpu::SurfaceError::Timeout` errors.


## Alternative

An alternative solution found in the `wgpu` examples is:

```rust
let frame = surface
    .get_current_texture()
    .or_else(|_| {
        render_device.configure_surface(surface, &swap_chain_descriptor);
        surface.get_current_texture()
    })
    .expect("Error reconfiguring surface");
window.swap_chain_texture = Some(TextureView::from(frame));
```

See: <94ce76391b/wgpu/examples/framework.rs (L362-L370)>

Veloren [handles the Timeout error the way this PR proposes to handle it](https://github.com/gfx-rs/wgpu/issues/1218#issuecomment-1092056971).

The reason I went with this PR's solution is that `configure_surface` seems to be quite an expensive operation, and it would run every frame with the wgpu framework solution, despite the fact it works perfectly fine without `configure_surface`.

I know this looks super hacky with the linux-specific line and the AMD check, but my understanding is that the `Timeout` occurrence is specific to a quirk of some AMD drivers on linux, and if otherwise met should be considered a bug.


Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2022-11-12 08:06:56 +00:00
..
camera Reuse ndc_to_world matrix in Camera::viewport_to_world (#6532) 2022-11-10 16:55:53 +00:00
color Correctly use as_hsla_f32 in Add<Color> and AddAssign<Color>, fixes #5543 (#5546) 2022-08-17 14:00:10 +00:00
mesh Allow passing glam vector types as vertex attributes (#6442) 2022-11-04 03:45:17 +00:00
primitives Very minor doc formatting changes (#5287) 2022-07-12 13:06:16 +00:00
render_graph fix nightly clippy warnings (#6395) 2022-10-28 21:03:01 +00:00
render_phase Fix clippy::iter_with_drain (#6485) 2022-11-06 01:42:15 +00:00
render_resource Fix panic when using globals uniform in wasm builds (#6460) 2022-11-07 19:44:14 +00:00
renderer fix nightly clippy warnings (#6395) 2022-10-28 21:03:01 +00:00
texture Use new let-else syntax where possible (#6463) 2022-11-04 21:32:09 +00:00
view Ignore Timeout errors on Linux AMD & Intel (#5957) 2022-11-12 08:06:56 +00:00
extract_component.rs Replace WorldQueryGats trait with actual gats (#6319) 2022-11-03 16:33:05 +00:00
extract_param.rs Exclusive Systems Now Implement System. Flexible Exclusive System Params (#6083) 2022-09-26 23:57:07 +00:00
extract_resource.rs Prepare for upcoming rustlang by fixing upcoming clippy warnings (#6376) 2022-10-26 19:15:15 +00:00
globals.rs Fix panic when using globals uniform in wasm builds (#6460) 2022-11-07 19:44:14 +00:00
lib.rs Revert "Show prelude re-exports in docs (#6448)" (#6449) 2022-11-02 20:40:45 +00:00
rangefinder.rs Very minor doc formatting changes (#5287) 2022-07-12 13:06:16 +00:00
render_asset.rs Fix clippy::iter_with_drain (#6485) 2022-11-06 01:42:15 +00:00
settings.rs Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00
spatial_bundle.rs Add associated constant IDENTITY to Transform and friends. (#5340) 2022-08-30 22:10:24 +00:00