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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
8 #include "gpu/command_buffer/client/gles2_lib.h" | 8 #include "gpu/command_buffer/client/gles2_lib.h" |
9 #include "gpu/command_buffer/client/transfer_buffer.h" | 9 #include "gpu/command_buffer/client/transfer_buffer.h" |
10 #include "gpu/command_buffer/common/constants.h" | 10 #include "gpu/command_buffer/common/constants.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 decoder_->set_engine(gpu_scheduler_.get()); | 109 decoder_->set_engine(gpu_scheduler_.get()); |
110 | 110 |
111 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, size); | 111 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, size); |
112 ASSERT_TRUE(surface_.get() != NULL) << "could not create offscreen surface"; | 112 ASSERT_TRUE(surface_.get() != NULL) << "could not create offscreen surface"; |
113 | 113 |
114 context_ = gfx::GLContext::CreateGLContext(share_group_.get(), | 114 context_ = gfx::GLContext::CreateGLContext(share_group_.get(), |
115 surface_.get(), | 115 surface_.get(), |
116 gpu_preference); | 116 gpu_preference); |
117 ASSERT_TRUE(context_.get() != NULL) << "could not create GL context"; | 117 ASSERT_TRUE(context_.get() != NULL) << "could not create GL context"; |
118 | 118 |
| 119 ASSERT_TRUE(context_->MakeCurrent(surface_.get())); |
| 120 |
119 ASSERT_TRUE(decoder_->Initialize( | 121 ASSERT_TRUE(decoder_->Initialize( |
120 surface_.get(), | 122 surface_.get(), |
121 context_.get(), | 123 context_.get(), |
122 true, | 124 true, |
123 size, | 125 size, |
124 ::gpu::gles2::DisallowedFeatures(), | 126 ::gpu::gles2::DisallowedFeatures(), |
125 allowed_extensions, | 127 allowed_extensions, |
126 attribs)) << "could not initialize decoder"; | 128 attribs)) << "could not initialize decoder"; |
127 | 129 |
128 command_buffer_->SetPutOffsetChangeCallback( | 130 command_buffer_->SetPutOffsetChangeCallback( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 if (gles2_implementation_.get()) { | 163 if (gles2_implementation_.get()) { |
162 MakeCurrent(); | 164 MakeCurrent(); |
163 EXPECT_TRUE(glGetError() == GL_NONE); | 165 EXPECT_TRUE(glGetError() == GL_NONE); |
164 gles2_implementation_->Flush(); | 166 gles2_implementation_->Flush(); |
165 gles2_implementation_.reset(); | 167 gles2_implementation_.reset(); |
166 } | 168 } |
167 transfer_buffer_.reset(); | 169 transfer_buffer_.reset(); |
168 gles2_helper_.reset(); | 170 gles2_helper_.reset(); |
169 command_buffer_.reset(); | 171 command_buffer_.reset(); |
170 if (decoder_.get()) { | 172 if (decoder_.get()) { |
171 decoder_->Destroy(); | 173 decoder_->MakeCurrent(); |
| 174 decoder_->Destroy(true); |
172 } | 175 } |
173 } | 176 } |
174 | 177 |
175 void GLManager::PumpCommands() { | 178 void GLManager::PumpCommands() { |
176 decoder_->MakeCurrent(); | 179 decoder_->MakeCurrent(); |
177 gpu_scheduler_->PutChanged(); | 180 gpu_scheduler_->PutChanged(); |
178 ::gpu::CommandBuffer::State state = command_buffer_->GetState(); | 181 ::gpu::CommandBuffer::State state = command_buffer_->GetState(); |
179 ASSERT_EQ(::gpu::error::kNoError, state.error); | 182 ASSERT_EQ(::gpu::error::kNoError, state.error); |
180 } | 183 } |
181 | 184 |
182 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { | 185 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { |
183 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); | 186 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); |
184 } | 187 } |
185 | 188 |
186 } // namespace gpu | 189 } // namespace gpu |
187 | 190 |
OLD | NEW |