Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1065)

Unified Diff: content/common/gpu/stream_texture_android.cc

Issue 1401423003: Re-land: ui: Move GLImage::BindTexImage fallback from GLImage implementations to GLES2CmdDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove NOTREACHED() from GLImageSync::CopyTexImage Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/gpu/stream_texture_android.h ('k') | gpu/command_buffer/service/framebuffer_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/stream_texture_android.cc
diff --git a/content/common/gpu/stream_texture_android.cc b/content/common/gpu/stream_texture_android.cc
index 20f1da7e53884ed4cba5b4018ad46e05e94f3825..3dabc090eb01351639afb557beacefe0de77d61b 100644
--- a/content/common/gpu/stream_texture_android.cc
+++ b/content/common/gpu/stream_texture_android.cc
@@ -45,8 +45,9 @@ bool StreamTexture::Create(
texture_manager->SetLevelInfo(texture, GL_TEXTURE_EXTERNAL_OES, 0, GL_RGBA,
size.width(), size.height(), 1, 0, GL_RGBA,
GL_UNSIGNED_BYTE, gfx::Rect(size));
- texture_manager->SetLevelImage(
- texture, GL_TEXTURE_EXTERNAL_OES, 0, gl_image.get());
+ texture_manager->SetLevelImage(texture, GL_TEXTURE_EXTERNAL_OES, 0,
+ gl_image.get(),
+ gpu::gles2::Texture::UNBOUND);
return true;
}
@@ -63,6 +64,7 @@ StreamTexture::StreamTexture(GpuCommandBufferStub* owner_stub,
owner_stub_(owner_stub),
route_id_(route_id),
has_listener_(false),
+ texture_id_(texture_id),
weak_factory_(this) {
owner_stub->AddDestructionObserver(this);
memset(current_matrix_, 0, sizeof(current_matrix_));
@@ -92,9 +94,11 @@ void StreamTexture::Destroy(bool have_context) {
NOTREACHED();
}
-void StreamTexture::WillUseTexImage() {
+bool StreamTexture::CopyTexImage(unsigned target) {
+ DCHECK_EQ(target, static_cast<unsigned>(GL_TEXTURE_EXTERNAL_OES));
+
if (!owner_stub_ || !surface_texture_.get())
- return;
+ return true;
if (has_pending_frame_) {
scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current;
@@ -128,6 +132,18 @@ void StreamTexture::WillUseTexImage() {
? active_unit.bound_texture_external_oes->service_id()
: 0);
}
+
+ TextureManager* texture_manager =
+ owner_stub_->decoder()->GetContextGroup()->texture_manager();
+ gpu::gles2::Texture* texture =
+ texture_manager->GetTextureForServiceId(texture_id_);
+ if (texture) {
+ // By setting image state to UNBOUND instead of COPIED we ensure that
+ // CopyTexImage() is called each time the surface texture is used for
+ // drawing.
+ texture->SetLevelImage(GL_TEXTURE_EXTERNAL_OES, 0, this,
reveman 2015/10/22 15:28:30 This needs to happen even if a pending frame was n
+ gpu::gles2::Texture::UNBOUND);
+ }
}
if (has_listener_ && has_valid_frame_) {
@@ -144,6 +160,8 @@ void StreamTexture::WillUseTexImage() {
new GpuStreamTextureMsg_MatrixChanged(route_id_, params));
}
}
+
+ return true;
}
void StreamTexture::OnFrameAvailable() {
« no previous file with comments | « content/common/gpu/stream_texture_android.h ('k') | gpu/command_buffer/service/framebuffer_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698