Home | History | Annotate | Download | only in opengl
      1 #ifndef _GLUDEFS_HPP
      2 #define _GLUDEFS_HPP
      3 /*-------------------------------------------------------------------------
      4  * drawElements Quality Program OpenGL ES Utilities
      5  * ------------------------------------------------
      6  *
      7  * Copyright 2014 The Android Open Source Project
      8  *
      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
     12  *
     13  *      http://www.apache.org/licenses/LICENSE-2.0
     14  *
     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.
     20  *
     21  *//*!
     22  * \file
     23  * \brief OpenGL ES Test Utility Library.
     24  *//*--------------------------------------------------------------------*/
     25 
     26 #include "tcuDefs.hpp"
     27 
     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())
     35 
     36 
     37 /*--------------------------------------------------------------------*//*!
     38  * \brief OpenGL (ES) utilities
     39  *//*--------------------------------------------------------------------*/
     40 namespace glu
     41 {
     42 
     43 class RenderContext;
     44 
     45 class Error : public tcu::TestError
     46 {
     47 public:
     48 					Error				(int error, const char* message, const char* expr, const char* file, int line);
     49 					Error				(int error, const std::string& message);
     50 	virtual			~Error				(void) throw();
     51 
     52 	int				getError			(void) const { return m_error; }
     53 
     54 private:
     55 	int				m_error;
     56 };
     57 
     58 class OutOfMemoryError : public tcu::ResourceError
     59 {
     60 public:
     61 					OutOfMemoryError	(const char* message, const char* expr, const char* file, int line);
     62 					OutOfMemoryError	(const std::string& message);
     63 	virtual			~OutOfMemoryError	(void) throw();
     64 };
     65 
     66 void checkError (deUint32 err, const char* msg, const char* file, int line);
     67 void checkError (const RenderContext& context, const char* msg, const char* file, int line);
     68 
     69 } // glu
     70 
     71 #endif // _GLUDEFS_HPP
     72