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 "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/debug/trace_event.h" | 7 #include "base/debug/trace_event.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/feature_info.h" | 9 #include "gpu/command_buffer/service/feature_info.h" |
10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
319 const LevelInfo& info = level_infos_[GLTargetToFaceIndex(face)][level]; | 319 const LevelInfo& info = level_infos_[GLTargetToFaceIndex(face)][level]; |
320 if (info.target != 0) { | 320 if (info.target != 0) { |
321 *width = info.width; | 321 *width = info.width; |
322 *height = info.height; | 322 *height = info.height; |
323 return true; | 323 return true; |
324 } | 324 } |
325 } | 325 } |
326 return false; | 326 return false; |
327 } | 327 } |
328 | 328 |
329 bool TextureManager::TextureInfo::SetLevelSize( | |
greggman
2012/04/17 04:58:06
Honestly, I feel like it might be better if you de
| |
330 GLint face, GLint level, GLsizei width, GLsizei height) { | |
331 size_t face_index = GLTargetToFaceIndex(face); | |
332 if (level >= 0 && face_index < level_infos_.size() && | |
333 static_cast<size_t>(level) < level_infos_[face_index].size()) { | |
334 LevelInfo& info = level_infos_[face_index][level]; | |
335 if (info.target!= 0) { | |
336 info.width = width; | |
337 info.height = height; | |
338 return true; | |
339 } | |
340 } | |
341 return false; | |
342 } | |
343 | |
329 bool TextureManager::TextureInfo::GetLevelType( | 344 bool TextureManager::TextureInfo::GetLevelType( |
330 GLint face, GLint level, GLenum* type, GLenum* internal_format) const { | 345 GLint face, GLint level, GLenum* type, GLenum* internal_format) const { |
331 DCHECK(type); | 346 DCHECK(type); |
332 DCHECK(internal_format); | 347 DCHECK(internal_format); |
333 size_t face_index = GLTargetToFaceIndex(face); | 348 size_t face_index = GLTargetToFaceIndex(face); |
334 if (level >= 0 && face_index < level_infos_.size() && | 349 if (level >= 0 && face_index < level_infos_.size() && |
335 static_cast<size_t>(level) < level_infos_[face_index].size()) { | 350 static_cast<size_t>(level) < level_infos_[face_index].size()) { |
336 const LevelInfo& info = level_infos_[GLTargetToFaceIndex(face)][level]; | 351 const LevelInfo& info = level_infos_[face_index][level]; |
337 if (info.target != 0) { | 352 if (info.target != 0) { |
338 *type = info.type; | 353 *type = info.type; |
339 *internal_format = info.internal_format; | 354 *internal_format = info.internal_format; |
340 return true; | 355 return true; |
341 } | 356 } |
342 } | 357 } |
343 return false; | 358 return false; |
344 } | 359 } |
345 | 360 |
346 bool TextureManager::TextureInfo::SetParameter( | 361 bool TextureManager::TextureInfo::SetParameter( |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
909 GLsizei TextureManager::ComputeMipMapCount( | 924 GLsizei TextureManager::ComputeMipMapCount( |
910 GLsizei width, GLsizei height, GLsizei depth) { | 925 GLsizei width, GLsizei height, GLsizei depth) { |
911 return 1 + base::bits::Log2Floor(std::max(std::max(width, height), depth)); | 926 return 1 + base::bits::Log2Floor(std::max(std::max(width, height), depth)); |
912 } | 927 } |
913 | 928 |
914 | 929 |
915 } // namespace gles2 | 930 } // namespace gles2 |
916 } // namespace gpu | 931 } // namespace gpu |
917 | 932 |
918 | 933 |
OLD | NEW |