diff options
author | NNesh <mullruslan@yandex.ru> | 2022-04-07 19:31:45 +0500 |
---|---|---|
committer | NNesh <mullruslan@yandex.ru> | 2022-04-25 22:31:40 +0500 |
commit | 2f33414dab17e17f0c1db86103c2f6ef1e8f1695 (patch) | |
tree | d1dfe773cf4c70717cf598e67345b3e461e5478e /servers/rendering | |
parent | 76ec77d8b42c95fe1771b92f499b894c12ba2a8e (diff) |
Fix clearing backbuffer if there are no items
Diffstat (limited to 'servers/rendering')
-rw-r--r-- | servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp index fce798e3df..29bc767c86 100644 --- a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp @@ -1367,6 +1367,8 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p bool update_skeletons = false; bool time_used = false; + bool backbuffer_cleared = false; + while (ci) { if (ci->copy_back_buffer && canvas_group_owner == nullptr) { backbuffer_copy = true; @@ -1416,11 +1418,12 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p if (ci->canvas_group_owner != nullptr) { if (canvas_group_owner == nullptr) { - //Canvas group begins here, render until before this item + // Canvas group begins here, render until before this item if (update_skeletons) { mesh_storage->update_mesh_instances(); update_skeletons = false; } + _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list); item_count = 0; @@ -1428,8 +1431,9 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p if (ci->canvas_group_owner->canvas_group->mode == RS::CANVAS_GROUP_MODE_OPAQUE) { texture_storage->render_target_copy_to_back_buffer(p_to_render_target, group_rect, false); - } else { - texture_storage->render_target_clear_back_buffer(p_to_render_target, group_rect, Color(0, 0, 0, 0)); + } else if (!backbuffer_cleared) { + texture_storage->render_target_clear_back_buffer(p_to_render_target, Rect2i(), Color(0, 0, 0, 0)); + backbuffer_cleared = true; } backbuffer_copy = false; @@ -1439,6 +1443,11 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p ci->canvas_group_owner = nullptr; //must be cleared } + if (!backbuffer_cleared && canvas_group_owner == nullptr && ci->canvas_group != nullptr && !backbuffer_copy) { + texture_storage->render_target_clear_back_buffer(p_to_render_target, Rect2i(), Color(0, 0, 0, 0)); + backbuffer_cleared = true; + } + if (ci == canvas_group_owner) { if (update_skeletons) { mesh_storage->update_mesh_instances(); @@ -1461,6 +1470,7 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p mesh_storage->update_mesh_instances(); update_skeletons = false; } + _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list); item_count = 0; |