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> ...@@ -223,10 +223,7 @@ std::unique_ptr<SharedImageRepresentationGLTexture>
SharedImageBackingScopedHardwareBufferFenceSync::ProduceGLTexture( SharedImageBackingScopedHardwareBufferFenceSync::ProduceGLTexture(
SharedImageManager* manager, SharedImageManager* manager,
MemoryTypeTracker* tracker) { MemoryTypeTracker* tracker) {
// This backing do not support GL Texture representation directly. It only return GenGLTextureRepresentation(manager, tracker);
// supports GL representation via Skia.
NOTREACHED();
return nullptr;
} }
std::unique_ptr<SharedImageRepresentationGLTexturePassthrough> std::unique_ptr<SharedImageRepresentationGLTexturePassthrough>
...@@ -264,18 +261,26 @@ SharedImageBackingScopedHardwareBufferFenceSync::ProduceSkia( ...@@ -264,18 +261,26 @@ SharedImageBackingScopedHardwareBufferFenceSync::ProduceSkia(
DCHECK(context_state->GrContextIsGL()); 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 = auto* texture =
GenGLTexture(scoped_hardware_buffer_->buffer(), GL_TEXTURE_EXTERNAL_OES, GenGLTexture(scoped_hardware_buffer_->buffer(), GL_TEXTURE_EXTERNAL_OES,
color_space(), size(), estimated_size(), ClearedRect()); color_space(), size(), estimated_size(), ClearedRect());
if (!texture) if (!texture)
return nullptr; return nullptr;
auto gl_representation = std::make_unique< return std::make_unique<
SharedImageRepresentationGLTextureScopedHardwareBufferFenceSync>( SharedImageRepresentationGLTextureScopedHardwareBufferFenceSync>(
manager, this, tracker, texture); manager, this, tracker, texture);
return SharedImageRepresentationSkiaGL::Create(std::move(gl_representation),
std::move(context_state),
manager, this, tracker);
} }
} // namespace gpu } // namespace gpu
...@@ -19,6 +19,7 @@ class ScopedHardwareBufferFenceSync; ...@@ -19,6 +19,7 @@ class ScopedHardwareBufferFenceSync;
namespace gpu { namespace gpu {
class SharedImageRepresentationGLTexture; class SharedImageRepresentationGLTexture;
class SharedImageRepresentationGLTextureScopedHardwareBufferFenceSync;
class SharedImageRepresentationSkia; class SharedImageRepresentationSkia;
struct Mailbox; struct Mailbox;
...@@ -67,6 +68,10 @@ class GPU_GLES2_EXPORT SharedImageBackingScopedHardwareBufferFenceSync ...@@ -67,6 +68,10 @@ class GPU_GLES2_EXPORT SharedImageBackingScopedHardwareBufferFenceSync
friend class SharedImageRepresentationGLTextureScopedHardwareBufferFenceSync; friend class SharedImageRepresentationGLTextureScopedHardwareBufferFenceSync;
friend class SharedImageRepresentationSkiaVkScopedHardwareBufferFenceSync; friend class SharedImageRepresentationSkiaVkScopedHardwareBufferFenceSync;
std::unique_ptr<
SharedImageRepresentationGLTextureScopedHardwareBufferFenceSync>
GenGLTextureRepresentation(SharedImageManager* manager,
MemoryTypeTracker* tracker);
bool BeginGLReadAccess(); bool BeginGLReadAccess();
void EndGLReadAccess(); void EndGLReadAccess();
void EndSkiaReadAccess(); 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