Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: gpu/gles2_conform_support/egl/context.cc

Issue 2480373002: Refactor context creation parameters into a struct. (Closed)
Patch Set: address piman's comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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;
276 scoped_refptr<gl::GLContext> gl_context( 278 scoped_refptr<gl::GLContext> gl_context(
277 gl::init::CreateGLContext(nullptr, gl_surface, gl::PreferDiscreteGpu)); 279 gl::init::CreateGLContext(nullptr, gl_surface, context_attribs));
278 if (!gl_context) 280 if (!gl_context)
279 return false; 281 return false;
280 282
281 gl_context->MakeCurrent(gl_surface); 283 gl_context->MakeCurrent(gl_surface);
282 284
283 gpu::gles2::ContextCreationAttribHelper helper; 285 gpu::gles2::ContextCreationAttribHelper helper;
284 config_->GetAttrib(EGL_ALPHA_SIZE, &helper.alpha_size); 286 config_->GetAttrib(EGL_ALPHA_SIZE, &helper.alpha_size);
285 config_->GetAttrib(EGL_DEPTH_SIZE, &helper.depth_size); 287 config_->GetAttrib(EGL_DEPTH_SIZE, &helper.depth_size);
286 config_->GetAttrib(EGL_STENCIL_SIZE, &helper.stencil_size); 288 config_->GetAttrib(EGL_STENCIL_SIZE, &helper.stencil_size);
287 289
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 return false; 390 return false;
389 if (!gl_context_->MakeCurrent(gl_surface)) { 391 if (!gl_context_->MakeCurrent(gl_surface)) {
390 MarkServiceContextLost(); 392 MarkServiceContextLost();
391 return false; 393 return false;
392 } 394 }
393 client_gl_context_->Flush(); 395 client_gl_context_->Flush();
394 return true; 396 return true;
395 } 397 }
396 398
397 } // namespace egl 399 } // namespace egl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698