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

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

Issue 221433004: gpu: Bind dummy GL API when no context is current (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months 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 | Annotate | Revision Log
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_context_osmesa.h" 5 #include "ui/gl/gl_context_osmesa.h"
6 6
7 #include <GL/osmesa.h> 7 #include <GL/osmesa.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/gfx/size.h" 10 #include "ui/gfx/size.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 return false; 62 return false;
63 } 63 }
64 64
65 // Set this as soon as the context is current, since we might call into GL. 65 // Set this as soon as the context is current, since we might call into GL.
66 SetRealGLApi(); 66 SetRealGLApi();
67 67
68 // Row 0 is at the top. 68 // Row 0 is at the top.
69 OSMesaPixelStore(OSMESA_Y_UP, 0); 69 OSMesaPixelStore(OSMESA_Y_UP, 0);
70 70
71 SetCurrent(surface); 71 SetCurrent(surface);
72 ScopedReleaseCurrent release_current(this, surface);
73
72 if (!InitializeDynamicBindings()) { 74 if (!InitializeDynamicBindings()) {
73 ReleaseCurrent(surface);
74 return false; 75 return false;
75 } 76 }
76 77
77 if (!surface->OnMakeCurrent(this)) { 78 if (!surface->OnMakeCurrent(this)) {
78 LOG(ERROR) << "Could not make current."; 79 LOG(ERROR) << "Could not make current.";
79 return false; 80 return false;
80 } 81 }
81 82
83 release_current.Release();
82 return true; 84 return true;
83 } 85 }
84 86
85 void GLContextOSMesa::ReleaseCurrent(GLSurface* surface) { 87 void GLContextOSMesa::ReleaseCurrent(GLSurface* surface) {
86 if (!IsCurrent(surface)) 88 if (!IsCurrent(surface))
87 return; 89 return;
88 90
89 SetCurrent(NULL); 91 SetCurrent(NULL);
90 OSMesaMakeCurrent(NULL, NULL, GL_UNSIGNED_BYTE, 0, 0); 92 OSMesaMakeCurrent(NULL, NULL, GL_UNSIGNED_BYTE, 0, 0);
91 } 93 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 125
124 void GLContextOSMesa::SetSwapInterval(int interval) { 126 void GLContextOSMesa::SetSwapInterval(int interval) {
125 DCHECK(IsCurrent(NULL)); 127 DCHECK(IsCurrent(NULL));
126 } 128 }
127 129
128 GLContextOSMesa::~GLContextOSMesa() { 130 GLContextOSMesa::~GLContextOSMesa() {
129 Destroy(); 131 Destroy();
130 } 132 }
131 133
132 } // namespace gfx 134 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698