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

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

Issue 8905027: Revert 114059 - Fixed service side implementation of glTexStorage2DEXT to only initialize the num... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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
Property Changes:
Deleted: svn:mergeinfo
Reverse-merged /branches/chrome_webkit_merge_branch/o3d/gpu/command_buffer/service/texture_manager.cc:r69-2775
Reverse-merged /trunk/src/o3d/gpu/command_buffer/service/texture_manager.cc:r32866-32958
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "gpu/command_buffer/common/gles2_cmd_utils.h" 7 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
8 #include "gpu/command_buffer/service/feature_info.h" 8 #include "gpu/command_buffer/service/feature_info.h"
9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
10 10
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return texture_complete(); 99 return texture_complete();
100 } else { 100 } else {
101 return texture_complete() && cube_complete(); 101 return texture_complete() && cube_complete();
102 } 102 }
103 } else { 103 } else {
104 return true; 104 return true;
105 } 105 }
106 } 106 }
107 107
108 bool TextureManager::TextureInfo::MarkMipmapsGenerated( 108 bool TextureManager::TextureInfo::MarkMipmapsGenerated(
109 const FeatureInfo* feature_info) { 109 const FeatureInfo* feature_info,
110 bool cleared) {
110 if (!CanGenerateMipmaps(feature_info)) { 111 if (!CanGenerateMipmaps(feature_info)) {
111 return false; 112 return false;
112 } 113 }
113 for (size_t ii = 0; ii < level_infos_.size(); ++ii) { 114 for (size_t ii = 0; ii < level_infos_.size(); ++ii) {
114 const TextureInfo::LevelInfo& info1 = level_infos_[ii][0]; 115 const TextureInfo::LevelInfo& info1 = level_infos_[ii][0];
115 GLsizei width = info1.width; 116 GLsizei width = info1.width;
116 GLsizei height = info1.height; 117 GLsizei height = info1.height;
117 GLsizei depth = info1.depth; 118 GLsizei depth = info1.depth;
118 GLenum target = target_ == GL_TEXTURE_2D ? GL_TEXTURE_2D : 119 GLenum target = target_ == GL_TEXTURE_2D ? GL_TEXTURE_2D :
119 FaceIndexToGLTarget(ii); 120 FaceIndexToGLTarget(ii);
120 int num_mips = ComputeMipMapCount(width, height, depth); 121 int num_mips = ComputeMipMapCount(width, height, depth);
121 for (int level = 1; level < num_mips; ++level) { 122 for (int level = 1; level < num_mips; ++level) {
122 width = std::max(1, width >> 1); 123 width = std::max(1, width >> 1);
123 height = std::max(1, height >> 1); 124 height = std::max(1, height >> 1);
124 depth = std::max(1, depth >> 1); 125 depth = std::max(1, depth >> 1);
125 SetLevelInfo(feature_info, 126 SetLevelInfo(feature_info,
126 target, 127 target,
127 level, 128 level,
128 info1.internal_format, 129 info1.internal_format,
129 width, 130 width,
130 height, 131 height,
131 depth, 132 depth,
132 info1.border, 133 info1.border,
133 info1.format, 134 info1.format,
134 info1.type, 135 info1.type,
135 true); 136 cleared);
136 } 137 }
137 } 138 }
138 139
139 return true; 140 return true;
140 } 141 }
141 142
142 void TextureManager::TextureInfo::SetTarget(GLenum target, GLint max_levels) { 143 void TextureManager::TextureInfo::SetTarget(GLenum target, GLint max_levels) {
143 DCHECK_EQ(0u, target_); // you can only set this once. 144 DCHECK_EQ(0u, target_); // you can only set this once.
144 target_ = target; 145 target_ = target;
145 size_t num_faces = (target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; 146 size_t num_faces = (target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 } 517 }
517 518
518 DCHECK_NE(0, num_uncleared_mips_); 519 DCHECK_NE(0, num_uncleared_mips_);
519 --num_uncleared_mips_; 520 --num_uncleared_mips_;
520 521
521 // NOTE: It seems kind of gross to call back into the decoder for this 522 // NOTE: It seems kind of gross to call back into the decoder for this
522 // but only the decoder knows all the state (like unpack_alignment_) that's 523 // but only the decoder knows all the state (like unpack_alignment_) that's
523 // needed to be able to call GL correctly. 524 // needed to be able to call GL correctly.
524 info.cleared = decoder->ClearLevel( 525 info.cleared = decoder->ClearLevel(
525 service_id_, target_, info.target, info.level, info.format, info.type, 526 service_id_, target_, info.target, info.level, info.format, info.type,
526 info.width, info.height, immutable_); 527 info.width, info.height);
527 if (!info.cleared) { 528 if (!info.cleared) {
528 ++num_uncleared_mips_; 529 ++num_uncleared_mips_;
529 } 530 }
530 return info.cleared; 531 return info.cleared;
531 } 532 }
532 533
533 TextureManager::TextureManager( 534 TextureManager::TextureManager(
534 GLint max_texture_size, 535 GLint max_texture_size,
535 GLint max_cube_map_texture_size) 536 GLint max_cube_map_texture_size)
536 : max_texture_size_(max_texture_size), 537 : max_texture_size_(max_texture_size),
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 ++num_unrenderable_textures_; 784 ++num_unrenderable_textures_;
784 } 785 }
785 if (!info->SafeToRenderFrom()) { 786 if (!info->SafeToRenderFrom()) {
786 ++num_unsafe_textures_; 787 ++num_unsafe_textures_;
787 } 788 }
788 return result; 789 return result;
789 } 790 }
790 791
791 bool TextureManager::MarkMipmapsGenerated( 792 bool TextureManager::MarkMipmapsGenerated(
792 const FeatureInfo* feature_info, 793 const FeatureInfo* feature_info,
793 TextureManager::TextureInfo* info) { 794 TextureManager::TextureInfo* info,
795 bool cleared) {
794 DCHECK(info); 796 DCHECK(info);
795 if (!info->CanRender(feature_info)) { 797 if (!info->CanRender(feature_info)) {
796 DCHECK_NE(0, num_unrenderable_textures_); 798 DCHECK_NE(0, num_unrenderable_textures_);
797 --num_unrenderable_textures_; 799 --num_unrenderable_textures_;
798 } 800 }
799 if (!info->SafeToRenderFrom()) { 801 if (!info->SafeToRenderFrom()) {
800 DCHECK_NE(0, num_unsafe_textures_); 802 DCHECK_NE(0, num_unsafe_textures_);
801 --num_unsafe_textures_; 803 --num_unsafe_textures_;
802 } 804 }
803 num_uncleared_mips_ -= info->num_uncleared_mips(); 805 num_uncleared_mips_ -= info->num_uncleared_mips();
804 DCHECK_GE(num_uncleared_mips_, 0); 806 DCHECK_GE(num_uncleared_mips_, 0);
805 bool result = info->MarkMipmapsGenerated(feature_info); 807 bool result = info->MarkMipmapsGenerated(feature_info, cleared);
806 num_uncleared_mips_ += info->num_uncleared_mips(); 808 num_uncleared_mips_ += info->num_uncleared_mips();
807 if (!info->CanRender(feature_info)) { 809 if (!info->CanRender(feature_info)) {
808 ++num_unrenderable_textures_; 810 ++num_unrenderable_textures_;
809 } 811 }
810 if (!info->SafeToRenderFrom()) { 812 if (!info->SafeToRenderFrom()) {
811 ++num_unsafe_textures_; 813 ++num_unsafe_textures_;
812 } 814 }
813 return result; 815 return result;
814 } 816 }
815 817
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 GLsizei TextureManager::ComputeMipMapCount( 873 GLsizei TextureManager::ComputeMipMapCount(
872 GLsizei width, GLsizei height, GLsizei depth) { 874 GLsizei width, GLsizei height, GLsizei depth) {
873 return 1 + base::bits::Log2Floor(std::max(std::max(width, height), depth)); 875 return 1 + base::bits::Log2Floor(std::max(std::max(width, height), depth));
874 } 876 }
875 877
876 878
877 } // namespace gles2 879 } // namespace gles2
878 } // namespace gpu 880 } // namespace gpu
879 881
880 882
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | gpu/command_buffer/service/texture_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698