-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Background changes color when all entities are despawned #5426
Comments
I reproduced on the M1 mac with chrome and bisected to #4898 Here's the results of testing with the browsers I have access to. These are all on the same machine.
|
I think it would be more accurate to say that the ClearColor is wrong, not that it disappears. When testing with a very red color, for instance, I see a much darker red color rather than black. |
This seems to affect official bevy examples as well (they are shown with a much darker ClearColor than normal). I also noticed some interesting behavior when switching tabs where the ClearColor will flicker between the normal color and the darker color for a bit. tabswitch.mp4 |
I don't see that behavior. I always see white after the bug is triggered. |
What version of chrome are you using? I have been testing with |
Interesting that it works fine for your Firefox, but not for mine. Is the only difference the OS, or do you have a different version of Firefox as well? |
I am using Firefox 102.0.1 (64-bit) on Windows 10, as stated in the issue. |
So this seems specific to ANGLE. |
I am also seeing the wrong |
Windows 10, 10.0.19044 Build 19044 Bug 🐛Firefox 102.0.1 (64-bit) No Bug ✔️Chrome 103.0.5060.134 (Official Build) (64-bit) Microsoft Edge 103.0.1264.62 (Official build) (64-bit) |
Here the issue seems to be that on Firefox the AdapterInfo is wrong, since I have a GeForce GTX 1080, no other GPUs installed. |
It looks like in your videos you get flickering. I don't get flickering at all. |
I was also able to reproduce your exact experience on my windows machine (gtx 1660). Updated my comment above. But I don't see the same issues with the wgpu examples. It would probably be helpful if we can find a way to reproduce this reliably in bare wgpu without bevy. |
An easy way to reproduce this now is to click to spawn the first batch of birds in the online bevymark example: https://bevyengine.org/examples/stress-tests/bevymark/ edit: that repro doesn't work for me on windows, but the original repro code in this issue still does. |
I have a very simple repro of this bug. See here (potential flashing lights warning): https://jabuwu.github.io/bevy_wasm_bug/wasm/index.html The color becomes a noticeably darker clear color than the usual default clear color, and flashes when there are dropped frames. I can simulate this easily by opening devtools or resizing the window.
The problem is only on certain platforms (M1 MacOS + Chrome being one of them) and occurs with a non-white clear color and a single entity spawned. An easy workaround is to use a white clear color or cover the clear color with a sprite/skybox/etc. I bisected the issue back to f487407 |
I'm pretty convinced that there are two separate issues being described in this ticket. See my update here: gfx-rs/wgpu#2909 (comment) |
I am honestly concerned that this will trigger a seizure for someone during bevy jam 2. Anyone experiencing this can work around it by patching in mockersf's wgpu fork: [patch.crates-io]
wgpu = { git = "https://github.com/mockersf/wgpu/", branch = "unconditional-clear-workaround" } |
With Chrome 107 and Firefox 105 now stable, I am no longer seeing this on my m1 mac. (Also I think an update to macOS 12.6 happened in the meantime) Would appreciate if someone on Windows could check this out again. |
I still see this on Windows with Firefox 106.0.2 (64-bit). Using |
@ViliamVadocz are you still able to reproduce this? I am no longer able to reproduce on the machines I have access to. (testing official deployed web examples for bevy/wgpu as well as the original repro on bevy's main branch).
If you are able to reproduce, could you check that the latest Here's an updated version of the original repro for bevy 0.14/current main: Expand//! Issue 5426
use bevy::{prelude::*, sprite::MaterialMesh2dBundle};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup_system)
.add_systems(Update, bug_system)
.run();
}
fn setup_system(mut commands: Commands) {
commands.spawn(Camera2dBundle::default());
}
#[derive(Component)]
struct Thing;
fn bug_system(
input: Res<ButtonInput<KeyCode>>,
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<ColorMaterial>>,
query: Query<Entity, With<Thing>>,
) {
// Press space to spawn a circle.
if input.just_pressed(KeyCode::Space) {
commands
.spawn(MaterialMesh2dBundle {
mesh: meshes.add(Circle::new(50.)).into(),
material: materials.add(ColorMaterial::from(Color::WHITE)),
..default()
})
.insert(Thing);
}
// Press backspace to remove one of the entities.
if input.just_pressed(KeyCode::Backspace) {
if let Some(entity) = query.into_iter().next() {
commands.entity(entity).despawn();
}
}
} |
Bevy version
Commit hash: 619c30c
Relevant system information
Windows 10, Firefox 102.0.1 (64-bit)
What you did
Snippet to reproduce:
Compile for web and run it. (You can use
wasm-server-runner
).Then press space and backspace. That will spawn and despawn an entity. When there are no entities the background becomes a different color. When you spawn an entity again the background reappears.
What went wrong
The background should not change color when there are no entities. I expected it to stay the same color.
Additional information
The mesh seems important. When I spawn a rectangle with
SpriteBundle
and remove it, the background does not disappear.The bug does not happen on Microsoft Edge.
Reportedly does happen on M1 Mac, Chrome.
The text was updated successfully, but these errors were encountered: