| OLD | NEW |
| 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_gl_api_implementation.h" | 5 #include "ui/gl/gl_gl_api_implementation.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" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 g_gl = g_trace_gl; | 155 g_gl = g_trace_gl; |
| 156 } | 156 } |
| 157 SetGLToRealGLApi(); | 157 SetGLToRealGLApi(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 GLApi* GetCurrentGLApi() { | 160 GLApi* GetCurrentGLApi() { |
| 161 return g_current_gl_context; | 161 return g_current_gl_context; |
| 162 } | 162 } |
| 163 | 163 |
| 164 void SetGLApi(GLApi* api) { | 164 void SetGLApi(GLApi* api) { |
| 165 g_current_gl_context = api; | 165 g_current_gl_context_tls.Pointer()->Set(api); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void SetGLToRealGLApi() { | 168 void SetGLToRealGLApi() { |
| 169 SetGLApi(g_gl); | 169 SetGLApi(g_gl); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void InitializeGLExtensionBindingsGL(GLContext* context) { | 172 void InitializeGLExtensionBindingsGL(GLContext* context) { |
| 173 g_driver_gl.InitializeExtensions(context); | 173 g_driver_gl.InitializeExtensions(context); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void InitializeDebugGLBindingsGL() { | 176 void InitializeDebugGLBindingsGL() { |
| 177 g_driver_gl.InitializeDebugBindings(); | 177 g_driver_gl.InitializeDebugBindings(); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void ClearGLBindingsGL() { | 180 void ClearGLBindingsGL() { |
| 181 if (g_real_gl) { | 181 if (g_real_gl) { |
| 182 delete g_real_gl; | 182 delete g_real_gl; |
| 183 g_real_gl = NULL; | 183 g_real_gl = NULL; |
| 184 } | 184 } |
| 185 if (g_trace_gl) { | 185 if (g_trace_gl) { |
| 186 delete g_trace_gl; | 186 delete g_trace_gl; |
| 187 g_trace_gl = NULL; | 187 g_trace_gl = NULL; |
| 188 } | 188 } |
| 189 g_gl = NULL; | 189 g_gl = NULL; |
| 190 g_current_gl_context = NULL; | |
| 191 g_driver_gl.ClearBindings(); | 190 g_driver_gl.ClearBindings(); |
| 192 } | 191 } |
| 193 | 192 |
| 194 GLApi::GLApi() { | 193 GLApi::GLApi() { |
| 195 } | 194 } |
| 196 | 195 |
| 197 GLApi::~GLApi() { | 196 GLApi::~GLApi() { |
| 198 if (GetCurrentGLApi() == this) | 197 if (GetCurrentGLApi() == this) |
| 199 SetGLApi(NULL); | 198 SetGLApi(NULL); |
| 200 } | 199 } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 const GLubyte* VirtualGLApi::glGetStringFn(GLenum name) { | 305 const GLubyte* VirtualGLApi::glGetStringFn(GLenum name) { |
| 307 switch (name) { | 306 switch (name) { |
| 308 case GL_EXTENSIONS: | 307 case GL_EXTENSIONS: |
| 309 return reinterpret_cast<const GLubyte*>(extensions_.c_str()); | 308 return reinterpret_cast<const GLubyte*>(extensions_.c_str()); |
| 310 default: | 309 default: |
| 311 return driver_->fn.glGetStringFn(name); | 310 return driver_->fn.glGetStringFn(name); |
| 312 } | 311 } |
| 313 } | 312 } |
| 314 | 313 |
| 315 } // namespace gfx | 314 } // namespace gfx |
| OLD | NEW |