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 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 2303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2314 undefined_faces.push_back(GL_TEXTURE_CUBE_MAP_POSITIVE_X); | 2314 undefined_faces.push_back(GL_TEXTURE_CUBE_MAP_POSITIVE_X); |
2315 } | 2315 } |
2316 } | 2316 } |
2317 if (!memory_type_tracker_->EnsureGPUMemoryAvailable( | 2317 if (!memory_type_tracker_->EnsureGPUMemoryAvailable( |
2318 (undefined_faces.size() + 1) * args.pixels_size)) { | 2318 (undefined_faces.size() + 1) * args.pixels_size)) { |
2319 ERRORSTATE_SET_GL_ERROR(state->GetErrorState(), GL_OUT_OF_MEMORY, | 2319 ERRORSTATE_SET_GL_ERROR(state->GetErrorState(), GL_OUT_OF_MEMORY, |
2320 function_name, "out of memory"); | 2320 function_name, "out of memory"); |
2321 return; | 2321 return; |
2322 } | 2322 } |
2323 DoTexImageArguments new_args = args; | 2323 DoTexImageArguments new_args = args; |
2324 scoped_ptr<char[]> zero(new char[args.pixels_size]); | 2324 std::unique_ptr<char[]> zero(new char[args.pixels_size]); |
2325 memset(zero.get(), 0, args.pixels_size); | 2325 memset(zero.get(), 0, args.pixels_size); |
2326 for (GLenum face : undefined_faces) { | 2326 for (GLenum face : undefined_faces) { |
2327 new_args.target = face; | 2327 new_args.target = face; |
2328 new_args.pixels = zero.get(); | 2328 new_args.pixels = zero.get(); |
2329 DoTexImage(texture_state, state, framebuffer_state, | 2329 DoTexImage(texture_state, state, framebuffer_state, |
2330 function_name, texture_ref, new_args); | 2330 function_name, texture_ref, new_args); |
2331 texture->MarkLevelAsInternalWorkaround(face, args.level); | 2331 texture->MarkLevelAsInternalWorkaround(face, args.level); |
2332 } | 2332 } |
2333 } | 2333 } |
2334 | 2334 |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3134 uint32_t TextureManager::GetServiceIdGeneration() const { | 3134 uint32_t TextureManager::GetServiceIdGeneration() const { |
3135 return current_service_id_generation_; | 3135 return current_service_id_generation_; |
3136 } | 3136 } |
3137 | 3137 |
3138 void TextureManager::IncrementServiceIdGeneration() { | 3138 void TextureManager::IncrementServiceIdGeneration() { |
3139 current_service_id_generation_++; | 3139 current_service_id_generation_++; |
3140 } | 3140 } |
3141 | 3141 |
3142 } // namespace gles2 | 3142 } // namespace gles2 |
3143 } // namespace gpu | 3143 } // namespace gpu |
OLD | NEW |