From 0cda1f4c0d2a6fb00ebd51923457c99cfd718ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Thu, 4 Jan 2024 10:58:43 +1300 Subject: [PATCH] EEVEE-Next: Bypass shadow update pipeline if shadow is disabled This avoid a lot of overhead but also allows smaller GPU captures & replay. --- source/blender/draw/engines/eevee_next/eevee_shadow.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/blender/draw/engines/eevee_next/eevee_shadow.cc b/source/blender/draw/engines/eevee_next/eevee_shadow.cc index 0de1f729d96..1fbcf43f8d8 100644 --- a/source/blender/draw/engines/eevee_next/eevee_shadow.cc +++ b/source/blender/draw/engines/eevee_next/eevee_shadow.cc @@ -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;