Fix regression around OpenGL swapchain optimisation for OpenXR

This commit is contained in:
Bastiaan Olij 2024-07-29 10:49:48 +10:00
parent 88d9325065
commit 1eb0039b6e
6 changed files with 8 additions and 8 deletions

View File

@ -107,7 +107,7 @@ void RasterizerGLES3::end_frame(bool p_swap_buffers) {
utils->capture_timestamps_end(); utils->capture_timestamps_end();
} }
void RasterizerGLES3::end_viewport(bool p_swap_buffers) { void RasterizerGLES3::gl_end_frame(bool p_swap_buffers) {
if (p_swap_buffers) { if (p_swap_buffers) {
DisplayServer::get_singleton()->swap_buffers(); DisplayServer::get_singleton()->swap_buffers();
} else { } else {
@ -491,7 +491,7 @@ void RasterizerGLES3::set_boot_image(const Ref<Image> &p_image, const Color &p_c
copy_effects->copy_to_rect(screenrect); copy_effects->copy_to_rect(screenrect);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
end_viewport(true); gl_end_frame(true);
texture_storage->texture_free(texture); texture_storage->texture_free(texture);
} }

View File

@ -99,7 +99,7 @@ public:
void blit_render_targets_to_screen(DisplayServer::WindowID p_screen, const BlitToScreen *p_render_targets, int p_amount); void blit_render_targets_to_screen(DisplayServer::WindowID p_screen, const BlitToScreen *p_render_targets, int p_amount);
void end_viewport(bool p_swap_buffers); void gl_end_frame(bool p_swap_buffers);
void end_frame(bool p_swap_buffers); void end_frame(bool p_swap_buffers);
void finalize(); void finalize();

View File

@ -88,7 +88,7 @@ public:
void blit_render_targets_to_screen(int p_screen, const BlitToScreen *p_render_targets, int p_amount) override {} void blit_render_targets_to_screen(int p_screen, const BlitToScreen *p_render_targets, int p_amount) override {}
void end_viewport(bool p_swap_buffers) override {} void gl_end_frame(bool p_swap_buffers) override {}
void end_frame(bool p_swap_buffers) override { void end_frame(bool p_swap_buffers) override {
if (p_swap_buffers) { if (p_swap_buffers) {

View File

@ -98,7 +98,7 @@ public:
virtual void blit_render_targets_to_screen(DisplayServer::WindowID p_screen, const BlitToScreen *p_render_targets, int p_amount) = 0; virtual void blit_render_targets_to_screen(DisplayServer::WindowID p_screen, const BlitToScreen *p_render_targets, int p_amount) = 0;
virtual void end_viewport(bool p_swap_buffers) = 0; virtual void gl_end_frame(bool p_swap_buffers) = 0;
virtual void end_frame(bool p_swap_buffers) = 0; virtual void end_frame(bool p_swap_buffers) = 0;
virtual void finalize() = 0; virtual void finalize() = 0;
virtual uint64_t get_frame_number() const = 0; virtual uint64_t get_frame_number() const = 0;

View File

@ -122,7 +122,7 @@ public:
void begin_frame(double frame_step); void begin_frame(double frame_step);
void blit_render_targets_to_screen(DisplayServer::WindowID p_screen, const BlitToScreen *p_render_targets, int p_amount); void blit_render_targets_to_screen(DisplayServer::WindowID p_screen, const BlitToScreen *p_render_targets, int p_amount);
void end_viewport(bool p_swap_buffers) {} void gl_end_frame(bool p_swap_buffers) {}
void end_frame(bool p_swap_buffers); void end_frame(bool p_swap_buffers);
void finalize(); void finalize();

View File

@ -786,6 +786,7 @@ void RendererViewport::draw_viewports(bool p_swap_buffers) {
if (OS::get_singleton()->get_current_rendering_driver_name().begins_with("opengl3")) { if (OS::get_singleton()->get_current_rendering_driver_name().begins_with("opengl3")) {
if (blits.size() > 0) { if (blits.size() > 0) {
RSG::rasterizer->blit_render_targets_to_screen(vp->viewport_to_screen, blits.ptr(), blits.size()); RSG::rasterizer->blit_render_targets_to_screen(vp->viewport_to_screen, blits.ptr(), blits.size());
RSG::rasterizer->gl_end_frame(p_swap_buffers);
} }
} else if (blits.size() > 0) { } else if (blits.size() > 0) {
if (!blit_to_screen_list.has(vp->viewport_to_screen)) { if (!blit_to_screen_list.has(vp->viewport_to_screen)) {
@ -796,7 +797,6 @@ void RendererViewport::draw_viewports(bool p_swap_buffers) {
blit_to_screen_list[vp->viewport_to_screen].push_back(blits[b]); blit_to_screen_list[vp->viewport_to_screen].push_back(blits[b]);
} }
} }
RSG::rasterizer->end_viewport(p_swap_buffers && blits.size() > 0);
} }
} }
} else } else
@ -826,10 +826,10 @@ void RendererViewport::draw_viewports(bool p_swap_buffers) {
Vector<BlitToScreen> blit_to_screen_vec; Vector<BlitToScreen> blit_to_screen_vec;
blit_to_screen_vec.push_back(blit); blit_to_screen_vec.push_back(blit);
RSG::rasterizer->blit_render_targets_to_screen(vp->viewport_to_screen, blit_to_screen_vec.ptr(), 1); RSG::rasterizer->blit_render_targets_to_screen(vp->viewport_to_screen, blit_to_screen_vec.ptr(), 1);
RSG::rasterizer->gl_end_frame(p_swap_buffers);
} else { } else {
blit_to_screen_list[vp->viewport_to_screen].push_back(blit); blit_to_screen_list[vp->viewport_to_screen].push_back(blit);
} }
RSG::rasterizer->end_viewport(p_swap_buffers);
} }
} }