Commit 477cec47 authored by Vasiliy Telezhnikov's avatar Vasiliy Telezhnikov Committed by Commit Bot

aw: Fix clearing FBO in External Stencil with viz

This CL restores GL state to correct values before clearing FBO to
ensure glClear happens. It also fixes problem in destruction when
GLContext got destroyed before AwGLSurfaceExternalStencil.

Bug: 1056655

Change-Id: I70102fae19d25ae9d2795ddf37e0c393dc2e18f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2075971Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745100}
parent ef290da1
......@@ -116,6 +116,8 @@ class AwGLSurfaceExternalStencil::FrameBuffer {
void Clear() {
glBindFramebufferEXT(GL_FRAMEBUFFER, frame_buffer_object_);
glDisable(GL_SCISSOR_TEST);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
}
......@@ -219,6 +221,9 @@ gfx::SwapResult AwGLSurfaceExternalStencil::SwapBuffers(
// We draw only inside clip rect, no need to scissor.
glDisable(GL_SCISSOR_TEST);
// Restore color mask in case.
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
......
......@@ -56,7 +56,12 @@ OutputSurfaceProviderWebview::OutputSurfaceProviderWebview() {
InitializeContext();
}
OutputSurfaceProviderWebview::~OutputSurfaceProviderWebview() = default;
OutputSurfaceProviderWebview::~OutputSurfaceProviderWebview() {
// We must to destroy |gl_surface_| before |shared_context_state_|, so we will
// still have context. NOTE: |shared_context_state_| holds ref to surface, but
// it loses it before context.
gl_surface_.reset();
}
void OutputSurfaceProviderWebview::InitializeContext() {
DCHECK(!gl_surface_) << "InitializeContext() called twice";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment