Commit 20a3dc83 authored by Juanmi Huertas's avatar Juanmi Huertas Committed by Commit Bot

Using SharedGpuContext when using a WebGL context for SendNewFrame.

The ReadARGBPixelsAsync expects that the Context being passed in has
a RasterInterface. In the 3D path (WebGL), due to current limitations,
there is a copy of the internal texture being made, encapsulated into
an external canvas resource, and provided with a Context that does not
have a RasterInterface.

This CL adds an special handling for the WebGL offscreenCanvas case,
and it gets the SharedGPUContext to produce the rendering, to avoid
using the one provided from the image.

As this CL is handling a Crash in a corner case in WebGL it has been
proven hard to find a proper test for this. I'm adding a new DCHECK
to make this more robust.

Bug: 1148345
Change-Id: I7aff4bf7182233543533c33c42bfd4a36a7d4a0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2535892Reviewed-by: default avatarYi Xu <yiyix@chromium.org>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Commit-Queue: Juanmi Huertas <juanmihd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827774}
parent aa8bef35
...@@ -697,8 +697,11 @@ void HTMLCanvasElement::NotifyListenersCanvasChanged() { ...@@ -697,8 +697,11 @@ void HTMLCanvasElement::NotifyListenersCanvasChanged() {
return; return;
for (CanvasDrawListener* listener : listeners_) { for (CanvasDrawListener* listener : listeners_) {
if (listener->NeedsNewFrame()) { if (listener->NeedsNewFrame()) {
// Here we need to use the SharedGpuContext as some of the images may
// have been originated with other contextProvider, but we internally
// need a context_provider that has a RasterInterface available.
listener->SendNewFrame(source_image, listener->SendNewFrame(source_image,
source_image->ContextProviderWrapper()); SharedGpuContext::ContextProviderWrapper());
} }
} }
} }
......
...@@ -323,6 +323,7 @@ void CanvasCaptureHandler::ReadARGBPixelsAsync( ...@@ -323,6 +323,7 @@ void CanvasCaptureHandler::ReadARGBPixelsAsync(
IncrementOngoingAsyncPixelReadouts(); IncrementOngoingAsyncPixelReadouts();
gpu::MailboxHolder mailbox_holder = image->GetMailboxHolder(); gpu::MailboxHolder mailbox_holder = image->GetMailboxHolder();
DCHECK(context_provider->RasterInterface());
context_provider->RasterInterface()->WaitSyncTokenCHROMIUM( context_provider->RasterInterface()->WaitSyncTokenCHROMIUM(
mailbox_holder.sync_token.GetConstData()); mailbox_holder.sync_token.GetConstData());
context_provider->RasterInterface()->ReadbackARGBPixelsAsync( context_provider->RasterInterface()->ReadbackARGBPixelsAsync(
......
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