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

Side by Side Diff: gpu/command_buffer/service/texture_manager.cc

Issue 180723023: gpu: Mailbox emulation with EGLImage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | gpu/command_buffer_service.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "gpu/command_buffer/service/texture_manager.h" 5 #include "gpu/command_buffer/service/texture_manager.h"
6 #include "base/bits.h" 6 #include "base/bits.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
9 #include "gpu/command_buffer/service/context_state.h" 9 #include "gpu/command_buffer/service/context_state.h"
10 #include "gpu/command_buffer/service/error_state.h" 10 #include "gpu/command_buffer/service/error_state.h"
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 Texture::LevelInfo& info = 833 Texture::LevelInfo& info =
834 level_infos_[GLTargetToFaceIndex(target)][level]; 834 level_infos_[GLTargetToFaceIndex(target)][level];
835 DCHECK_EQ(info.target, target); 835 DCHECK_EQ(info.target, target);
836 DCHECK_EQ(info.level, level); 836 DCHECK_EQ(info.level, level);
837 info.image = image; 837 info.image = image;
838 UpdateCanRenderCondition(); 838 UpdateCanRenderCondition();
839 UpdateHasImages(); 839 UpdateHasImages();
840 } 840 }
841 841
842 gfx::GLImage* Texture::GetLevelImage(GLint target, GLint level) const { 842 gfx::GLImage* Texture::GetLevelImage(GLint target, GLint level) const {
843 if (target != GL_TEXTURE_2D && target != GL_TEXTURE_EXTERNAL_OES &&
844 target != GL_TEXTURE_RECTANGLE_ARB) {
845 return NULL;
846 }
847
843 size_t face_index = GLTargetToFaceIndex(target); 848 size_t face_index = GLTargetToFaceIndex(target);
844 if (level >= 0 && face_index < level_infos_.size() && 849 if (level >= 0 && face_index < level_infos_.size() &&
845 static_cast<size_t>(level) < level_infos_[face_index].size()) { 850 static_cast<size_t>(level) < level_infos_[face_index].size()) {
846 const LevelInfo& info = level_infos_[GLTargetToFaceIndex(target)][level]; 851 const LevelInfo& info = level_infos_[GLTargetToFaceIndex(target)][level];
847 if (info.target != 0) { 852 if (info.target != 0) {
848 return info.image.get(); 853 return info.image.get();
849 } 854 }
850 } 855 }
851 return 0; 856 return 0;
852 } 857 }
853 858
859 void Texture::OnWillModifyPixels() {
860 gfx::GLImage* image = GetLevelImage(target(), 0);
861 if (image)
862 image->WillModifyTexImage();
863 }
864
865 void Texture::OnDidModifyPixels() {
866 gfx::GLImage* image = GetLevelImage(target(), 0);
867 if (image)
868 image->DidModifyTexImage();
869 }
854 870
855 TextureRef::TextureRef(TextureManager* manager, 871 TextureRef::TextureRef(TextureManager* manager,
856 GLuint client_id, 872 GLuint client_id,
857 Texture* texture) 873 Texture* texture)
858 : manager_(manager), 874 : manager_(manager),
859 texture_(texture), 875 texture_(texture),
860 client_id_(client_id) { 876 client_id_(client_id) {
861 DCHECK(manager_); 877 DCHECK(manager_);
862 DCHECK(texture_); 878 DCHECK(texture_);
863 texture_->AddTextureRef(this); 879 texture_->AddTextureRef(this);
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 } 1567 }
1552 1568
1553 ScopedTextureUploadTimer::~ScopedTextureUploadTimer() { 1569 ScopedTextureUploadTimer::~ScopedTextureUploadTimer() {
1554 texture_state_->texture_upload_count++; 1570 texture_state_->texture_upload_count++;
1555 texture_state_->total_texture_upload_time += 1571 texture_state_->total_texture_upload_time +=
1556 base::TimeTicks::HighResNow() - begin_time_; 1572 base::TimeTicks::HighResNow() - begin_time_;
1557 } 1573 }
1558 1574
1559 } // namespace gles2 1575 } // namespace gles2
1560 } // namespace gpu 1576 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | gpu/command_buffer_service.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698