Commit d74d0f90 authored by Jonathan Backer's avatar Jonathan Backer Committed by Commit Bot

SkiaRenderer: Fix GLRendererCopier for SurfaceControl

Two fixes:

(a) Change how we create SkSurface so that we can get a texture ID
    from it.

(b) Map the AHB for readback with ScopedSurfaceToTexture.

Change-Id: I16f692b5f1ae8ada0d592944fe74902484f56975
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2062918
Commit-Queue: Jonathan Backer <backer@chromium.org>
Reviewed-by: default avatarVasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742732}
parent dc43c533
......@@ -1238,7 +1238,8 @@ void SkiaOutputSurfaceImplOnGpu::CopyOutput(
}
base::Optional<ScopedSurfaceToTexture> texture_mapper;
if (!from_fbo0 || dependency_->IsOffscreen()) {
if (!from_fbo0 || dependency_->IsOffscreen() ||
gl_surface_->IsSurfaceless()) {
texture_mapper.emplace(context_provider_.get(), surface);
gl_id = texture_mapper.value().client_id();
internal_format = GL_RGBA;
......
......@@ -95,7 +95,10 @@ sk_sp<SkSurface> SharedImageRepresentationSkiaGL::BeginWriteAccess(
SkColorType sk_color_type = viz::ResourceFormatToClosestSkColorType(
/*gpu_compositing=*/true, format());
auto surface = SkSurface::MakeFromBackendTextureAsRenderTarget(
// TODO(https://crbug.com/1054033): Switch back to
// MakeFromBackendTextureAsRenderTarget once we no longer use GLRendererCopier
// with surfaceless surfaces.
auto surface = SkSurface::MakeFromBackendTexture(
context_state_->gr_context(), promise_texture_->backendTexture(),
kTopLeft_GrSurfaceOrigin, final_msaa_count, sk_color_type,
backing()->color_space().ToSkColorSpace(), &surface_props);
......@@ -135,7 +138,6 @@ void SharedImageRepresentationSkiaGL::EndReadAccess() {
gl_representation_->EndAccess();
mode_ = RepresentationAccessMode::kNone;
surface_ = nullptr;
}
void SharedImageRepresentationSkiaGL::CheckContext() {
......
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