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/gles2_conform_support/egl/display.h" | 5 #include "gpu/gles2_conform_support/egl/display.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "gpu/command_buffer/client/gles2_implementation.h" | 10 #include "gpu/command_buffer/client/gles2_implementation.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 const EGLint* attrib_list) { | 222 const EGLint* attrib_list) { |
223 DCHECK(IsValidConfig(config)); | 223 DCHECK(IsValidConfig(config)); |
224 // TODO(alokp): Add support for shared contexts. | 224 // TODO(alokp): Add support for shared contexts. |
225 if (share_ctx != NULL) | 225 if (share_ctx != NULL) |
226 return EGL_NO_CONTEXT; | 226 return EGL_NO_CONTEXT; |
227 | 227 |
228 DCHECK(command_buffer_ != NULL); | 228 DCHECK(command_buffer_ != NULL); |
229 DCHECK(transfer_buffer_.get()); | 229 DCHECK(transfer_buffer_.get()); |
230 | 230 |
231 bool bind_generates_resources = true; | 231 bool bind_generates_resources = true; |
| 232 bool lose_context_when_out_of_memory = false; |
232 | 233 |
233 context_.reset(new gpu::gles2::GLES2Implementation( | 234 context_.reset( |
234 gles2_cmd_helper_.get(), | 235 new gpu::gles2::GLES2Implementation(gles2_cmd_helper_.get(), |
235 NULL, | 236 NULL, |
236 transfer_buffer_.get(), | 237 transfer_buffer_.get(), |
237 bind_generates_resources, | 238 bind_generates_resources, |
238 gpu_control_.get())); | 239 lose_context_when_out_of_memory, |
| 240 gpu_control_.get())); |
239 | 241 |
240 if (!context_->Initialize( | 242 if (!context_->Initialize( |
241 kTransferBufferSize, | 243 kTransferBufferSize, |
242 kTransferBufferSize / 2, | 244 kTransferBufferSize / 2, |
243 kTransferBufferSize * 2, | 245 kTransferBufferSize * 2, |
244 gpu::gles2::GLES2Implementation::kNoLimit)) { | 246 gpu::gles2::GLES2Implementation::kNoLimit)) { |
245 return EGL_NO_CONTEXT; | 247 return EGL_NO_CONTEXT; |
246 } | 248 } |
247 | 249 |
248 context_->EnableFeatureCHROMIUM("pepper3d_allow_buffers_on_multiple_targets"); | 250 context_->EnableFeatureCHROMIUM("pepper3d_allow_buffers_on_multiple_targets"); |
(...skipping 14 matching lines...) Expand all Loading... |
263 } else { | 265 } else { |
264 DCHECK(IsValidSurface(draw)); | 266 DCHECK(IsValidSurface(draw)); |
265 DCHECK(IsValidSurface(read)); | 267 DCHECK(IsValidSurface(read)); |
266 DCHECK(IsValidContext(ctx)); | 268 DCHECK(IsValidContext(ctx)); |
267 gles2::SetGLContext(context_.get()); | 269 gles2::SetGLContext(context_.get()); |
268 } | 270 } |
269 return true; | 271 return true; |
270 } | 272 } |
271 | 273 |
272 } // namespace egl | 274 } // namespace egl |
OLD | NEW |