1 2 /* 3 * Copyright 2011 Google Inc. 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9 10 #include "gl/GrGLConfig.h" 11 #include "gl/GrGLInterface.h" 12 13 void GrGLClearErr(const GrGLInterface* gl) { 14 while (GR_GL_NO_ERROR != gl->fGetError()) {} 15 } 16 17 void GrGLCheckErr(const GrGLInterface* gl, 18 const char* location, 19 const char* call) { 20 uint32_t err = GR_GL_GET_ERROR(gl); 21 if (GR_GL_NO_ERROR != err) { 22 GrPrintf("---- glGetError %x", err); 23 if (NULL != location) { 24 GrPrintf(" at\n\t%s", location); 25 } 26 if (NULL != call) { 27 GrPrintf("\n\t\t%s", call); 28 } 29 GrPrintf("\n"); 30 } 31 } 32 33 /////////////////////////////////////////////////////////////////////////////// 34 35 #if GR_GL_LOG_CALLS 36 bool gLogCallsGL = !!(GR_GL_LOG_CALLS_START); 37 #endif 38 39 #if GR_GL_CHECK_ERROR 40 bool gCheckErrorGL = !!(GR_GL_CHECK_ERROR_START); 41 #endif 42 43