summaryrefslogtreecommitdiff
path: root/servers/visual/visual_server_viewport.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2019-06-24 16:13:06 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-02-11 11:53:27 +0100
commit1b4281b895f3046ea972256182b18696a25f8316 (patch)
tree5f6b9c1600a4354f17b29e430a447d08f93ecf25 /servers/visual/visual_server_viewport.cpp
parent42b44f43ee52eb664d3610d0fdae0eff14c00f0a (diff)
basic 2D engine is more or less working with Vulkan, including editor.
Still a lot to do
Diffstat (limited to 'servers/visual/visual_server_viewport.cpp')
-rw-r--r--servers/visual/visual_server_viewport.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp
index ca0caefc77..05db6454dc 100644
--- a/servers/visual/visual_server_viewport.cpp
+++ b/servers/visual/visual_server_viewport.cpp
@@ -81,7 +81,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
bool scenario_draw_canvas_bg = false; //draw canvas, or some layer of it, as BG for 3D instead of in front
int scenario_canvas_max_layer = 0;
- bool cleared = false;
+
Color bgcolor = clear_color;
if (!p_viewport->hide_canvas && !p_viewport->disable_environment && VSG::scene->scenario_owner.owns(p_viewport->scenario)) {
@@ -106,9 +106,10 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
}
}
+ VSG::storage->render_target_request_clear(p_viewport->render_target, bgcolor);
+
if (!scenario_draw_canvas_bg && can_draw_3d) {
_draw_3d(p_viewport, p_eye);
- cleared = true; //if 3D has drawn, 2D is cleared.
}
if (!p_viewport->hide_canvas) {
@@ -240,8 +241,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
ptr = ptr->filter_next_ptr;
}
- VSG::canvas->render_canvas(p_viewport->render_target, !cleared, bgcolor, canvas, xform, canvas_lights, lights_with_mask, clip_rect);
- cleared = true;
+ VSG::canvas->render_canvas(p_viewport->render_target, canvas, xform, canvas_lights, lights_with_mask, clip_rect);
i++;
if (scenario_draw_canvas_bg && E->key().get_layer() >= scenario_canvas_max_layer) {
@@ -308,7 +308,7 @@ void VisualServerViewport::draw_viewports() {
if (!visible)
continue;
- VSG::storage->render_target_clear_used_flag(vp->render_target);
+ VSG::storage->render_target_set_as_unused(vp->render_target);
#if 0
if (vp->use_arvr && arvr_interface.is_valid()) {
// override our size, make sure it matches our required size
@@ -381,6 +381,9 @@ void VisualServerViewport::draw_viewports() {
}
VSG::scene_render->set_debug_draw_mode(VS::VIEWPORT_DEBUG_DRAW_DISABLED);
+ //this needs to be called to make screen swapping more efficient
+ VSG::rasterizer->prepare_for_blitting_render_targets();
+
for (Map<int, Vector<Rasterizer::BlitToScreen> >::Element *E = blit_to_screen_list.front(); E; E = E->next()) {
VSG::rasterizer->blit_render_targets_to_screen(E->key(), E->get().ptr(), E->get().size());
}