1 /*
2 Copyright 2011 Google Inc.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16
17 #include "GrGLConfig.h"
18 #include "GrGLInterface.h"
19
GrGLClearErr()20 void GrGLClearErr() {
21 while (GR_GL_NO_ERROR != GrGLGetGLInterface()->fGetError()) {}
22 }
23
GrGLCheckErr(const char * location,const char * call)24 void GrGLCheckErr(const char* location, const char* call) {
25 uint32_t err = GrGLGetGLInterface()->fGetError();
26 if (GR_GL_NO_ERROR != err) {
27 GrPrintf("---- glGetError %x", err);
28 if (NULL != location) {
29 GrPrintf(" at\n\t%s", location);
30 }
31 if (NULL != call) {
32 GrPrintf("\n\t\t%s", call);
33 }
34 GrPrintf("\n");
35 }
36 }
37
GrGLRestoreResetRowLength()38 void GrGLRestoreResetRowLength() {
39 if (GR_GL_SUPPORT_DESKTOP) {
40 GR_GL(PixelStorei(GR_GL_UNPACK_ROW_LENGTH, 0));
41 }
42 }
43
44 ///////////////////////////////////////////////////////////////////////////////
45
46 #if GR_GL_LOG_CALLS
47 bool gLogCallsGL = !!(GR_GL_LOG_CALLS_START);
48 #endif
49
50 #if GR_GL_CHECK_ERROR
51 bool gCheckErrorGL = !!(GR_GL_CHECK_ERROR_START);
52 #endif
53
54