| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/renderers/video_overlay_factory.h" | 5 #include "media/renderers/video_overlay_factory.h" |
| 6 | 6 |
| 7 #include "gpu/GLES2/gl2extchromium.h" | 7 #include "gpu/GLES2/gl2extchromium.h" |
| 8 #include "gpu/command_buffer/client/gles2_interface.h" | 8 #include "gpu/command_buffer/client/gles2_interface.h" |
| 9 #include "gpu/command_buffer/common/mailbox.h" | 9 #include "gpu/command_buffer/common/mailbox.h" |
| 10 #include "gpu/command_buffer/common/sync_token.h" | 10 #include "gpu/command_buffer/common/sync_token.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 std::unique_ptr<GpuVideoAcceleratorFactories::ScopedGLContextLock> lock( | 23 std::unique_ptr<GpuVideoAcceleratorFactories::ScopedGLContextLock> lock( |
| 24 gpu_factories_->GetGLContextLock()); | 24 gpu_factories_->GetGLContextLock()); |
| 25 if (lock) { | 25 if (lock) { |
| 26 gpu::gles2::GLES2Interface* gl = lock->ContextGL(); | 26 gpu::gles2::GLES2Interface* gl = lock->ContextGL(); |
| 27 image_id_ = gl->CreateGpuMemoryBufferImageCHROMIUM( | 27 image_id_ = gl->CreateGpuMemoryBufferImageCHROMIUM( |
| 28 1, 1, GL_RGBA, GL_READ_WRITE_CHROMIUM); | 28 1, 1, GL_RGBA, GL_READ_WRITE_CHROMIUM); |
| 29 if (image_id_) { | 29 if (image_id_) { |
| 30 gl->GenTextures(1, &texture_id_); | 30 gl->GenTextures(1, &texture_id_); |
| 31 gl->BindTexture(GL_TEXTURE_2D, texture_id_); | 31 gl->BindTexture(GL_TEXTURE_2D, texture_id_); |
| 32 gl->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id_); | 32 gl->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id_, 0); |
| 33 | 33 |
| 34 gl->GenMailboxCHROMIUM(mailbox_.name); | 34 gl->GenMailboxCHROMIUM(mailbox_.name); |
| 35 gl->ProduceTextureDirectCHROMIUM(texture_id_, GL_TEXTURE_2D, | 35 gl->ProduceTextureDirectCHROMIUM(texture_id_, GL_TEXTURE_2D, |
| 36 mailbox_.name); | 36 mailbox_.name); |
| 37 | 37 |
| 38 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); | 38 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); |
| 39 gl->ShallowFlushCHROMIUM(); | 39 gl->ShallowFlushCHROMIUM(); |
| 40 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token_.GetData()); | 40 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token_.GetData()); |
| 41 } | 41 } |
| 42 } | 42 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 return nullptr; | 111 return nullptr; |
| 112 | 112 |
| 113 // Lazily create overlay texture. | 113 // Lazily create overlay texture. |
| 114 if (!texture_) | 114 if (!texture_) |
| 115 texture_.reset(new Texture(gpu_factories_)); | 115 texture_.reset(new Texture(gpu_factories_)); |
| 116 | 116 |
| 117 return texture_->IsValid() ? texture_.get() : nullptr; | 117 return texture_->IsValid() ? texture_.get() : nullptr; |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace media | 120 } // namespace media |
| OLD | NEW |