-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Mouse click frame drop on Bevy 0.14.0 #14303
Comments
Works fine for me (Manjaro, X11, Nvidia gpu). Are you using X or Wayland? |
I'm using X. |
I have the same issue (Ubuntu 24.04 LTS, AMD Ryzen 5 PRO 4650G, NVIDIA GeForce RTX 3060 Ti, X11) for left, middle and right mouse buttons. Other mouse buttons work fine. When using wayland this issue doesn't seem to be present. |
That seems fairly huge for our X11 support 👀 |
The game also drops to 10 fps when I do almost any action while the game window is selected, even things not involving the mouse, e.g. change keyboard language (using keyboard shortcut), pressing windows key, opening a terminal through a keyboard shortcut, etc. |
Works fine for me both in X11 and Wayland (Fedora 40, AMD GPU). |
I'm seeing the same on X11 + Nvidia GPU (driver 555.58.02) + Kernel 6.6.39-1-lts As a workaround, I found that bevy_framepace both solves this particular issue + reduces overall input latency, might be worth for others to look into if you hit the same issue. Without Screencast.from.2024-07-17.18-45-24.webmWith Screencast.from.2024-07-17.18-46-31.webmExample codeuse bevy::{
dev_tools::fps_overlay::{FpsOverlayConfig, FpsOverlayPlugin},
prelude::*,
};
use bevy_mod_picking::prelude::*;
use std::f32::consts::TAU;
fn main() {
App::new()
.add_plugins((
DefaultPlugins,
FpsOverlayPlugin::default(),
bevy_framepace::FramepacePlugin,
DefaultPickingPlugins,
))
.insert_resource(DebugPickingMode::Noisy)
.add_systems(Startup, setup)
.add_systems(Update, rotate_cuboid)
.run();
}
#[derive(Component)]
struct RotateMe;
fn setup(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
) {
commands.spawn(Camera3dBundle {
transform: Transform::from_xyz(0.0, 10.0, 20.0).looking_at(Vec3::ZERO, Vec3::Y),
..default()
});
commands.spawn(DirectionalLightBundle {
directional_light: DirectionalLight {
illuminance: 100.0,
..default()
},
transform: Transform::from_xyz(3.0, 3.0, 3.0).looking_at(Vec3::ZERO, Vec3::Y),
..default()
});
commands.spawn((
PbrBundle {
mesh: meshes.add(Cuboid::default()),
material: materials.add(Color::srgba(1.0, 0.0, 0.0, 1.0)),
transform: Transform::from_translation(Vec3::ZERO).with_scale(Vec3::splat(5.0)),
..default()
},
RotateMe,
));
}
fn rotate_cuboid(mut query: Query<&mut Transform, With<RotateMe>>, time: Res<Time>) {
for mut t in query.iter_mut() {
t.rotate_y(0.3 * TAU * time.delta_seconds());
}
} |
Update: it seems like all cases of this are using Nvidia + X11. Using Wayland always fixes the issue. So far AMD users have not run into this, but as @SpecificProtagonist notes, not all Nvidia + X11 users run into it either, so we might need more testing in this regard. |
Ah sorry, I've just noticed that it used my igpu, not my Nvidia dgpu. Will try with the later later. |
I didn't include this in the issue description, but I'm also using Nvidia GPU. So I also fall in the bucket of users using X11 + Nvidia GPU combo and experiencing this issue. |
I've been having a similar problem in my own project and been trying to figure it out and just stumbled on this issue. I don't get an FPS drop when clicking, but about every second the frame time spikes. Frame times stabilise when the window is unfocused. But start spiking again when mousing over the window, which sounds similar to #14216. I get this problem on your example project @JonasAAA and most bevy 0.14 projects I've tested. I tried bevy_framepace as suggested by @victorb on my project and it seems to fix it. |
@honehone12 been doing more digging trying to find where the issue is coming from here: honehone12/bevy_replicon_bootstrap#47 |
So, I bisected between two versions from the previous mentioned issue, landed on gfx-rs/wgpu@e5c62fb being the commit who introduced the issue in wgpu. Parent commit (gfx-rs/wgpu@886dc94) don't suffer from the same issue. Was introduced in this PR: gfx-rs/wgpu#4967 I don't think I posses enough skill to actually attempt to solve this issue however. |
@victorb good detective work! Could you open an issue on wgpu informing them? I'll set this to blocked in the meantime :) |
@victorb nice work !! thank you !! |
Bevy version
Relevant system information
Rust version: 1.79.0
OS: Ubuntu 24.04
CPU: AMD Ryzen 5 2600 Six-Core Processor
RAM: 15.5 GiB
What's performing poorly?
When I left or right click the mouse in a very basic Bevy 0.14.0 project, the FPS drops to 10, even in release mode. With Bevy 0.13.2 the FPS drops to 30 when I click the mouse, so still problematic, but not nearly as disruptive.
Small example which reproduces the issue is at https://github.com/JonasAAA/Bevy-Lag. The Bevy 0.13 version of the same code is at https://github.com/JonasAAA/Bevy-Lag/tree/bevy_0.13. Run
cargo run --release
and click the mouse to reproduce the issue.Additional information
This issue seems very similar to #14216.
The text was updated successfully, but these errors were encountered: