OLD | NEW |
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 #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/context_group.h" | 8 #include "gpu/command_buffer/service/context_group.h" |
9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 case 4: | 51 case 4: |
52 return GL_TEXTURE_CUBE_MAP_POSITIVE_Z; | 52 return GL_TEXTURE_CUBE_MAP_POSITIVE_Z; |
53 case 5: | 53 case 5: |
54 return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; | 54 return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; |
55 default: | 55 default: |
56 NOTREACHED(); | 56 NOTREACHED(); |
57 return 0; | 57 return 0; |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
| 61 TextureManager::~TextureManager() { |
| 62 DCHECK(texture_infos_.empty()); |
| 63 } |
| 64 |
| 65 void TextureManager::Destroy(bool have_context) { |
| 66 while (!texture_infos_.empty()) { |
| 67 if (have_context) { |
| 68 TextureInfo* info = texture_infos_.begin()->second; |
| 69 if (!info->IsDeleted()) { |
| 70 GLuint service_id = info->service_id(); |
| 71 glDeleteTextures(1, &service_id); |
| 72 info->MarkAsDeleted(); |
| 73 } |
| 74 } |
| 75 texture_infos_.erase(texture_infos_.begin()); |
| 76 } |
| 77 } |
| 78 |
61 bool TextureManager::TextureInfo::CanRender() const { | 79 bool TextureManager::TextureInfo::CanRender() const { |
62 if (target_ == 0 || IsDeleted()) { | 80 if (target_ == 0 || IsDeleted()) { |
63 return false; | 81 return false; |
64 } | 82 } |
65 bool needs_mips = NeedsMips(); | 83 bool needs_mips = NeedsMips(); |
66 if (npot()) { | 84 if (npot()) { |
67 return !needs_mips && | 85 return !needs_mips && |
68 wrap_s_ == GL_CLAMP_TO_EDGE && | 86 wrap_s_ == GL_CLAMP_TO_EDGE && |
69 wrap_t_ == GL_CLAMP_TO_EDGE; | 87 wrap_t_ == GL_CLAMP_TO_EDGE; |
70 } | 88 } |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 return true; | 405 return true; |
388 } | 406 } |
389 } | 407 } |
390 return false; | 408 return false; |
391 } | 409 } |
392 | 410 |
393 } // namespace gles2 | 411 } // namespace gles2 |
394 } // namespace gpu | 412 } // namespace gpu |
395 | 413 |
396 | 414 |
OLD | NEW |