Skip to content

Commit

Permalink
Add fix: disable scissor test before blit
Browse files Browse the repository at this point in the history
  • Loading branch information
loic-sharma committed Jan 16, 2024
1 parent d337378 commit 7c8da79
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion impeller/renderer/backend/gles/blit_command_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static std::optional<GLuint> ConfigureFBO(
}

if (gl.CheckFramebufferStatus(fbo_type) != GL_FRAMEBUFFER_COMPLETE) {
VALIDATION_LOG << "Could not create a complete frambuffer.";
VALIDATION_LOG << "Could not create a complete framebuffer.";
DeleteFBO(gl, fbo, fbo_type);
return std::nullopt;
}
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/linux/fl_backing_store_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ uint32_t fl_backing_store_provider_get_gl_format(FlBackingStoreProvider* self) {
// In Linux kN32_SkColorType is assumed to be kBGRA_8888_SkColorType.
// So we must choose a valid gl format to be compatible with surface format
// BGRA8.
// Following logics are copied from Skia GrGLCaps.cpp:
// Following logic is copied from Skia GrGLCaps.cpp:
// https://github.com/google/skia/blob/4738ed711e03212aceec3cd502a4adb545f38e63/src/gpu/ganesh/gl/GrGLCaps.cpp#L1963-L2116

if (epoxy_is_desktop_gl()) {
Expand Down
9 changes: 9 additions & 0 deletions shell/platform/windows/compositor_opengl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ bool CompositorOpenGL::Present(const FlutterLayer** layers,
}

auto source_id = layers[0]->backing_store->open_gl.framebuffer.name;

// Disable the scissor test as it can affect blit operations.
// Prevents regressions like: https://github.com/flutter/flutter/issues/140828
// See OpenGL specification version 4.6, section 18.3.1.
gl_->Disable(GL_SCISSOR_TEST);

gl_->BindFramebuffer(GL_READ_FRAMEBUFFER, source_id);
gl_->BindFramebuffer(GL_DRAW_FRAMEBUFFER, kWindowFrameBufferId);

Expand All @@ -148,6 +154,9 @@ bool CompositorOpenGL::Present(const FlutterLayer** layers,
GL_NEAREST // filter
);

gl_->BindFramebuffer(GL_READ_FRAMEBUFFER, 0);
gl_->BindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);

return engine_->view()->SwapBuffers();
}

Expand Down

0 comments on commit 7c8da79

Please sign in to comment.