Skip to content

Commit

Permalink
Enable Msaa for webgl by default (bevyengine#3489)
Browse files Browse the repository at this point in the history
# Objective

- `Msaa` was disabled in webgl due to a bug in wgpu
- Bug has been fixed (gfx-rs/wgpu#2307) and backported (gfx-rs/wgpu#2327), and updates for [`wgpu-core`](https://crates.io/crates/wgpu-core/0.12.1) and [`wgpu-hal`](https://crates.io/crates/wgpu-hal/0.12.1) have been released

## Solution

- Remove custom config for `Msaa` in webgl
- I also changed two options that were using the arch instead of the `webgl` feature. it shouldn't change much for webgl, but could help if someone wants to target wasm but not webgl2


Co-authored-by: François <[email protected]>
  • Loading branch information
mockersf and mockersf committed Jan 1, 2022
1 parent 1f0e116 commit 5b3c2b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 2 additions & 2 deletions crates/bevy_render/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ pub struct WgpuOptions {

impl Default for WgpuOptions {
fn default() -> Self {
let default_backends = if cfg!(target_arch = "wasm32") {
let default_backends = if cfg!(feature = "webgl") {
Backends::GL
} else {
Backends::PRIMARY
};

let backends = wgpu::util::backend_bits_from_env().unwrap_or(default_backends);

let limits = if cfg!(target_arch = "wasm32") {
let limits = if cfg!(feature = "webgl") {
wgpu::Limits::downlevel_webgl2_defaults()
} else {
#[allow(unused_mut)]
Expand Down
7 changes: 1 addition & 6 deletions crates/bevy_render/src/view/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@ pub struct Msaa {

impl Default for Msaa {
fn default() -> Self {
Self {
#[cfg(feature = "webgl")]
samples: 1,
#[cfg(not(feature = "webgl"))]
samples: 4,
}
Self { samples: 4 }
}
}

Expand Down

0 comments on commit 5b3c2b2

Please sign in to comment.