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

Side by Side Diff: ui/gl/gl_context_wgl.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) 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 // This file implements the GLContextWGL and PbufferGLContext classes. 5 // This file implements the GLContextWGL and PbufferGLContext classes.
6 6
7 #include "ui/gl/gl_context_wgl.h" 7 #include "ui/gl/gl_context_wgl.h"
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/trace_event/trace_event.h" 11 #include "base/trace_event/trace_event.h"
12 #include "ui/gl/gl_bindings.h" 12 #include "ui/gl/gl_bindings.h"
13 #include "ui/gl/gl_implementation.h" 13 #include "ui/gl/gl_implementation.h"
14 #include "ui/gl/gl_surface_wgl.h" 14 #include "ui/gl/gl_surface_wgl.h"
15 15
16 namespace gl { 16 namespace gl {
17 17
18 GLContextWGL::GLContextWGL(GLShareGroup* share_group) 18 GLContextWGL::GLContextWGL(GLShareGroup* share_group)
19 : GLContextReal(share_group), context_(nullptr) { 19 : GLContextReal(share_group), context_(nullptr) {
20 } 20 }
21 21
22 bool GLContextWGL::Initialize( 22 bool GLContextWGL::Initialize(GLSurface* compatible_surface,
23 GLSurface* compatible_surface, GpuPreference gpu_preference) { 23 const GLContextAttribs& attribs) {
24 // webgl_compatibility_context and disabling bind_generates_resource are not
25 // supported.
26 DCHECK(!attribs.webgl_compatibility_context &&
27 attribs.bind_generates_resource);
28
24 // Get the handle of another initialized context in the share group _before_ 29 // Get the handle of another initialized context in the share group _before_
25 // setting context_. Otherwise this context will be considered initialized 30 // setting context_. Otherwise this context will be considered initialized
26 // and could potentially be returned by GetHandle. 31 // and could potentially be returned by GetHandle.
27 HGLRC share_handle = static_cast<HGLRC>(share_group()->GetHandle()); 32 HGLRC share_handle = static_cast<HGLRC>(share_group()->GetHandle());
28 33
29 HDC device_context = static_cast<HDC>(compatible_surface->GetHandle()); 34 HDC device_context = static_cast<HDC>(compatible_surface->GetHandle());
30 bool has_wgl_create_context_arb = 35 bool has_wgl_create_context_arb =
31 strstr(wglGetExtensionsStringARB(device_context), 36 strstr(wglGetExtensionsStringARB(device_context),
32 "WGL_ARB_create_context") != nullptr; 37 "WGL_ARB_create_context") != nullptr;
33 bool create_core_profile = has_wgl_create_context_arb && 38 bool create_core_profile = has_wgl_create_context_arb &&
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 return GLContext::GetExtensions() + " " + extensions; 173 return GLContext::GetExtensions() + " " + extensions;
169 174
170 return GLContext::GetExtensions(); 175 return GLContext::GetExtensions();
171 } 176 }
172 177
173 GLContextWGL::~GLContextWGL() { 178 GLContextWGL::~GLContextWGL() {
174 Destroy(); 179 Destroy();
175 } 180 }
176 181
177 } // namespace gl 182 } // namespace gl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698