Skip to content

Commit

Permalink
Fix missing MakeCurrent in {Ensure,Discard}BackBuffer
Browse files Browse the repository at this point in the history
{Ensure,Discard}BackBuffer uses skia to allocate memory for
SkiaOutputDeviceOffscreen and forwards it to GLSurface for
SkiaOutputDeviceGL. This requires context to be current.

Change-Id: Ia9b94dbf1b1c46b2ec1375a1d2aeceffabf1e9fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3107466
Reviewed-by: Peng Huang <penghuang@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#913497}
  • Loading branch information
vasilyt authored and Chromium LUCI CQ committed Aug 19, 2021
1 parent 83050bf commit 692e573
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1910,4 +1910,19 @@ void SkiaOutputSurfaceImplOnGpu::InitDelegatedInkPointRendererReceiver(
}
}

void SkiaOutputSurfaceImplOnGpu::EnsureBackbuffer() {
// We call GLSurface::SetBackbuffferAllocation in Ensure/Discard backbuffer,
// so technically need framebuffer. In reality no GLSurface implements it, but
// until it's removed we should keep true here.
MakeCurrent(/*need_framebuffer=*/true);
output_device_->EnsureBackbuffer();
}
void SkiaOutputSurfaceImplOnGpu::DiscardBackbuffer() {
// We call GLSurface::SetBackbuffferAllocation in Ensure/Discard backbuffer,
// so technically need framebuffer. In reality no GLSurface implements it, but
// until it's removed we should keep true here.
MakeCurrent(/*need_framebuffer=*/true);
output_device_->DiscardBackbuffer();
}

} // namespace viz
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ class SkiaOutputSurfaceImplOnGpu
// Runs |deferred_framebuffer_draw_closure| when SwapBuffers() or CopyOutput()
// will not.
void SwapBuffersSkipped();
void EnsureBackbuffer() { output_device_->EnsureBackbuffer(); }
void DiscardBackbuffer() { output_device_->DiscardBackbuffer(); }
void EnsureBackbuffer();
void DiscardBackbuffer();
void FinishPaintRenderPass(const gpu::Mailbox& mailbox,
sk_sp<SkDeferredDisplayList> ddl,
std::vector<ImageContextImpl*> image_contexts,
Expand Down

0 comments on commit 692e573

Please sign in to comment.