EEVEE-Next: Bypass shadow update pipeline if shadow is disabled

This avoid a lot of overhead but also allows smaller GPU
captures & replay.
This commit is contained in:
Clément Foucault 2024-01-04 10:58:43 +13:00
parent 0da2ebf644
commit 0cda1f4c0d
1 changed files with 9 additions and 1 deletions

View File

@ -941,7 +941,10 @@ void ShadowModule::end_sync()
/* Allocate new tile-maps and fill shadow data of the lights. */
tilemap_pool.tilemaps_data.clear();
for (Light &light : inst_.lights.light_map_.values()) {
if (light.directional != nullptr) {
if (enabled_ == false) {
light.tilemap_index = LIGHT_NO_SHADOW;
}
else if (light.directional != nullptr) {
light.directional->end_sync(light, inst_.camera, lod_bias_);
}
else if (light.punctual != nullptr) {
@ -1265,6 +1268,11 @@ float ShadowModule::tilemap_pixel_radius()
void ShadowModule::set_view(View &view, GPUTexture *depth_tx)
{
if (enabled_ == false) {
/* All lights have been tagged to have no shadow. */
return;
}
GPUFrameBuffer *prev_fb = GPU_framebuffer_active_get();
src_depth_tx_ = depth_tx;