Early-exit bloom node if intensity == 0.0 (#12113)

# Objective

- The bloom effect is currently somewhat costly (in terms of GPU time
used), due to using fragment shaders for down- and upscaling (compute
shaders generally perform better for such tasks).
- Additionally, one might have a `BloomSettings` on a camera whose
`intensity` is only occasionally set to a non-zero value (eg. in outside
areas or areas with bright lighting). Currently, the cost of the bloom
shader is always incurred as long as the `BloomSettings` exists.

## Solution

- Bail out of the bloom render node when `intensity == 0.0`, making the
effect free as long as it is turned all the way down.
This commit is contained in:
Sludge 2024-02-25 23:34:05 +01:00 committed by GitHub
parent bb00d9fc3c
commit e5994a4e55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -129,6 +129,10 @@ impl ViewNode for BloomNode {
): QueryItem<Self::ViewQuery>,
world: &World,
) -> Result<(), NodeRunError> {
if bloom_settings.intensity == 0.0 {
return Ok(());
}
let downsampling_pipeline_res = world.resource::<BloomDownsamplingPipeline>();
let pipeline_cache = world.resource::<PipelineCache>();
let uniforms = world.resource::<ComponentUniforms<BloomUniforms>>();