blob: 5637cf3627f0cd12d9f7339ff1498fa08ba0508e [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
bsalomon@google.com27847de2011-02-22 20:59:41 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * 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.
bsalomon@google.com27847de2011-02-22 20:59:41 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
bsalomon@google.com27847de2011-02-22 20:59:41 +000010#include "GrGLConfig.h"
bsalomon@google.comf987d1b2011-04-04 17:13:52 +000011#include "GrGLInterface.h"
12
bsalomon@google.com0b77d682011-08-19 13:28:54 +000013void GrGLClearErr(const GrGLInterface* gl) {
14 while (GR_GL_NO_ERROR != gl->fGetError()) {}
bsalomon@google.comf987d1b2011-04-04 17:13:52 +000015}
bsalomon@google.com27847de2011-02-22 20:59:41 +000016
bsalomon@google.com0b77d682011-08-19 13:28:54 +000017void GrGLCheckErr(const GrGLInterface* gl,
18 const char* location,
19 const char* call) {
20 uint32_t err = GR_GL_GET_ERROR(gl);
twiz@google.com0f31ca72011-03-18 17:38:11 +000021 if (GR_GL_NO_ERROR != err) {
bsalomon@google.com0b77d682011-08-19 13:28:54 +000022 GrPrintf("---- glGetError %x", GR_GL_GET_ERROR(gl));
bsalomon@google.com27847de2011-02-22 20:59:41 +000023 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
bsalomon@google.com0b77d682011-08-19 13:28:54 +000033void GrGLResetRowLength(const GrGLInterface* gl) {
34 if (gl->supportsDesktop()) {
35 GR_GL_CALL(gl, PixelStorei(GR_GL_UNPACK_ROW_LENGTH, 0));
bsalomon@google.comf987d1b2011-04-04 17:13:52 +000036 }
37}
38
bsalomon@google.com27847de2011-02-22 20:59:41 +000039///////////////////////////////////////////////////////////////////////////////
40
bsalomon@google.comd5d10492011-04-28 21:16:31 +000041#if GR_GL_LOG_CALLS
42 bool gLogCallsGL = !!(GR_GL_LOG_CALLS_START);
43#endif
bsalomon@google.com27847de2011-02-22 20:59:41 +000044
bsalomon@google.comd5d10492011-04-28 21:16:31 +000045#if GR_GL_CHECK_ERROR
46 bool gCheckErrorGL = !!(GR_GL_CHECK_ERROR_START);
47#endif
48