Merge pull request #90233 from Arthas92t/master

Fix OpenGL `_shadow_atlas_find_shadow` error when light instance is freed
This commit is contained in:
Rémi Verschelde 2024-04-05 12:16:48 +02:00
commit 6a64e5a797
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -1064,7 +1064,11 @@ bool LightStorage::_shadow_atlas_find_shadow(ShadowAtlas *shadow_atlas, int *p_i
for (int j = 0; j < sc; j++) {
LightInstance *sli = light_instance_owner.get_or_null(sarr[j].owner);
ERR_CONTINUE(!sli);
if (!sli) {
// Found a released light instance.
found_used_idx = j;
break;
}
if (sli->last_scene_pass != RasterizerSceneGLES3::get_singleton()->get_scene_pass()) {
// Was just allocated, don't kill it so soon, wait a bit.