blob: 5234453a10cd901ec0b83b1214ef712098db448e [file] [log] [blame]
bsalomon@google.com27847de2011-02-22 20:59:41 +00001/*
twiz@google.com59a190b2011-03-14 21:23:01 +00002 Copyright 2011 Google Inc.
bsalomon@google.com27847de2011-02-22 20:59:41 +00003
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"
bsalomon@google.comf987d1b2011-04-04 17:13:52 +000018#include "GrGLInterface.h"
19
20void GrGLClearErr() {
21 while (GR_GL_NO_ERROR != GrGLGetGLInterface()->fGetError()) {}
22}
bsalomon@google.com27847de2011-02-22 20:59:41 +000023
24void GrGLCheckErr(const char* location, const char* call) {
twiz@google.com59a190b2011-03-14 21:23:01 +000025 uint32_t err = GrGLGetGLInterface()->fGetError();
twiz@google.com0f31ca72011-03-18 17:38:11 +000026 if (GR_GL_NO_ERROR != err) {
bsalomon@google.com27847de2011-02-22 20:59:41 +000027 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
bsalomon@google.comf987d1b2011-04-04 17:13:52 +000038void GrGLRestoreResetRowLength() {
39 if (GR_GL_SUPPORT_DESKTOP) {
40 GR_GL(PixelStorei(GR_GL_UNPACK_ROW_LENGTH, 0));
41 }
42}
43
bsalomon@google.com27847de2011-02-22 20:59:41 +000044///////////////////////////////////////////////////////////////////////////////
45
46bool gLogCallsGL = !!(GR_GL_LOG_CALLS_START);
47
48bool gCheckErrorGL = !!(GR_GL_CHECK_ERROR_START);