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

Side by Side Diff: ui/gl/gl_context_wgl.cc

Issue 2497503004: Revert of Refactor context creation parameters into a struct. (Closed)
Patch Set: 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
« no previous file with comments | « ui/gl/gl_context_wgl.h ('k') | ui/gl/gl_surface_egl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(GLSurface* compatible_surface, 22 bool GLContextWGL::Initialize(
23 const GLContextAttribs& attribs) { 23 GLSurface* compatible_surface, GpuPreference gpu_preference) {
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
29 // Get the handle of another initialized context in the share group _before_ 24 // Get the handle of another initialized context in the share group _before_
30 // setting context_. Otherwise this context will be considered initialized 25 // setting context_. Otherwise this context will be considered initialized
31 // and could potentially be returned by GetHandle. 26 // and could potentially be returned by GetHandle.
32 HGLRC share_handle = static_cast<HGLRC>(share_group()->GetHandle()); 27 HGLRC share_handle = static_cast<HGLRC>(share_group()->GetHandle());
33 28
34 HDC device_context = static_cast<HDC>(compatible_surface->GetHandle()); 29 HDC device_context = static_cast<HDC>(compatible_surface->GetHandle());
35 bool has_wgl_create_context_arb = 30 bool has_wgl_create_context_arb =
36 strstr(wglGetExtensionsStringARB(device_context), 31 strstr(wglGetExtensionsStringARB(device_context),
37 "WGL_ARB_create_context") != nullptr; 32 "WGL_ARB_create_context") != nullptr;
38 bool create_core_profile = has_wgl_create_context_arb && 33 bool create_core_profile = has_wgl_create_context_arb &&
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 return GLContext::GetExtensions() + " " + extensions; 168 return GLContext::GetExtensions() + " " + extensions;
174 169
175 return GLContext::GetExtensions(); 170 return GLContext::GetExtensions();
176 } 171 }
177 172
178 GLContextWGL::~GLContextWGL() { 173 GLContextWGL::~GLContextWGL() {
179 Destroy(); 174 Destroy();
180 } 175 }
181 176
182 } // namespace gl 177 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_context_wgl.h ('k') | ui/gl/gl_surface_egl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698