Commit 8927b816 authored by Jonathan Backer's avatar Jonathan Backer Committed by Commit Bot

Force more GL state into a known state

DirectContextProvider shares a GL context with SkiaRenderer. Both of
these have GL state trackers that don't know anything about each other.
ScopedUseContextProvider is responsible for keeping the state trackers
consistent.

These changes were necessary to make my reuse of GLRenderer color
conversion work. I believe that GLRendererCopier has similar
requirements, but that we got lucky with timing and bugs did not
manifest.

Change-Id: I9ac64f51498df0518aeac296ef2bea8fd156d635
Reviewed-on: https://chromium-review.googlesource.com/c/1495196Reviewed-by: default avatarPeng Huang <penghuang@chromium.org>
Commit-Queue: Jonathan Backer <backer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636606}
parent db259923
......@@ -140,10 +140,12 @@ void DirectContextProvider::SetGLRendererCopierRequiredState(
// Get into known state (see
// SkiaOutputSurfaceImplOnGpu::ScopedUseContextProvider).
gles2_implementation_->BindFramebuffer(GL_FRAMEBUFFER, 0);
gles2_implementation_->Disable(GL_SCISSOR_TEST);
gles2_implementation_->Disable(GL_STENCIL_TEST);
gles2_implementation_->Disable(GL_BLEND);
gles2_implementation_->ActiveTexture(GL_TEXTURE0);
decoder_->RestoreActiveTexture();
decoder_->RestoreProgramBindings();
decoder_->RestoreAllAttributes();
decoder_->RestoreGlobalState();
decoder_->RestoreBufferBindings();
if (texture_client_id) {
if (!framebuffer_id_)
......
......@@ -82,10 +82,6 @@ class SkiaOutputSurfaceImplOnGpu::ScopedUseContextProvider {
// side consistent with that.
auto* api = impl_on_gpu_->api_;
api->glBindFramebufferEXTFn(GL_FRAMEBUFFER, 0);
api->glDisableFn(GL_SCISSOR_TEST);
api->glDisableFn(GL_STENCIL_TEST);
api->glDisableFn(GL_BLEND);
api->glActiveTextureFn(GL_TEXTURE0);
impl_on_gpu_->context_provider_->SetGLRendererCopierRequiredState(
texture_client_id);
}
......
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