Optimize PointLight2D shadow rendering by reducing draw calls and RD state changes.

This dramatically reduces the CPU time spent on rendering shadows for PointLight2Ds
This commit is contained in:
clayjohn 2024-12-11 23:32:19 -08:00
parent 38775731e8
commit 7c61252dd7
8 changed files with 224 additions and 82 deletions

View file

@ -498,7 +498,7 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
while (light) {
RENDER_TIMESTAMP("Render PointLight2D Shadow");
RSG::canvas_render->light_update_shadow(light->light_internal, shadow_count++, light->xform_cache.affine_inverse(), light->item_shadow_mask, light->radius_cache / 1000.0, light->radius_cache * 1.1, occluders);
RSG::canvas_render->light_update_shadow(light->light_internal, shadow_count++, light->xform_cache.affine_inverse(), light->item_shadow_mask, light->radius_cache / 1000.0, light->radius_cache * 1.1, occluders, light->rect_cache);
light = light->shadows_next_ptr;
}