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

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

Issue 1203513004: Respect the disabled extension list during binding initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split extension binding loading from static binding loading; pass enabled extensions Created 5 years, 6 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
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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, 204 GLenum target, GLsizei samples, GLenum internalformat, GLsizei width,
205 GLsizei height) { 205 GLsizei height) {
206 GLenum gl_internal_format = GetInternalFormat(internalformat); 206 GLenum gl_internal_format = GetInternalFormat(internalformat);
207 g_driver_gl.orig_fn.glRenderbufferStorageMultisampleEXTFn( 207 g_driver_gl.orig_fn.glRenderbufferStorageMultisampleEXTFn(
208 target, samples, gl_internal_format, width, height); 208 target, samples, gl_internal_format, width, height);
209 } 209 }
210 210
211 } // anonymous namespace 211 } // anonymous namespace
212 212
213 void DriverGL::InitializeCustomDynamicBindings(GLContext* context) { 213 void DriverGL::InitializeCustomDynamicBindings(GLContext* context) {
214 InitializeDynamicBindings(context); 214 InitializeExtensionBindings(context,
215 g_real_gl->GetEnabledExtensions(context));
215 216
216 DCHECK(orig_fn.glTexImage2DFn == NULL); 217 DCHECK(orig_fn.glTexImage2DFn == NULL);
217 orig_fn.glTexImage2DFn = fn.glTexImage2DFn; 218 orig_fn.glTexImage2DFn = fn.glTexImage2DFn;
218 fn.glTexImage2DFn = 219 fn.glTexImage2DFn =
219 reinterpret_cast<glTexImage2DProc>(CustomTexImage2D); 220 reinterpret_cast<glTexImage2DProc>(CustomTexImage2D);
220 221
221 DCHECK(orig_fn.glTexSubImage2DFn == NULL); 222 DCHECK(orig_fn.glTexSubImage2DFn == NULL);
222 orig_fn.glTexSubImage2DFn = fn.glTexSubImage2DFn; 223 orig_fn.glTexSubImage2DFn = fn.glTexSubImage2DFn;
223 fn.glTexSubImage2DFn = 224 fn.glTexSubImage2DFn =
224 reinterpret_cast<glTexSubImage2DProc>(CustomTexSubImage2D); 225 reinterpret_cast<glTexSubImage2DProc>(CustomTexSubImage2D);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 const GLubyte* RealGLApi::glGetStringiFn(GLenum name, GLuint index) { 444 const GLubyte* RealGLApi::glGetStringiFn(GLenum name, GLuint index) {
444 if (!filtered_exts_str_.empty() && name == GL_EXTENSIONS) { 445 if (!filtered_exts_str_.empty() && name == GL_EXTENSIONS) {
445 if (index >= filtered_exts_.size()) { 446 if (index >= filtered_exts_.size()) {
446 return NULL; 447 return NULL;
447 } 448 }
448 return reinterpret_cast<const GLubyte*>(filtered_exts_[index].c_str()); 449 return reinterpret_cast<const GLubyte*>(filtered_exts_[index].c_str());
449 } 450 }
450 return GLApiBase::glGetStringiFn(name, index); 451 return GLApiBase::glGetStringiFn(name, index);
451 } 452 }
452 453
454 std::set<std::string> RealGLApi::GetEnabledExtensions(
455 GLContext* context) const {
456 std::set<std::string> enabled_extensions;
457
458 std::vector<std::string> platform_extensions_vec;
459 std::string platform_ext = context->GetExtensions();
460 base::SplitString(platform_ext, ' ', &platform_extensions_vec);
461
462 enabled_extensions.insert(platform_extensions_vec.begin(),
463 platform_extensions_vec.end());
464
465 for (auto ext : disabled_exts_) {
466 enabled_extensions.erase(ext);
467 }
468
469 return enabled_extensions;
470 }
471
453 void RealGLApi::glFlushFn() { 472 void RealGLApi::glFlushFn() {
454 GLApiBase::glFlushFn(); 473 GLApiBase::glFlushFn();
455 } 474 }
456 475
457 void RealGLApi::glFinishFn() { 476 void RealGLApi::glFinishFn() {
458 GLApiBase::glFinishFn(); 477 GLApiBase::glFinishFn();
459 } 478 }
460 479
461 void RealGLApi::InitializeFilteredExtensions() { 480 void RealGLApi::InitializeFilteredExtensions() {
462 if (!disabled_exts_.empty() && filtered_exts_.empty()) { 481 if (!disabled_exts_.empty() && filtered_exts_.empty()) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 ScopedSetGLToRealGLApi::ScopedSetGLToRealGLApi() 628 ScopedSetGLToRealGLApi::ScopedSetGLToRealGLApi()
610 : old_gl_api_(GetCurrentGLApi()) { 629 : old_gl_api_(GetCurrentGLApi()) {
611 SetGLToRealGLApi(); 630 SetGLToRealGLApi();
612 } 631 }
613 632
614 ScopedSetGLToRealGLApi::~ScopedSetGLToRealGLApi() { 633 ScopedSetGLToRealGLApi::~ScopedSetGLToRealGLApi() {
615 SetGLApi(old_gl_api_); 634 SetGLApi(old_gl_api_);
616 } 635 }
617 636
618 } // namespace gfx 637 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698