| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 static void GL_BINDING_CALL CustomRenderbufferStorageMultisampleEXT( | 139 static void GL_BINDING_CALL CustomRenderbufferStorageMultisampleEXT( |
| 140 GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, | 140 GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, |
| 141 GLsizei height) { | 141 GLsizei height) { |
| 142 GLenum gl_internal_format = GetInternalFormat(internalformat); | 142 GLenum gl_internal_format = GetInternalFormat(internalformat); |
| 143 return g_driver_gl.orig_fn.glRenderbufferStorageMultisampleEXTFn( | 143 return g_driver_gl.orig_fn.glRenderbufferStorageMultisampleEXTFn( |
| 144 target, samples, gl_internal_format, width, height); | 144 target, samples, gl_internal_format, width, height); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // anonymous namespace | 147 } // anonymous namespace |
| 148 | 148 |
| 149 DriverGL::DriverGL() { ClearBindings(); } | |
| 150 | |
| 151 void DriverGL::InitializeCustomDynamicBindings(GLContext* context) { | 149 void DriverGL::InitializeCustomDynamicBindings(GLContext* context) { |
| 152 InitializeDynamicBindings(context); | 150 InitializeDynamicBindings(context); |
| 153 | 151 orig_fn = fn; |
| 154 DCHECK(orig_fn.glTexImage2DFn == NULL); | |
| 155 orig_fn.glTexImage2DFn = fn.glTexImage2DFn; | |
| 156 fn.glTexImage2DFn = | 152 fn.glTexImage2DFn = |
| 157 reinterpret_cast<glTexImage2DProc>(CustomTexImage2D); | 153 reinterpret_cast<glTexImage2DProc>(CustomTexImage2D); |
| 158 | |
| 159 DCHECK(orig_fn.glTexSubImage2DFn == NULL); | |
| 160 orig_fn.glTexSubImage2DFn = fn.glTexSubImage2DFn; | |
| 161 fn.glTexSubImage2DFn = | 154 fn.glTexSubImage2DFn = |
| 162 reinterpret_cast<glTexSubImage2DProc>(CustomTexSubImage2D); | 155 reinterpret_cast<glTexSubImage2DProc>(CustomTexSubImage2D); |
| 163 | |
| 164 DCHECK(orig_fn.glTexStorage2DEXTFn == NULL); | |
| 165 orig_fn.glTexStorage2DEXTFn = fn.glTexStorage2DEXTFn; | |
| 166 fn.glTexStorage2DEXTFn = | 156 fn.glTexStorage2DEXTFn = |
| 167 reinterpret_cast<glTexStorage2DEXTProc>(CustomTexStorage2DEXT); | 157 reinterpret_cast<glTexStorage2DEXTProc>(CustomTexStorage2DEXT); |
| 168 | |
| 169 DCHECK(orig_fn.glRenderbufferStorageEXTFn == NULL); | |
| 170 orig_fn.glRenderbufferStorageEXTFn = fn.glRenderbufferStorageEXTFn; | |
| 171 fn.glRenderbufferStorageEXTFn = | 158 fn.glRenderbufferStorageEXTFn = |
| 172 reinterpret_cast<glRenderbufferStorageEXTProc>( | 159 reinterpret_cast<glRenderbufferStorageEXTProc>( |
| 173 CustomRenderbufferStorageEXT); | 160 CustomRenderbufferStorageEXT); |
| 174 | |
| 175 DCHECK(orig_fn.glRenderbufferStorageMultisampleEXTFn == NULL); | |
| 176 orig_fn.glRenderbufferStorageMultisampleEXTFn = | |
| 177 fn.glRenderbufferStorageMultisampleEXTFn; | |
| 178 fn.glRenderbufferStorageMultisampleEXTFn = | 161 fn.glRenderbufferStorageMultisampleEXTFn = |
| 179 reinterpret_cast<glRenderbufferStorageMultisampleEXTProc>( | 162 reinterpret_cast<glRenderbufferStorageMultisampleEXTProc>( |
| 180 CustomRenderbufferStorageMultisampleEXT); | 163 CustomRenderbufferStorageMultisampleEXT); |
| 181 } | 164 } |
| 182 | 165 |
| 183 void InitializeStaticGLBindingsGL() { | 166 void InitializeStaticGLBindingsGL() { |
| 184 g_current_gl_context_tls = new base::ThreadLocalPointer<GLApi>; | 167 g_current_gl_context_tls = new base::ThreadLocalPointer<GLApi>; |
| 185 g_driver_gl.InitializeStaticBindings(); | 168 g_driver_gl.InitializeStaticBindings(); |
| 186 if (!g_real_gl) { | 169 if (!g_real_gl) { |
| 187 g_real_gl = new RealGLApi(); | 170 g_real_gl = new RealGLApi(); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 const GLubyte* VirtualGLApi::glGetStringFn(GLenum name) { | 335 const GLubyte* VirtualGLApi::glGetStringFn(GLenum name) { |
| 353 switch (name) { | 336 switch (name) { |
| 354 case GL_EXTENSIONS: | 337 case GL_EXTENSIONS: |
| 355 return reinterpret_cast<const GLubyte*>(extensions_.c_str()); | 338 return reinterpret_cast<const GLubyte*>(extensions_.c_str()); |
| 356 default: | 339 default: |
| 357 return driver_->fn.glGetStringFn(name); | 340 return driver_->fn.glGetStringFn(name); |
| 358 } | 341 } |
| 359 } | 342 } |
| 360 | 343 |
| 361 } // namespace gfx | 344 } // namespace gfx |
| OLD | NEW |