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

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

Issue 94963003: Take GL version and extensions correctly into account when binding functions (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Improve Windows initialization and renderBufferMultisample explanation Created 7 years 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_surface.h ('k') | ui/gl/gl_surface_egl.cc » ('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 #include "ui/gl/gl_surface.h" 5 #include "ui/gl/gl_surface.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/threading/thread_local.h" 14 #include "base/threading/thread_local.h"
15 #include "ui/gl/gl_context.h" 15 #include "ui/gl/gl_context.h"
16 #include "ui/gl/gl_implementation.h"
17 16
18 namespace gfx { 17 namespace gfx {
19 18
20 namespace { 19 namespace {
21 base::LazyInstance<base::ThreadLocalPointer<GLSurface> >::Leaky 20 base::LazyInstance<base::ThreadLocalPointer<GLSurface> >::Leaky
22 current_surface_ = LAZY_INSTANCE_INITIALIZER; 21 current_surface_ = LAZY_INSTANCE_INITIALIZER;
23 } // namespace 22 } // namespace
24 23
25 // static 24 // static
26 bool GLSurface::InitializeOneOff() { 25 bool GLSurface::InitializeOneOff() {
(...skipping 21 matching lines...) Expand all
48 impl = GetNamedGLImplementation(requested_implementation_name); 47 impl = GetNamedGLImplementation(requested_implementation_name);
49 if (std::find(allowed_impls.begin(), 48 if (std::find(allowed_impls.begin(),
50 allowed_impls.end(), 49 allowed_impls.end(),
51 impl) == allowed_impls.end()) { 50 impl) == allowed_impls.end()) {
52 LOG(ERROR) << "Requested GL implementation is not available."; 51 LOG(ERROR) << "Requested GL implementation is not available.";
53 return false; 52 return false;
54 } 53 }
55 } 54 }
56 } 55 }
57 56
58 initialized = InitializeGLBindings(impl) && InitializeOneOffInternal(); 57 initialized = InitializePreBindingsInternal(impl);
58 if (initialized)
59 initialized = InitializeStaticGLBindings(impl) &&
60 InitializeOneOffInternal();
59 if (!initialized && fallback_to_osmesa) { 61 if (!initialized && fallback_to_osmesa) {
60 ClearGLBindings(); 62 ClearGLBindings();
61 initialized = InitializeGLBindings(kGLImplementationOSMesaGL) && 63 initialized = InitializeStaticGLBindings(kGLImplementationOSMesaGL) &&
62 InitializeOneOffInternal(); 64 InitializeOneOffInternal();
63 } 65 }
64 66
65 if (initialized) { 67 if (initialized) {
66 DVLOG(1) << "Using " 68 DVLOG(1) << "Using "
67 << GetGLImplementationName(GetGLImplementation()) 69 << GetGLImplementationName(GetGLImplementation())
68 << " GL implementation."; 70 << " GL implementation.";
69 if (CommandLine::ForCurrentProcess()->HasSwitch( 71 if (CommandLine::ForCurrentProcess()->HasSwitch(
70 switches::kEnableGPUServiceLogging)) 72 switches::kEnableGPUServiceLogging))
71 InitializeDebugGLBindings(); 73 InitializeDebugGLBindings();
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 return surface_->GetFormat(); 256 return surface_->GetFormat();
255 } 257 }
256 258
257 VSyncProvider* GLSurfaceAdapter::GetVSyncProvider() { 259 VSyncProvider* GLSurfaceAdapter::GetVSyncProvider() {
258 return surface_->GetVSyncProvider(); 260 return surface_->GetVSyncProvider();
259 } 261 }
260 262
261 GLSurfaceAdapter::~GLSurfaceAdapter() {} 263 GLSurfaceAdapter::~GLSurfaceAdapter() {}
262 264
263 } // namespace gfx 265 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_surface.h ('k') | ui/gl/gl_surface_egl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698