3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program OpenGL ES Utilities
5 * ------------------------------------------------
7 * Copyright 2014 The Android Open Source Project
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief OpenGL ES Test Utility Library.
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
28 // Macros for checking API errors.
29 #define GLU_EXPECT_NO_ERROR(ERR, MSG) glu::checkError((ERR), MSG, __FILE__, __LINE__)
30 #define GLU_CHECK_ERROR(ERR) GLU_EXPECT_NO_ERROR(ERR, DE_NULL)
31 #define GLU_CHECK_MSG(MSG) GLU_EXPECT_NO_ERROR(glGetError(), MSG)
32 #define GLU_CHECK() GLU_CHECK_MSG(DE_NULL)
33 #define GLU_CHECK_CALL_ERROR(CALL, ERR) do { CALL; GLU_EXPECT_NO_ERROR(ERR, #CALL); } while (deGetFalse())
34 #define GLU_CHECK_CALL(CALL) do { CALL; GLU_EXPECT_NO_ERROR(glGetError(), #CALL); } while (deGetFalse())
36 #define GLU_CHECK_GLW_MSG(GL, MSG) GLU_EXPECT_NO_ERROR((GL).getError(), MSG)
37 #define GLU_CHECK_GLW(GL) GLU_CHECK_GLW_MSG(GL, DE_NULL)
38 #define GLU_CHECK_GLW_CALL(GL, CALL) do { (GL).CALL; GLU_EXPECT_NO_ERROR((GL).getError(), #CALL); } while (deGetFalse())
40 /*--------------------------------------------------------------------*//*!
41 * \brief OpenGL (ES) utilities
42 *//*--------------------------------------------------------------------*/
48 class Error : public tcu::TestError
51 Error (int error, const char* message, const char* expr, const char* file, int line);
52 Error (int error, const std::string& message);
53 virtual ~Error (void) throw();
55 int getError (void) const { return m_error; }
61 class OutOfMemoryError : public tcu::ResourceError
64 OutOfMemoryError (const char* message, const char* expr, const char* file, int line);
65 OutOfMemoryError (const std::string& message);
66 virtual ~OutOfMemoryError (void) throw();
69 void checkError (deUint32 err, const char* msg, const char* file, int line);
70 void checkError (const RenderContext& context, const char* msg, const char* file, int line);
74 #endif // _GLUDEFS_HPP