Skip to content

Commit bfdd018

Browse files
authored
Fix webgl2 feature gating affecting webgpu in transmission example (#18115)
# Objective Fixes #18095 ## Solution Update the feature gates so that `Taa`, etc are added if - Not on wasm - OR using webgpu ## Testing Check that `Taa` is disabled with appropriate messaging on webgl2 ``` cargo run -p build-wasm-example -- --api webgl2 transmission && basic-http-server examples/wasm/ ``` Check that `Taa` works on webgpu in chrome ``` cargo run -p build-wasm-example -- --api webgpu transmission && basic-http-server examples/wasm/ ``` Check that `Taa` still works in a native build ``` cargo run -example transmission ```
1 parent 3be01c4 commit bfdd018

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

examples/3d/transmission.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use bevy::{
3535
},
3636
};
3737

38-
#[cfg(not(all(feature = "webgl2", target_arch = "wasm32")))]
38+
#[cfg(any(feature = "webgpu", not(target_arch = "wasm32")))]
3939
use bevy::core_pipeline::experimental::taa::{TemporalAntiAliasPlugin, TemporalAntiAliasing};
4040
use rand::random;
4141

@@ -55,7 +55,7 @@ fn main() {
5555
// *Note:* TAA is not _required_ for specular transmission, but
5656
// it _greatly enhances_ the look of the resulting blur effects.
5757
// Sadly, it's not available under WebGL.
58-
#[cfg(not(all(feature = "webgl2", target_arch = "wasm32")))]
58+
#[cfg(any(feature = "webgpu", not(target_arch = "wasm32")))]
5959
app.add_plugins(TemporalAntiAliasPlugin);
6060

6161
app.run();
@@ -317,9 +317,9 @@ fn setup(
317317
},
318318
Tonemapping::TonyMcMapface,
319319
Exposure { ev100: 6.0 },
320-
#[cfg(not(all(feature = "webgl2", target_arch = "wasm32")))]
320+
#[cfg(any(feature = "webgpu", not(target_arch = "wasm32")))]
321321
Msaa::Off,
322-
#[cfg(not(all(feature = "webgl2", target_arch = "wasm32")))]
322+
#[cfg(any(feature = "webgpu", not(target_arch = "wasm32")))]
323323
TemporalAntiAliasing::default(),
324324
EnvironmentMapLight {
325325
intensity: 25.0,
@@ -471,7 +471,7 @@ fn example_control_system(
471471
camera.hdr = !camera.hdr;
472472
}
473473

474-
#[cfg(not(all(feature = "webgl2", target_arch = "wasm32")))]
474+
#[cfg(any(feature = "webgpu", not(target_arch = "wasm32")))]
475475
if input.just_pressed(KeyCode::KeyD) {
476476
if depth_prepass.is_none() {
477477
commands.entity(camera_entity).insert(DepthPrepass);
@@ -480,7 +480,7 @@ fn example_control_system(
480480
}
481481
}
482482

483-
#[cfg(not(all(feature = "webgl2", target_arch = "wasm32")))]
483+
#[cfg(any(feature = "webgpu", not(target_arch = "wasm32")))]
484484
if input.just_pressed(KeyCode::KeyT) {
485485
if temporal_jitter.is_none() {
486486
commands
@@ -572,7 +572,7 @@ fn example_control_system(
572572
state.perceptual_roughness,
573573
state.reflectance,
574574
if camera.hdr { "ON " } else { "OFF" },
575-
if cfg!(any(not(feature = "webgl2"), not(target_arch = "wasm32"))) {
575+
if cfg!(any(feature = "webgpu", not(target_arch = "wasm32"))) {
576576
if depth_prepass.is_some() {
577577
"ON "
578578
} else {
@@ -581,7 +581,7 @@ fn example_control_system(
581581
} else {
582582
"N/A (WebGL)"
583583
},
584-
if cfg!(any(not(feature = "webgl2"), not(target_arch = "wasm32"))) {
584+
if cfg!(any(feature = "webgpu", not(target_arch = "wasm32"))) {
585585
if temporal_jitter.is_some() {
586586
if depth_prepass.is_some() {
587587
"ON "

0 commit comments

Comments
 (0)