| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/common/gpu/client/gl_helper.h" | 5 #include "content/common/gpu/client/gl_helper.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 uint32 GLHelper::InsertSyncPoint() { return gl_->InsertSyncPointCHROMIUM(); } | 843 uint32 GLHelper::InsertSyncPoint() { return gl_->InsertSyncPointCHROMIUM(); } |
| 844 | 844 |
| 845 void GLHelper::WaitSyncPoint(uint32 sync_point) { | 845 void GLHelper::WaitSyncPoint(uint32 sync_point) { |
| 846 gl_->WaitSyncPointCHROMIUM(sync_point); | 846 gl_->WaitSyncPointCHROMIUM(sync_point); |
| 847 } | 847 } |
| 848 | 848 |
| 849 gpu::MailboxHolder GLHelper::ProduceMailboxHolderFromTexture( | 849 gpu::MailboxHolder GLHelper::ProduceMailboxHolderFromTexture( |
| 850 GLuint texture_id) { | 850 GLuint texture_id) { |
| 851 gpu::Mailbox mailbox; | 851 gpu::Mailbox mailbox; |
| 852 gl_->GenMailboxCHROMIUM(mailbox.name); | 852 gl_->GenMailboxCHROMIUM(mailbox.name); |
| 853 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture_id); | 853 gl_->ProduceTextureDirectCHROMIUM(texture_id, GL_TEXTURE_2D, mailbox.name); |
| 854 gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | |
| 855 return gpu::MailboxHolder(mailbox, GL_TEXTURE_2D, InsertSyncPoint()); | 854 return gpu::MailboxHolder(mailbox, GL_TEXTURE_2D, InsertSyncPoint()); |
| 856 } | 855 } |
| 857 | 856 |
| 858 GLuint GLHelper::ConsumeMailboxToTexture(const gpu::Mailbox& mailbox, | 857 GLuint GLHelper::ConsumeMailboxToTexture(const gpu::Mailbox& mailbox, |
| 859 uint32 sync_point) { | 858 uint32 sync_point) { |
| 860 if (mailbox.IsZero()) | 859 if (mailbox.IsZero()) |
| 861 return 0; | 860 return 0; |
| 862 if (sync_point) | 861 if (sync_point) |
| 863 WaitSyncPoint(sync_point); | 862 WaitSyncPoint(sync_point); |
| 864 GLuint texture = CreateTexture(); | 863 GLuint texture = |
| 865 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture); | 864 gl_->CreateAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
| 866 gl_->ConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | |
| 867 return texture; | 865 return texture; |
| 868 } | 866 } |
| 869 | 867 |
| 870 void GLHelper::ResizeTexture(GLuint texture, const gfx::Size& size) { | 868 void GLHelper::ResizeTexture(GLuint texture, const gfx::Size& size) { |
| 871 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture); | 869 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture); |
| 872 gl_->TexImage2D(GL_TEXTURE_2D, | 870 gl_->TexImage2D(GL_TEXTURE_2D, |
| 873 0, | 871 0, |
| 874 GL_RGB, | 872 GL_RGB, |
| 875 size.width(), | 873 size.width(), |
| 876 size.height(), | 874 size.height(), |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 return copy_texture_to_impl_->CreateReadbackPipelineYUV(quality, | 1251 return copy_texture_to_impl_->CreateReadbackPipelineYUV(quality, |
| 1254 src_size, | 1252 src_size, |
| 1255 src_subrect, | 1253 src_subrect, |
| 1256 dst_size, | 1254 dst_size, |
| 1257 dst_subrect, | 1255 dst_subrect, |
| 1258 flip_vertically, | 1256 flip_vertically, |
| 1259 use_mrt); | 1257 use_mrt); |
| 1260 } | 1258 } |
| 1261 | 1259 |
| 1262 } // namespace content | 1260 } // namespace content |
| OLD | NEW |