Commit 178f00e2 authored by Jonathan Backer's avatar Jonathan Backer Committed by Commit Bot

Mark SharedImage lost if cannot MakeCurrent

SkiaOutputSurfaceOnGpuImpl::DestroySkImage may not be able
to make the GL context current (e.g. tear down race or driver failure).
In this case, we should not issue any GL calls. Most of these
SkImages have an associated SharedImage. Eventually, all will.
This notifies the SharedImage representation not to glDeleteTextures
when the context is lost.

Bug: 923473
Change-Id: I80f9777aa36278b021febc7b5492a0310deb0639
Reviewed-on: https://chromium-review.googlesource.com/c/1439622
Commit-Queue: Jonathan Backer <backer@chromium.org>
Reviewed-by: default avatarPeng Huang <penghuang@chromium.org>
Auto-Submit: Jonathan Backer <backer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#627982}
parent e6701341
...@@ -164,6 +164,11 @@ class SkiaOutputSurfaceImpl::PromiseTextureHelper { ...@@ -164,6 +164,11 @@ class SkiaOutputSurfaceImpl::PromiseTextureHelper {
static void Done(void* texture_context) { static void Done(void* texture_context) {
DCHECK(texture_context); DCHECK(texture_context);
auto* helper = static_cast<PromiseTextureHelper*>(texture_context); auto* helper = static_cast<PromiseTextureHelper*>(texture_context);
if (helper->shared_image_) {
DCHECK(helper->impl_on_gpu_);
if (helper->impl_on_gpu_->was_context_lost())
helper->shared_image_->OnContextLost();
}
delete helper; delete helper;
} }
......
...@@ -142,6 +142,8 @@ class SkiaOutputSurfaceImplOnGpu : public gpu::ImageTransportSurfaceDelegate { ...@@ -142,6 +142,8 @@ class SkiaOutputSurfaceImplOnGpu : public gpu::ImageTransportSurfaceDelegate {
void DestroySkImages(std::vector<sk_sp<SkImage>>&& images, void DestroySkImages(std::vector<sk_sp<SkImage>>&& images,
uint64_t sync_fence_release); uint64_t sync_fence_release);
bool was_context_lost() { return context_state_->context_lost(); }
private: private:
// gpu::ImageTransportSurfaceDelegate implementation: // gpu::ImageTransportSurfaceDelegate implementation:
#if defined(OS_WIN) #if defined(OS_WIN)
......
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