-
-
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
Resizing 2D camera's viewport drops FPS and crashes (with HDR and bloom enabled) #16182
Comments
I have added branches to the linked repo which test bevy versions 0.15.0-dev and 0.15.0-rc.2 as well. I have found the bug happens on all of them. I have edited the OP to reflect this. Please re-triage. |
Thanks for the deep dive |
I have found the likely source of the bug. In bloom/mod.rs: fn prepare_bloom_textures(
<snip>
views: Query<(Entity, &ExtractedCamera, &Bloom)>,
) {
for (entity, camera, bloom) in &views {
if let Some(UVec2 {
x: width,
y: height,
}) = camera.physical_viewport_size
{
// How many times we can halve the resolution minus one so we don't go unnecessarily low
let mip_count = bloom.max_mip_dimension.ilog2().max(2) - 1;
let mip_height_ratio = if height != 0 {
bloom.max_mip_dimension as f32 / height as f32
} else {
0.
};
let texture_descriptor = TextureDescriptor {
label: Some("bloom_texture"),
size: Extent3d {
width: ((width as f32 * mip_height_ratio).round() as u32).max(1),
height: ((height as f32 * mip_height_ratio).round() as u32).max(1),
depth_or_array_layers: 1,
},
mip_level_count: mip_count,
<snip>
};
<snip>
}
}
} A new texture is created and cached for each different viewport size (caching is not seen in the code snippet, happens elsewhere). This leads to the FPS drops. In fact, the bloom looks unusably bad for any viewports with small heights, even with the default setting for The crash occurs, because |
Bevy version
0.14.2, 0.15.0-dev (rev #4656698), 0.15.0-rc.2
All of them are affected.
Relevant system information
AdapterInfo { name: "NVIDIA GeForce GTX 1080", vendor: 4318, device: 7040, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "560.35.03", backend: Vulkan }
What you did
Added a system which animates the viewport's size on a 2D camera which has HDR enabled and a Bloom component with intensity > 0 (BloomSettings component instead for 0.14.2).
What went wrong
Additional information
Click here for a minimal repo that demonstrates the bug. There is also additional info and steps to reproduce in the README.
EDIT: Added details to "What went wrong" section.
EDIT2: Tested bevy versions 0.15.0-dev and 0.15.0-rc.2, too. Bug occurs there, too. Linked repo has branches for each bevy version for reproduction.
The text was updated successfully, but these errors were encountered: