epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame^] | 1 | |
bsalomon@google.com | 27847de | 2011-02-22 20:59:41 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame^] | 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. |
bsalomon@google.com | 27847de | 2011-02-22 20:59:41 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame^] | 9 | |
bsalomon@google.com | 27847de | 2011-02-22 20:59:41 +0000 | [diff] [blame] | 10 | #include "GrGLConfig.h" |
bsalomon@google.com | f987d1b | 2011-04-04 17:13:52 +0000 | [diff] [blame] | 11 | #include "GrGLInterface.h" |
| 12 | |
| 13 | void GrGLClearErr() { |
| 14 | while (GR_GL_NO_ERROR != GrGLGetGLInterface()->fGetError()) {} |
| 15 | } |
bsalomon@google.com | 27847de | 2011-02-22 20:59:41 +0000 | [diff] [blame] | 16 | |
| 17 | void GrGLCheckErr(const char* location, const char* call) { |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 18 | uint32_t err = GrGLGetGLInterface()->fGetError(); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 19 | if (GR_GL_NO_ERROR != err) { |
bsalomon@google.com | 27847de | 2011-02-22 20:59:41 +0000 | [diff] [blame] | 20 | GrPrintf("---- glGetError %x", err); |
| 21 | if (NULL != location) { |
| 22 | GrPrintf(" at\n\t%s", location); |
| 23 | } |
| 24 | if (NULL != call) { |
| 25 | GrPrintf("\n\t\t%s", call); |
| 26 | } |
| 27 | GrPrintf("\n"); |
| 28 | } |
| 29 | } |
| 30 | |
bsalomon@google.com | f987d1b | 2011-04-04 17:13:52 +0000 | [diff] [blame] | 31 | void GrGLRestoreResetRowLength() { |
| 32 | if (GR_GL_SUPPORT_DESKTOP) { |
| 33 | GR_GL(PixelStorei(GR_GL_UNPACK_ROW_LENGTH, 0)); |
| 34 | } |
| 35 | } |
| 36 | |
bsalomon@google.com | 27847de | 2011-02-22 20:59:41 +0000 | [diff] [blame] | 37 | /////////////////////////////////////////////////////////////////////////////// |
| 38 | |
bsalomon@google.com | d5d1049 | 2011-04-28 21:16:31 +0000 | [diff] [blame] | 39 | #if GR_GL_LOG_CALLS |
| 40 | bool gLogCallsGL = !!(GR_GL_LOG_CALLS_START); |
| 41 | #endif |
bsalomon@google.com | 27847de | 2011-02-22 20:59:41 +0000 | [diff] [blame] | 42 | |
bsalomon@google.com | d5d1049 | 2011-04-28 21:16:31 +0000 | [diff] [blame] | 43 | #if GR_GL_CHECK_ERROR |
| 44 | bool gCheckErrorGL = !!(GR_GL_CHECK_ERROR_START); |
| 45 | #endif |
| 46 | |