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

Side by Side Diff: trunk/src/ui/gl/gl_gl_api_implementation.cc

Issue 149953003: Revert 247793 "Ensure GL initialization only happens once, and p..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 10 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
« no previous file with comments | « trunk/src/ui/gl/gl_bindings.h ('k') | trunk/src/ui/gl/gl_implementation.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 #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
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
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
OLDNEW
« no previous file with comments | « trunk/src/ui/gl/gl_bindings.h ('k') | trunk/src/ui/gl/gl_implementation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698