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/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 1999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2010 | 2010 |
2011 if (!group_->Initialize(disallowed_features, allowed_extensions)) { | 2011 if (!group_->Initialize(disallowed_features, allowed_extensions)) { |
2012 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " | 2012 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " |
2013 << "failed to initialize."; | 2013 << "failed to initialize."; |
2014 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. | 2014 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. |
2015 Destroy(true); | 2015 Destroy(true); |
2016 return false; | 2016 return false; |
2017 } | 2017 } |
2018 CHECK_GL_ERROR(); | 2018 CHECK_GL_ERROR(); |
2019 | 2019 |
2020 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager()); | |
2021 copy_texture_CHROMIUM_->Initialize(); | |
2022 CHECK_GL_ERROR(); | |
2023 | |
2024 disallowed_features_ = disallowed_features; | 2020 disallowed_features_ = disallowed_features; |
2025 | 2021 |
2026 vertex_attrib_manager_.reset(new VertexAttribManager()); | 2022 vertex_attrib_manager_.reset(new VertexAttribManager()); |
2027 vertex_attrib_manager_->Initialize(group_->max_vertex_attribs()); | 2023 vertex_attrib_manager_->Initialize(group_->max_vertex_attribs()); |
2028 | 2024 |
2029 query_manager_.reset(new QueryManager(this, feature_info_)); | 2025 query_manager_.reset(new QueryManager(this, feature_info_)); |
2030 | 2026 |
2031 util_.set_num_compressed_texture_formats( | 2027 util_.set_num_compressed_texture_formats( |
2032 validators_->compressed_texture_format.GetValues().size()); | 2028 validators_->compressed_texture_format.GetValues().size()); |
2033 | 2029 |
(...skipping 6465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8499 } | 8495 } |
8500 | 8496 |
8501 // Check that this type of texture is allowed. | 8497 // Check that this type of texture is allowed. |
8502 if (!texture_manager()->ValidForTarget(GL_TEXTURE_2D, level, source_width, | 8498 if (!texture_manager()->ValidForTarget(GL_TEXTURE_2D, level, source_width, |
8503 source_height, 1)) { | 8499 source_height, 1)) { |
8504 SetGLError(GL_INVALID_VALUE, | 8500 SetGLError(GL_INVALID_VALUE, |
8505 "glCopyTextureCHROMIUM: Bad dimensions"); | 8501 "glCopyTextureCHROMIUM: Bad dimensions"); |
8506 return; | 8502 return; |
8507 } | 8503 } |
8508 | 8504 |
| 8505 // Defer initializing the CopyTextureCHROMIUMResourceManager until it is |
| 8506 // needed because it takes 10s of milliseconds to initialize. |
| 8507 if (!copy_texture_CHROMIUM_.get()) { |
| 8508 CopyRealGLErrorsToWrapper(); |
| 8509 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager()); |
| 8510 copy_texture_CHROMIUM_->Initialize(); |
| 8511 RestoreCurrentFramebufferBindings(); |
| 8512 if (PeekGLError() != GL_NO_ERROR) |
| 8513 return; |
| 8514 } |
| 8515 |
8509 GLenum dest_type; | 8516 GLenum dest_type; |
8510 GLenum dest_internal_format; | 8517 GLenum dest_internal_format; |
8511 bool dest_level_defined = dest_info->GetLevelSize(GL_TEXTURE_2D, level, | 8518 bool dest_level_defined = dest_info->GetLevelSize(GL_TEXTURE_2D, level, |
8512 &dest_width, | 8519 &dest_width, |
8513 &dest_height); | 8520 &dest_height); |
8514 | 8521 |
8515 if (dest_level_defined) { | 8522 if (dest_level_defined) { |
8516 dest_info->GetLevelType(GL_TEXTURE_2D, level, &dest_type, | 8523 dest_info->GetLevelType(GL_TEXTURE_2D, level, &dest_type, |
8517 &dest_internal_format); | 8524 &dest_internal_format); |
8518 } else { | 8525 } else { |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8731 BindAndApplyTextureParameters(info); | 8738 BindAndApplyTextureParameters(info); |
8732 } | 8739 } |
8733 | 8740 |
8734 // Include the auto-generated part of this file. We split this because it means | 8741 // Include the auto-generated part of this file. We split this because it means |
8735 // we can easily edit the non-auto generated parts right here in this file | 8742 // we can easily edit the non-auto generated parts right here in this file |
8736 // instead of having to edit some template or the code generator. | 8743 // instead of having to edit some template or the code generator. |
8737 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 8744 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
8738 | 8745 |
8739 } // namespace gles2 | 8746 } // namespace gles2 |
8740 } // namespace gpu | 8747 } // namespace gpu |
OLD | NEW |