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

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

Issue 2664123003: gl_gl_api_implementation: Check API type instead of null fnptr (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | 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 <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 430
431 void RealGLApi::glDrawElementsFn(GLenum mode, 431 void RealGLApi::glDrawElementsFn(GLenum mode,
432 GLsizei count, 432 GLsizei count,
433 GLenum type, 433 GLenum type,
434 const void* indices) { 434 const void* indices) {
435 if (!g_null_draw_bindings_enabled) 435 if (!g_null_draw_bindings_enabled)
436 GLApiBase::glDrawElementsFn(mode, count, type, indices); 436 GLApiBase::glDrawElementsFn(mode, count, type, indices);
437 } 437 }
438 438
439 void RealGLApi::glClearDepthFn(GLclampd depth) { 439 void RealGLApi::glClearDepthFn(GLclampd depth) {
440 if (driver_->fn.glClearDepthFn) { 440 // OpenGL ES only has glClearDepthf, forward the parameters from glClearDepth.
441 GLApiBase::glClearDepthFn(depth); 441 // Many mock tests expect only glClearDepth is called so don't make the
442 } else { 442 // interception when testing with mocks.
443 if (version_->is_es && GetGLImplementation() != kGLImplementationMockGL) {
443 DCHECK(driver_->fn.glClearDepthfFn); 444 DCHECK(driver_->fn.glClearDepthfFn);
444 GLApiBase::glClearDepthfFn(static_cast<GLclampf>(depth)); 445 GLApiBase::glClearDepthfFn(static_cast<GLclampf>(depth));
446 } else {
447 DCHECK(driver_->fn.glClearDepthFn);
448 GLApiBase::glClearDepthFn(depth);
445 } 449 }
446 } 450 }
447 451
448 void RealGLApi::glDepthRangeFn(GLclampd z_near, GLclampd z_far) { 452 void RealGLApi::glDepthRangeFn(GLclampd z_near, GLclampd z_far) {
449 if (driver_->fn.glDepthRangeFn) { 453 // OpenGL ES only has glDepthRangef, forward the parameters from glDepthRange.
450 GLApiBase::glDepthRangeFn(z_near, z_far); 454 // Many mock tests expect only glDepthRange is called so don't make the
451 } else { 455 // interception when testing with mocks.
456 if (version_->is_es && GetGLImplementation() != kGLImplementationMockGL) {
457 DCHECK(driver_->fn.glDepthRangefFn);
452 GLApiBase::glDepthRangefFn(static_cast<GLclampf>(z_near), 458 GLApiBase::glDepthRangefFn(static_cast<GLclampf>(z_near),
453 static_cast<GLclampf>(z_far)); 459 static_cast<GLclampf>(z_far));
460 } else {
461 DCHECK(driver_->fn.glDepthRangeFn);
462 GLApiBase::glDepthRangeFn(z_near, z_far);
454 } 463 }
455 } 464 }
456 465
457 void RealGLApi::InitializeFilteredExtensions() { 466 void RealGLApi::InitializeFilteredExtensions() {
458 if (disabled_exts_.size()) { 467 if (disabled_exts_.size()) {
459 filtered_exts_.clear(); 468 filtered_exts_.clear();
460 if (WillUseGLGetStringForExtensions(this)) { 469 if (WillUseGLGetStringForExtensions(this)) {
461 filtered_exts_str_ = 470 filtered_exts_str_ =
462 FilterGLExtensionList(reinterpret_cast<const char*>( 471 FilterGLExtensionList(reinterpret_cast<const char*>(
463 GLApiBase::glGetStringFn(GL_EXTENSIONS)), 472 GLApiBase::glGetStringFn(GL_EXTENSIONS)),
(...skipping 29 matching lines...) Expand all
493 502
494 DebugGLApi::~DebugGLApi() {} 503 DebugGLApi::~DebugGLApi() {}
495 504
496 NoContextGLApi::NoContextGLApi() { 505 NoContextGLApi::NoContextGLApi() {
497 } 506 }
498 507
499 NoContextGLApi::~NoContextGLApi() { 508 NoContextGLApi::~NoContextGLApi() {
500 } 509 }
501 510
502 } // namespace gl 511 } // namespace gl
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698