Commit 6b595786 authored by Vikas Soni's avatar Vikas Soni Committed by Commit Bot

Implement ProduceGLTexture() method for a backing.

Implement ProduceGLTexture() method for
SharedImageBackingScopedHardwareBufferFenceSync.

Bug: 1091945
Change-Id: Ic251e2e82b293bc2394782baf72533703bfefdc4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363972
Auto-Submit: vikas soni <vikassoni@chromium.org>
Commit-Queue: Khushal <khushalsagar@chromium.org>
Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799926}
parent 4a93f81f
......@@ -223,10 +223,7 @@ std::unique_ptr<SharedImageRepresentationGLTexture>
SharedImageBackingScopedHardwareBufferFenceSync::ProduceGLTexture(
SharedImageManager* manager,
MemoryTypeTracker* tracker) {
// This backing do not support GL Texture representation directly. It only
// supports GL representation via Skia.
NOTREACHED();
return nullptr;
return GenGLTextureRepresentation(manager, tracker);
}
std::unique_ptr<SharedImageRepresentationGLTexturePassthrough>
......@@ -264,18 +261,26 @@ SharedImageBackingScopedHardwareBufferFenceSync::ProduceSkia(
DCHECK(context_state->GrContextIsGL());
auto gl_representation = GenGLTextureRepresentation(manager, tracker);
if (!gl_representation)
return nullptr;
return SharedImageRepresentationSkiaGL::Create(std::move(gl_representation),
std::move(context_state),
manager, this, tracker);
}
std::unique_ptr<SharedImageRepresentationGLTextureScopedHardwareBufferFenceSync>
SharedImageBackingScopedHardwareBufferFenceSync::GenGLTextureRepresentation(
SharedImageManager* manager,
MemoryTypeTracker* tracker) {
auto* texture =
GenGLTexture(scoped_hardware_buffer_->buffer(), GL_TEXTURE_EXTERNAL_OES,
color_space(), size(), estimated_size(), ClearedRect());
if (!texture)
return nullptr;
auto gl_representation = std::make_unique<
return std::make_unique<
SharedImageRepresentationGLTextureScopedHardwareBufferFenceSync>(
manager, this, tracker, texture);
return SharedImageRepresentationSkiaGL::Create(std::move(gl_representation),
std::move(context_state),
manager, this, tracker);
}
} // namespace gpu
......@@ -19,6 +19,7 @@ class ScopedHardwareBufferFenceSync;
namespace gpu {
class SharedImageRepresentationGLTexture;
class SharedImageRepresentationGLTextureScopedHardwareBufferFenceSync;
class SharedImageRepresentationSkia;
struct Mailbox;
......@@ -67,6 +68,10 @@ class GPU_GLES2_EXPORT SharedImageBackingScopedHardwareBufferFenceSync
friend class SharedImageRepresentationGLTextureScopedHardwareBufferFenceSync;
friend class SharedImageRepresentationSkiaVkScopedHardwareBufferFenceSync;
std::unique_ptr<
SharedImageRepresentationGLTextureScopedHardwareBufferFenceSync>
GenGLTextureRepresentation(SharedImageManager* manager,
MemoryTypeTracker* tracker);
bool BeginGLReadAccess();
void EndGLReadAccess();
void EndSkiaReadAccess();
......
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