OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 // Maybe create a short lived offscreen GLSurface for the purpose of | 1758 // Maybe create a short lived offscreen GLSurface for the purpose of |
1759 // initializing the decoder's GLContext. | 1759 // initializing the decoder's GLContext. |
1760 surface_ = surface; | 1760 surface_ = surface; |
1761 | 1761 |
1762 // Take ownership of the GLContext. | 1762 // Take ownership of the GLContext. |
1763 context_ = context; | 1763 context_ = context; |
1764 | 1764 |
1765 if (!MakeCurrent()) { | 1765 if (!MakeCurrent()) { |
1766 LOG(ERROR) << "GLES2DecoderImpl::Initialize failed because " | 1766 LOG(ERROR) << "GLES2DecoderImpl::Initialize failed because " |
1767 << "MakeCurrent failed."; | 1767 << "MakeCurrent failed."; |
| 1768 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. |
1768 Destroy(); | 1769 Destroy(); |
1769 return false; | 1770 return false; |
1770 } | 1771 } |
1771 | 1772 |
1772 if (!group_->Initialize(disallowed_features, allowed_extensions)) { | 1773 if (!group_->Initialize(disallowed_features, allowed_extensions)) { |
1773 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " | 1774 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " |
1774 << "failed to initialize."; | 1775 << "failed to initialize."; |
| 1776 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. |
1775 Destroy(); | 1777 Destroy(); |
1776 return false; | 1778 return false; |
1777 } | 1779 } |
1778 | 1780 |
1779 CHECK_GL_ERROR(); | 1781 CHECK_GL_ERROR(); |
1780 disallowed_features_ = disallowed_features; | 1782 disallowed_features_ = disallowed_features; |
1781 | 1783 |
1782 vertex_attrib_manager_.Initialize(group_->max_vertex_attribs()); | 1784 vertex_attrib_manager_.Initialize(group_->max_vertex_attribs()); |
1783 | 1785 |
1784 util_.set_num_compressed_texture_formats( | 1786 util_.set_num_compressed_texture_formats( |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2407 if (offscreen_saved_frame_buffer_.get()) | 2409 if (offscreen_saved_frame_buffer_.get()) |
2408 offscreen_saved_frame_buffer_->Invalidate(); | 2410 offscreen_saved_frame_buffer_->Invalidate(); |
2409 if (offscreen_saved_color_texture_.get()) | 2411 if (offscreen_saved_color_texture_.get()) |
2410 offscreen_saved_color_texture_->Invalidate(); | 2412 offscreen_saved_color_texture_->Invalidate(); |
2411 if (offscreen_resolved_frame_buffer_.get()) | 2413 if (offscreen_resolved_frame_buffer_.get()) |
2412 offscreen_resolved_frame_buffer_->Invalidate(); | 2414 offscreen_resolved_frame_buffer_->Invalidate(); |
2413 if (offscreen_resolved_color_texture_.get()) | 2415 if (offscreen_resolved_color_texture_.get()) |
2414 offscreen_resolved_color_texture_->Invalidate(); | 2416 offscreen_resolved_color_texture_->Invalidate(); |
2415 } | 2417 } |
2416 | 2418 |
2417 group_->Destroy(have_context); | 2419 if (group_) { |
2418 group_ = NULL; | 2420 group_->Destroy(have_context); |
| 2421 group_ = NULL; |
| 2422 } |
2419 | 2423 |
2420 if (context_.get()) { | 2424 if (context_.get()) { |
2421 context_->ReleaseCurrent(NULL); | 2425 context_->ReleaseCurrent(NULL); |
2422 context_ = NULL; | 2426 context_ = NULL; |
2423 } | 2427 } |
2424 | 2428 |
2425 offscreen_target_frame_buffer_.reset(); | 2429 offscreen_target_frame_buffer_.reset(); |
2426 offscreen_target_color_texture_.reset(); | 2430 offscreen_target_color_texture_.reset(); |
2427 offscreen_target_color_render_buffer_.reset(); | 2431 offscreen_target_color_render_buffer_.reset(); |
2428 offscreen_target_depth_render_buffer_.reset(); | 2432 offscreen_target_depth_render_buffer_.reset(); |
(...skipping 4658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7087 return error::kNoError; | 7091 return error::kNoError; |
7088 } | 7092 } |
7089 | 7093 |
7090 // Include the auto-generated part of this file. We split this because it means | 7094 // Include the auto-generated part of this file. We split this because it means |
7091 // we can easily edit the non-auto generated parts right here in this file | 7095 // we can easily edit the non-auto generated parts right here in this file |
7092 // instead of having to edit some template or the code generator. | 7096 // instead of having to edit some template or the code generator. |
7093 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 7097 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
7094 | 7098 |
7095 } // namespace gles2 | 7099 } // namespace gles2 |
7096 } // namespace gpu | 7100 } // namespace gpu |
OLD | NEW |