bsalomon@google.com | 27847de | 2011-02-22 20:59:41 +0000 | [diff] [blame] | 1 | /* |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 2 | Copyright 2011 Google Inc. |
bsalomon@google.com | 27847de | 2011-02-22 20:59:41 +0000 | [diff] [blame] | 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" |
bsalomon@google.com | f987d1b | 2011-04-04 17:13:52 +0000 | [diff] [blame^] | 18 | #include "GrGLInterface.h" |
| 19 | |
| 20 | void GrGLClearErr() { |
| 21 | while (GR_GL_NO_ERROR != GrGLGetGLInterface()->fGetError()) {} |
| 22 | } |
bsalomon@google.com | 27847de | 2011-02-22 20:59:41 +0000 | [diff] [blame] | 23 | |
| 24 | void GrGLCheckErr(const char* location, const char* call) { |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 25 | uint32_t err = GrGLGetGLInterface()->fGetError(); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 26 | if (GR_GL_NO_ERROR != err) { |
bsalomon@google.com | 27847de | 2011-02-22 20:59:41 +0000 | [diff] [blame] | 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 | |
bsalomon@google.com | f987d1b | 2011-04-04 17:13:52 +0000 | [diff] [blame^] | 38 | void GrGLRestoreResetRowLength() { |
| 39 | if (GR_GL_SUPPORT_DESKTOP) { |
| 40 | GR_GL(PixelStorei(GR_GL_UNPACK_ROW_LENGTH, 0)); |
| 41 | } |
| 42 | } |
| 43 | |
bsalomon@google.com | 27847de | 2011-02-22 20:59:41 +0000 | [diff] [blame] | 44 | /////////////////////////////////////////////////////////////////////////////// |
| 45 | |
| 46 | bool gLogCallsGL = !!(GR_GL_LOG_CALLS_START); |
| 47 | |
| 48 | bool gCheckErrorGL = !!(GR_GL_CHECK_ERROR_START); |