| 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> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "base/bits.h" | 14 #include "base/bits.h" |
| 15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
| 16 #include "base/metrics/histogram_macros.h" |
| 16 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
| 17 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
| 18 #include "base/trace_event/memory_dump_manager.h" | 19 #include "base/trace_event/memory_dump_manager.h" |
| 19 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 20 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 20 #include "gpu/command_buffer/service/context_state.h" | 21 #include "gpu/command_buffer/service/context_state.h" |
| 21 #include "gpu/command_buffer/service/error_state.h" | 22 #include "gpu/command_buffer/service/error_state.h" |
| 22 #include "gpu/command_buffer/service/feature_info.h" | 23 #include "gpu/command_buffer/service/feature_info.h" |
| 23 #include "gpu/command_buffer/service/framebuffer_manager.h" | 24 #include "gpu/command_buffer/service/framebuffer_manager.h" |
| 24 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 25 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 25 #include "gpu/command_buffer/service/mailbox_manager.h" | 26 #include "gpu/command_buffer/service/mailbox_manager.h" |
| (...skipping 2229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2255 glTexImage3D(args.target, args.level, args.internal_format, args.width, | 2256 glTexImage3D(args.target, args.level, args.internal_format, args.width, |
| 2256 args.height, args.depth, args.border, args.format, | 2257 args.height, args.depth, args.border, args.format, |
| 2257 args.type, args.pixels); | 2258 args.type, args.pixels); |
| 2258 } else { | 2259 } else { |
| 2259 glTexImage2D(args.target, args.level, args.internal_format, args.width, | 2260 glTexImage2D(args.target, args.level, args.internal_format, args.width, |
| 2260 args.height, args.border, AdjustTexFormat(args.format), | 2261 args.height, args.border, AdjustTexFormat(args.format), |
| 2261 args.type, args.pixels); | 2262 args.type, args.pixels); |
| 2262 } | 2263 } |
| 2263 } | 2264 } |
| 2264 GLenum error = ERRORSTATE_PEEK_GL_ERROR(error_state, function_name); | 2265 GLenum error = ERRORSTATE_PEEK_GL_ERROR(error_state, function_name); |
| 2266 if (args.command_type == DoTexImageArguments::kTexImage3D) { |
| 2267 UMA_HISTOGRAM_CUSTOM_ENUMERATION("GPU.Error.TexImage3D", error, |
| 2268 GetAllGLErrors()); |
| 2269 } else { |
| 2270 UMA_HISTOGRAM_CUSTOM_ENUMERATION("GPU.Error.TexImage2D", error, |
| 2271 GetAllGLErrors()); |
| 2272 } |
| 2265 if (error == GL_NO_ERROR) { | 2273 if (error == GL_NO_ERROR) { |
| 2266 SetLevelInfo( | 2274 SetLevelInfo( |
| 2267 texture_ref, args.target, args.level, args.internal_format, args.width, | 2275 texture_ref, args.target, args.level, args.internal_format, args.width, |
| 2268 args.height, args.depth, args.border, args.format, args.type, | 2276 args.height, args.depth, args.border, args.format, args.type, |
| 2269 args.pixels != NULL ? gfx::Rect(args.width, args.height) : gfx::Rect()); | 2277 args.pixels != NULL ? gfx::Rect(args.width, args.height) : gfx::Rect()); |
| 2270 texture_state->tex_image_failed = false; | 2278 texture_state->tex_image_failed = false; |
| 2271 } | 2279 } |
| 2272 } | 2280 } |
| 2273 | 2281 |
| 2274 bool TextureManager::CombineAdjacentRects(const gfx::Rect& rect1, | 2282 bool TextureManager::CombineAdjacentRects(const gfx::Rect& rect1, |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2614 return GL_HALF_FLOAT_OES; | 2622 return GL_HALF_FLOAT_OES; |
| 2615 case GL_BGRA8_EXT: | 2623 case GL_BGRA8_EXT: |
| 2616 return GL_UNSIGNED_BYTE; | 2624 return GL_UNSIGNED_BYTE; |
| 2617 default: | 2625 default: |
| 2618 return GL_NONE; | 2626 return GL_NONE; |
| 2619 } | 2627 } |
| 2620 } | 2628 } |
| 2621 | 2629 |
| 2622 } // namespace gles2 | 2630 } // namespace gles2 |
| 2623 } // namespace gpu | 2631 } // namespace gpu |
| OLD | NEW |