mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 03:18:37 +08:00
Fix drawing of viewports without swapping buffers
This commit is contained in:
parent
a2f90d565a
commit
77d8372285
@ -103,8 +103,9 @@ void RendererCompositorRD::begin_frame(double frame_step) {
|
||||
}
|
||||
|
||||
void RendererCompositorRD::end_frame(bool p_swap_buffers) {
|
||||
// TODO: Likely pass a bool to swap buffers to avoid display?
|
||||
RD::get_singleton()->swap_buffers();
|
||||
if (p_swap_buffers) {
|
||||
RD::get_singleton()->swap_buffers();
|
||||
}
|
||||
}
|
||||
|
||||
void RendererCompositorRD::initialize() {
|
||||
|
@ -616,7 +616,7 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
|
||||
}
|
||||
}
|
||||
|
||||
void RendererViewport::draw_viewports() {
|
||||
void RendererViewport::draw_viewports(bool p_swap_buffers) {
|
||||
timestamp_vp_map.clear();
|
||||
|
||||
// get our xr interface in case we need it
|
||||
@ -799,11 +799,14 @@ void RendererViewport::draw_viewports() {
|
||||
total_draw_calls_used = draw_calls_used;
|
||||
|
||||
RENDER_TIMESTAMP("< Render Viewports");
|
||||
//this needs to be called to make screen swapping more efficient
|
||||
RSG::rasterizer->prepare_for_blitting_render_targets();
|
||||
|
||||
for (const KeyValue<int, Vector<BlitToScreen>> &E : blit_to_screen_list) {
|
||||
RSG::rasterizer->blit_render_targets_to_screen(E.key, E.value.ptr(), E.value.size());
|
||||
if (p_swap_buffers) {
|
||||
//this needs to be called to make screen swapping more efficient
|
||||
RSG::rasterizer->prepare_for_blitting_render_targets();
|
||||
|
||||
for (const KeyValue<int, Vector<BlitToScreen>> &E : blit_to_screen_list) {
|
||||
RSG::rasterizer->blit_render_targets_to_screen(E.key, E.value.ptr(), E.value.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ public:
|
||||
void handle_timestamp(String p_timestamp, uint64_t p_cpu_time, uint64_t p_gpu_time);
|
||||
|
||||
void set_default_clear_color(const Color &p_color);
|
||||
void draw_viewports();
|
||||
void draw_viewports(bool p_swap_buffers);
|
||||
|
||||
bool free(RID p_rid);
|
||||
|
||||
|
@ -88,7 +88,7 @@ void RenderingServerDefault::_draw(bool p_swap_buffers, double frame_step) {
|
||||
|
||||
RSG::scene->render_probes();
|
||||
|
||||
RSG::viewport->draw_viewports();
|
||||
RSG::viewport->draw_viewports(p_swap_buffers);
|
||||
RSG::canvas_render->update();
|
||||
|
||||
if (OS::get_singleton()->get_current_rendering_driver_name() != "opengl3" && OS::get_singleton()->get_current_rendering_driver_name() != "opengl3_angle") {
|
||||
|
Loading…
Reference in New Issue
Block a user