Skip to content

Commit

Permalink
Merge pull request godotengine#94894 from BastiaanOlij/fix_regression…
Browse files Browse the repository at this point in the history
…_84244

Fix regression around OpenGL swapchain optimisation for OpenXR
  • Loading branch information
akien-mga committed Jul 29, 2024
2 parents 6d46399 + 1eb0039 commit 0e9caa2
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions drivers/gles3/rasterizer_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void RasterizerGLES3::end_frame(bool p_swap_buffers) {
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) {
DisplayServer::get_singleton()->swap_buffers();
} else {
Expand Down Expand Up @@ -491,7 +491,7 @@ void RasterizerGLES3::set_boot_image(const Ref<Image> &p_image, const Color &p_c
copy_effects->copy_to_rect(screenrect);
glBindTexture(GL_TEXTURE_2D, 0);

end_viewport(true);
gl_end_frame(true);

texture_storage->texture_free(texture);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/gles3/rasterizer_gles3.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class RasterizerGLES3 : public RendererCompositor {

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 finalize();
Expand Down
2 changes: 1 addition & 1 deletion servers/rendering/dummy/rasterizer_dummy.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class RasterizerDummy : public RendererCompositor {

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 {
if (p_swap_buffers) {
Expand Down
2 changes: 1 addition & 1 deletion servers/rendering/renderer_compositor.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class RendererCompositor {

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 finalize() = 0;
virtual uint64_t get_frame_number() const = 0;
Expand Down
2 changes: 1 addition & 1 deletion servers/rendering/renderer_rd/renderer_compositor_rd.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class RendererCompositorRD : public RendererCompositor {
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 end_viewport(bool p_swap_buffers) {}
void gl_end_frame(bool p_swap_buffers) {}
void end_frame(bool p_swap_buffers);
void finalize();

Expand Down
4 changes: 2 additions & 2 deletions servers/rendering/renderer_viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 (blits.size() > 0) {
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) {
if (!blit_to_screen_list.has(vp->viewport_to_screen)) {
Expand All @@ -796,7 +797,6 @@ void RendererViewport::draw_viewports(bool p_swap_buffers) {
blit_to_screen_list[vp->viewport_to_screen].push_back(blits[b]);
}
}
RSG::rasterizer->end_viewport(p_swap_buffers && blits.size() > 0);
}
}
} else
Expand Down Expand Up @@ -826,10 +826,10 @@ void RendererViewport::draw_viewports(bool p_swap_buffers) {
Vector<BlitToScreen> blit_to_screen_vec;
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->gl_end_frame(p_swap_buffers);
} else {
blit_to_screen_list[vp->viewport_to_screen].push_back(blit);
}
RSG::rasterizer->end_viewport(p_swap_buffers);
}
}

Expand Down

0 comments on commit 0e9caa2

Please sign in to comment.