OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/context.h" | 5 #include "gpu/gles2_conform_support/egl/context.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "gpu/command_buffer/client/gles2_implementation.h" | 10 #include "gpu/command_buffer/client/gles2_implementation.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 gpu::gles2::GLES2Decoder::Create(group.get())); | 266 gpu::gles2::GLES2Decoder::Create(group.get())); |
267 if (!decoder.get()) | 267 if (!decoder.get()) |
268 return false; | 268 return false; |
269 | 269 |
270 std::unique_ptr<gpu::CommandExecutor> command_executor( | 270 std::unique_ptr<gpu::CommandExecutor> command_executor( |
271 new gpu::CommandExecutor(command_buffer.get(), decoder.get(), | 271 new gpu::CommandExecutor(command_buffer.get(), decoder.get(), |
272 decoder.get())); | 272 decoder.get())); |
273 | 273 |
274 decoder->set_engine(command_executor.get()); | 274 decoder->set_engine(command_executor.get()); |
275 | 275 |
276 gl::GLContextAttribs context_attribs; | |
277 context_attribs.gpu_preference = gl::PreferDiscreteGpu; | |
278 scoped_refptr<gl::GLContext> gl_context( | 276 scoped_refptr<gl::GLContext> gl_context( |
279 gl::init::CreateGLContext(nullptr, gl_surface, context_attribs)); | 277 gl::init::CreateGLContext(nullptr, gl_surface, gl::PreferDiscreteGpu)); |
280 if (!gl_context) | 278 if (!gl_context) |
281 return false; | 279 return false; |
282 | 280 |
283 gl_context->MakeCurrent(gl_surface); | 281 gl_context->MakeCurrent(gl_surface); |
284 | 282 |
285 gpu::gles2::ContextCreationAttribHelper helper; | 283 gpu::gles2::ContextCreationAttribHelper helper; |
286 config_->GetAttrib(EGL_ALPHA_SIZE, &helper.alpha_size); | 284 config_->GetAttrib(EGL_ALPHA_SIZE, &helper.alpha_size); |
287 config_->GetAttrib(EGL_DEPTH_SIZE, &helper.depth_size); | 285 config_->GetAttrib(EGL_DEPTH_SIZE, &helper.depth_size); |
288 config_->GetAttrib(EGL_STENCIL_SIZE, &helper.stencil_size); | 286 config_->GetAttrib(EGL_STENCIL_SIZE, &helper.stencil_size); |
289 | 287 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 return false; | 388 return false; |
391 if (!gl_context_->MakeCurrent(gl_surface)) { | 389 if (!gl_context_->MakeCurrent(gl_surface)) { |
392 MarkServiceContextLost(); | 390 MarkServiceContextLost(); |
393 return false; | 391 return false; |
394 } | 392 } |
395 client_gl_context_->Flush(); | 393 client_gl_context_->Flush(); |
396 return true; | 394 return true; |
397 } | 395 } |
398 | 396 |
399 } // namespace egl | 397 } // namespace egl |
OLD | NEW |