Merge pull request #39531 from lawnjelly/kessel_light_join_next

GLES2 Batching - Fix try_join_item logic for lights
This commit is contained in:
Rémi Verschelde 2020-06-14 10:39:27 +02:00 committed by GitHub
commit 6efab27a41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 5 deletions

View File

@ -2426,14 +2426,18 @@ bool RasterizerCanvasGLES2::try_join_item(Item *p_ci, RenderItemState &r_ris, bo
if (!light_allow_join) { if (!light_allow_join) {
// can't join // can't join
join = false; join = false;
// we also dont want to allow joining this item with the next item, because the next item could have no lights!
r_batch_break = true;
} }
} else { } else {
// can't join the next item if it has any lights as it will be by definition affected by different set of lights // if the last item had lights, we should not join it to this one (which has no lights)
r_ris.light_region.light_bitfield = 0; if (r_ris.light_region.light_bitfield || r_ris.light_region.shadow_bitfield) {
r_ris.light_region.shadow_bitfield = 0; join = false;
// setting these to zero ensures that any following item with lights will, by definition,
// be affected by a different set of lights, and thus prevent a join
r_ris.light_region.light_bitfield = 0;
r_ris.light_region.shadow_bitfield = 0;
}
} }
if (reclip) { if (reclip) {