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 2341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2352 undefined_faces.push_back(GL_TEXTURE_CUBE_MAP_POSITIVE_X); | 2352 undefined_faces.push_back(GL_TEXTURE_CUBE_MAP_POSITIVE_X); |
2353 } | 2353 } |
2354 } | 2354 } |
2355 if (!memory_type_tracker_->EnsureGPUMemoryAvailable( | 2355 if (!memory_type_tracker_->EnsureGPUMemoryAvailable( |
2356 (undefined_faces.size() + 1) * args.pixels_size)) { | 2356 (undefined_faces.size() + 1) * args.pixels_size)) { |
2357 ERRORSTATE_SET_GL_ERROR(state->GetErrorState(), GL_OUT_OF_MEMORY, | 2357 ERRORSTATE_SET_GL_ERROR(state->GetErrorState(), GL_OUT_OF_MEMORY, |
2358 function_name, "out of memory"); | 2358 function_name, "out of memory"); |
2359 return; | 2359 return; |
2360 } | 2360 } |
2361 DoTexImageArguments new_args = args; | 2361 DoTexImageArguments new_args = args; |
2362 scoped_ptr<char[]> zero(new char[args.pixels_size]); | 2362 std::unique_ptr<char[]> zero(new char[args.pixels_size]); |
2363 memset(zero.get(), 0, args.pixels_size); | 2363 memset(zero.get(), 0, args.pixels_size); |
2364 for (GLenum face : undefined_faces) { | 2364 for (GLenum face : undefined_faces) { |
2365 new_args.target = face; | 2365 new_args.target = face; |
2366 new_args.pixels = zero.get(); | 2366 new_args.pixels = zero.get(); |
2367 DoTexImage(texture_state, state, framebuffer_state, | 2367 DoTexImage(texture_state, state, framebuffer_state, |
2368 function_name, texture_ref, new_args); | 2368 function_name, texture_ref, new_args); |
2369 texture->MarkLevelAsInternalWorkaround(face, args.level); | 2369 texture->MarkLevelAsInternalWorkaround(face, args.level); |
2370 } | 2370 } |
2371 } | 2371 } |
2372 | 2372 |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3172 uint32_t TextureManager::GetServiceIdGeneration() const { | 3172 uint32_t TextureManager::GetServiceIdGeneration() const { |
3173 return current_service_id_generation_; | 3173 return current_service_id_generation_; |
3174 } | 3174 } |
3175 | 3175 |
3176 void TextureManager::IncrementServiceIdGeneration() { | 3176 void TextureManager::IncrementServiceIdGeneration() { |
3177 current_service_id_generation_++; | 3177 current_service_id_generation_++; |
3178 } | 3178 } |
3179 | 3179 |
3180 } // namespace gles2 | 3180 } // namespace gles2 |
3181 } // namespace gpu | 3181 } // namespace gpu |
OLD | NEW |