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

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

Issue 135213003: Ensure GL initialization only happens once, and provide common init path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: initgl: compile3 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 | « ui/compositor/test/test_suite.cc ('k') | 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void DriverGL::InitializeCustomDynamicBindings(GLContext* context) { 149 void DriverGL::InitializeCustomDynamicBindings(GLContext* context) {
150 InitializeDynamicBindings(context); 150 InitializeDynamicBindings(context);
151 orig_fn = fn; 151
152 DCHECK(orig_fn.glTexImage2DFn == NULL);
153 orig_fn.glTexImage2DFn = fn.glTexImage2DFn;
152 fn.glTexImage2DFn = 154 fn.glTexImage2DFn =
153 reinterpret_cast<glTexImage2DProc>(CustomTexImage2D); 155 reinterpret_cast<glTexImage2DProc>(CustomTexImage2D);
156
157 DCHECK(orig_fn.glTexSubImage2DFn == NULL);
158 orig_fn.glTexSubImage2DFn = fn.glTexSubImage2DFn;
154 fn.glTexSubImage2DFn = 159 fn.glTexSubImage2DFn =
155 reinterpret_cast<glTexSubImage2DProc>(CustomTexSubImage2D); 160 reinterpret_cast<glTexSubImage2DProc>(CustomTexSubImage2D);
161
162 DCHECK(orig_fn.glTexStorage2DEXTFn == NULL);
163 orig_fn.glTexStorage2DEXTFn = fn.glTexStorage2DEXTFn;
156 fn.glTexStorage2DEXTFn = 164 fn.glTexStorage2DEXTFn =
157 reinterpret_cast<glTexStorage2DEXTProc>(CustomTexStorage2DEXT); 165 reinterpret_cast<glTexStorage2DEXTProc>(CustomTexStorage2DEXT);
166
167 DCHECK(orig_fn.glRenderbufferStorageEXTFn == NULL);
168 orig_fn.glRenderbufferStorageEXTFn = fn.glRenderbufferStorageEXTFn;
158 fn.glRenderbufferStorageEXTFn = 169 fn.glRenderbufferStorageEXTFn =
159 reinterpret_cast<glRenderbufferStorageEXTProc>( 170 reinterpret_cast<glRenderbufferStorageEXTProc>(
160 CustomRenderbufferStorageEXT); 171 CustomRenderbufferStorageEXT);
172
173 DCHECK(orig_fn.glRenderbufferStorageMultisampleEXTFn == NULL);
174 orig_fn.glRenderbufferStorageMultisampleEXTFn =
175 fn.glRenderbufferStorageMultisampleEXTFn;
161 fn.glRenderbufferStorageMultisampleEXTFn = 176 fn.glRenderbufferStorageMultisampleEXTFn =
162 reinterpret_cast<glRenderbufferStorageMultisampleEXTProc>( 177 reinterpret_cast<glRenderbufferStorageMultisampleEXTProc>(
163 CustomRenderbufferStorageMultisampleEXT); 178 CustomRenderbufferStorageMultisampleEXT);
164 } 179 }
165 180
166 void InitializeStaticGLBindingsGL() { 181 void InitializeStaticGLBindingsGL() {
167 g_current_gl_context_tls = new base::ThreadLocalPointer<GLApi>; 182 g_current_gl_context_tls = new base::ThreadLocalPointer<GLApi>;
168 g_driver_gl.InitializeStaticBindings(); 183 g_driver_gl.InitializeStaticBindings();
169 if (!g_real_gl) { 184 if (!g_real_gl) {
170 g_real_gl = new RealGLApi(); 185 g_real_gl = new RealGLApi();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 const GLubyte* VirtualGLApi::glGetStringFn(GLenum name) { 350 const GLubyte* VirtualGLApi::glGetStringFn(GLenum name) {
336 switch (name) { 351 switch (name) {
337 case GL_EXTENSIONS: 352 case GL_EXTENSIONS:
338 return reinterpret_cast<const GLubyte*>(extensions_.c_str()); 353 return reinterpret_cast<const GLubyte*>(extensions_.c_str());
339 default: 354 default:
340 return driver_->fn.glGetStringFn(name); 355 return driver_->fn.glGetStringFn(name);
341 } 356 }
342 } 357 }
343 358
344 } // namespace gfx 359 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/compositor/test/test_suite.cc ('k') | ui/gl/gl_implementation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698