Index: content/common/gpu/media/avda_codec_image.cc |
diff --git a/content/common/gpu/media/avda_codec_image.cc b/content/common/gpu/media/avda_codec_image.cc |
index 062b39b9ef0bafef5ed8ed79a08dcca1a608e3ea..f01f7fd10905f499c3ec38c3b5add0599f51a129 100644 |
--- a/content/common/gpu/media/avda_codec_image.cc |
+++ b/content/common/gpu/media/avda_codec_image.cc |
@@ -5,6 +5,7 @@ |
#include "content/common/gpu/media/avda_codec_image.h" |
#include "content/common/gpu/media/avda_shared_state.h" |
+#include "gpu/command_buffer/service/context_group.h" |
#include "gpu/command_buffer/service/context_state.h" |
#include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
#include "gpu/command_buffer/service/texture_manager.h" |
@@ -50,18 +51,12 @@ unsigned AVDACodecImage::GetInternalFormat() { |
} |
bool AVDACodecImage::BindTexImage(unsigned target) { |
- return true; |
+ return false; |
} |
void AVDACodecImage::ReleaseTexImage(unsigned target) {} |
-bool AVDACodecImage::CopyTexSubImage(unsigned target, |
- const gfx::Point& offset, |
- const gfx::Rect& rect) { |
- return false; |
-} |
- |
-void AVDACodecImage::WillUseTexImage() { |
+bool AVDACodecImage::CopyTexImage(unsigned target) { |
// Have we bound the SurfaceTexture's texture handle to the active |
// texture unit yet? |
bool bound_texture = false; |
@@ -80,24 +75,26 @@ void AVDACodecImage::WillUseTexImage() { |
// to updateTexImage() to the right place in the cc to send it to the shader. |
// For now, we just skip it. crbug.com/530681 |
- // Sneakily bind the ST texture handle in the real GL context. |
- // If we called UpdateTexImage() to update the ST front buffer, then we can |
- // skip this. Since one draw/frame is the common case, we optimize for it. |
- if (!bound_texture) |
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, |
liberato (no reviews please)
2015/10/19 16:11:41
this still needs to be done, but i don't see it in
reveman
2015/10/19 16:28:17
We get this service id from the glGetIntegerv(GL_T
|
- shared_state_->surface_texture_service_id()); |
+ gpu::gles2::TextureManager* texture_manager = |
+ decoder_->GetContextGroup()->texture_manager(); |
+ gpu::gles2::Texture* texture = |
+ texture_manager->GetTextureForServiceId( |
+ shared_state_->surface_texture_service_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, |
+ gpu::gles2::Texture::UNBOUND); |
+ } |
+ |
+ return true; |
} |
-void AVDACodecImage::DidUseTexImage() { |
- // Unbind the ST's service_id in the real GL context in favor of whatever |
- // the decoder thinks is bound there. |
- const gpu::gles2::ContextState* state = decoder_->GetContextState(); |
- const gpu::gles2::TextureUnit& active_unit = |
- state->texture_units[state->active_texture_unit]; |
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, |
liberato (no reviews please)
2015/10/19 16:11:41
i think this still needs to happen as well.
|
- active_unit.bound_texture_external_oes.get() |
- ? active_unit.bound_texture_external_oes->service_id() |
- : 0); |
+bool AVDACodecImage::CopyTexSubImage(unsigned target, |
+ const gfx::Point& offset, |
+ const gfx::Rect& rect) { |
+ return false; |
} |
bool AVDACodecImage::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |