1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES Utilities
3 * ------------------------------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief OpenGL ES Test Utility Library.
22 *//*--------------------------------------------------------------------*/
24 #include "gluDefs.hpp"
25 #include "gluRenderContext.hpp"
26 #include "gluStrUtil.hpp"
27 #include "glwFunctions.hpp"
28 #include "glwEnums.hpp"
35 Error::Error (int error, const char* message, const char* expr, const char* file, int line)
36 : tcu::TestError (message, expr, file, line)
41 Error::Error (int error, const std::string& message)
42 : tcu::TestError (message)
47 Error::~Error (void) throw()
51 OutOfMemoryError::OutOfMemoryError (const char* message, const char* expr, const char* file, int line)
52 : tcu::ResourceError(message, expr, file, line)
56 OutOfMemoryError::OutOfMemoryError (const std::string& message)
57 : tcu::ResourceError(message)
61 OutOfMemoryError::~OutOfMemoryError (void) throw()
65 void checkError (const RenderContext& context, const char* msg, const char* file, int line)
67 checkError(context.getFunctions().getError(), msg, file, line);
70 void checkError (deUint32 err, const char* msg, const char* file, int line)
72 if (err != GL_NO_ERROR)
74 std::ostringstream msgStr;
76 msgStr << msg << ": ";
78 msgStr << "glGetError() returned " << getErrorStr(err);
80 if (err == GL_OUT_OF_MEMORY)
81 throw OutOfMemoryError(msgStr.str().c_str(), DE_NULL, file, line);
83 throw Error(err, msgStr.str().c_str(), DE_NULL, file, line);