bevy_pbr: Clear fog DynamicUniformBuffer before populating each frame (#7432)

# Objective

- Fix a bug causing performance to drop over time because the GPU fog buffer was endlessly growing

## Solution

- Clear the fog buffer every frame before populating it
This commit is contained in:
Robert Swain 2023-01-30 23:09:38 +00:00
parent 8b7ebe1738
commit cfc56cca2f

View file

@ -53,6 +53,8 @@ pub fn prepare_fog(
mut fog_meta: ResMut<FogMeta>,
views: Query<(Entity, Option<&FogSettings>), With<ExtractedView>>,
) {
fog_meta.gpu_fogs.clear();
for (entity, fog) in &views {
let gpu_fog = if let Some(fog) = fog {
match &fog.falloff {