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

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

Issue 5270010: Revert 67662 - FBTF: Remove unneeded headers from base/ (part 10)... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 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
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | net/base/directory_lister.h » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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
7 #include <algorithm>
8
9 #include "base/bits.h" 6 #include "base/bits.h"
10 #include "base/logging.h"
11 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 7 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
12 #include "gpu/command_buffer/service/feature_info.h" 8 #include "gpu/command_buffer/service/feature_info.h"
13 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
14 #include "gpu/GLES2/gles2_command_buffer.h" 10 #include "gpu/GLES2/gles2_command_buffer.h"
15 11
16 namespace gpu { 12 namespace gpu {
17 namespace gles2 { 13 namespace gles2 {
18 14
19 static GLsizei ComputeMipMapCount( 15 static GLsizei ComputeMipMapCount(
20 GLsizei width, GLsizei height, GLsizei depth) { 16 GLsizei width, GLsizei height, GLsizei depth) {
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 case GL_TEXTURE_MAX_ANISOTROPY_EXT: 270 case GL_TEXTURE_MAX_ANISOTROPY_EXT:
275 // Nothing to do for this case at the moment. 271 // Nothing to do for this case at the moment.
276 break; 272 break;
277 default: 273 default:
278 NOTREACHED(); 274 NOTREACHED();
279 break; 275 break;
280 } 276 }
281 Update(feature_info); 277 Update(feature_info);
282 } 278 }
283 279
284 void TextureManager::TextureInfo::SetTarget(GLenum target, GLint max_levels) {
285 DCHECK_EQ(0u, target_); // you can only set this once.
286 target_ = target;
287 size_t num_faces = (target == GL_TEXTURE_2D) ? 1 : 6;
288 level_infos_.resize(num_faces);
289 for (size_t ii = 0; ii < num_faces; ++ii) {
290 level_infos_[ii].resize(max_levels);
291 }
292 }
293
294 void TextureManager::TextureInfo::Update(const FeatureInfo* feature_info) { 280 void TextureManager::TextureInfo::Update(const FeatureInfo* feature_info) {
295 // Update npot status. 281 // Update npot status.
296 npot_ = false; 282 npot_ = false;
297 for (size_t ii = 0; ii < level_infos_.size(); ++ii) { 283 for (size_t ii = 0; ii < level_infos_.size(); ++ii) {
298 const TextureInfo::LevelInfo& info = level_infos_[ii][0]; 284 const TextureInfo::LevelInfo& info = level_infos_[ii][0];
299 if (GLES2Util::IsNPOT(info.width) || 285 if (GLES2Util::IsNPOT(info.width) ||
300 GLES2Util::IsNPOT(info.height) || 286 GLES2Util::IsNPOT(info.height) ||
301 GLES2Util::IsNPOT(info.depth)) { 287 GLES2Util::IsNPOT(info.depth)) {
302 npot_ = true; 288 npot_ = true;
303 break; 289 break;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 height <= max_size && 419 height <= max_size &&
434 depth <= max_size && 420 depth <= max_size &&
435 (level == 0 || feature_info->feature_flags().npot_ok || 421 (level == 0 || feature_info->feature_flags().npot_ok ||
436 (!GLES2Util::IsNPOT(width) && 422 (!GLES2Util::IsNPOT(width) &&
437 !GLES2Util::IsNPOT(height) && 423 !GLES2Util::IsNPOT(height) &&
438 !GLES2Util::IsNPOT(depth))) && 424 !GLES2Util::IsNPOT(depth))) &&
439 (target != GL_TEXTURE_CUBE_MAP || (width == height && depth == 1)) && 425 (target != GL_TEXTURE_CUBE_MAP || (width == height && depth == 1)) &&
440 (target != GL_TEXTURE_2D || (depth == 1)); 426 (target != GL_TEXTURE_2D || (depth == 1));
441 } 427 }
442 428
443 void TextureManager::SetInfoTarget(TextureInfo* info, GLenum target) {
444 DCHECK(info);
445 info->SetTarget(target, MaxLevelsForTarget(target));
446 }
447
448 void TextureManager::SetLevelInfo( 429 void TextureManager::SetLevelInfo(
449 const FeatureInfo* feature_info, 430 const FeatureInfo* feature_info,
450 TextureManager::TextureInfo* info, 431 TextureManager::TextureInfo* info,
451 GLenum target, 432 GLenum target,
452 GLint level, 433 GLint level,
453 GLenum internal_format, 434 GLenum internal_format,
454 GLsizei width, 435 GLsizei width,
455 GLsizei height, 436 GLsizei height,
456 GLsizei depth, 437 GLsizei depth,
457 GLint border, 438 GLint border,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 if (it->second->service_id() == service_id) { 519 if (it->second->service_id() == service_id) {
539 *client_id = it->first; 520 *client_id = it->first;
540 return true; 521 return true;
541 } 522 }
542 } 523 }
543 return false; 524 return false;
544 } 525 }
545 526
546 } // namespace gles2 527 } // namespace gles2
547 } // namespace gpu 528 } // namespace gpu
529
530
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | net/base/directory_lister.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698