Home | History | Annotate | Download | only in egl
      1 #ifndef _EGLUDEFS_HPP
      2 #define _EGLUDEFS_HPP
      3 /*-------------------------------------------------------------------------
      4  * drawElements Quality Program Tester Core
      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 EGL common defines and types
     24  *//*--------------------------------------------------------------------*/
     25 
     26 #include "tcuDefs.hpp"
     27 
     28 #define EGLU_CHECK(EGLW)			eglu::checkError((EGLW).getError(), DE_NULL, __FILE__, __LINE__)
     29 #define EGLU_CHECK_MSG(EGLW, MSG)	eglu::checkError((EGLW).getError(), MSG, __FILE__, __LINE__)
     30 #define EGLU_CHECK_CALL(EGLW, CALL)	do { (EGLW).CALL; eglu::checkError((EGLW).getError(), #CALL, __FILE__, __LINE__); } while (deGetFalse())
     31 
     32 /*--------------------------------------------------------------------*//*!
     33  * \brief EGL utilities
     34  *//*--------------------------------------------------------------------*/
     35 namespace eglu
     36 {
     37 
     38 class Error : public tcu::TestError
     39 {
     40 public:
     41 						Error			(deUint32 errCode, const char* errStr);
     42 						Error			(deUint32 errCode, const char* message, const char* expr, const char* file, int line);
     43 						~Error			(void) throw() {}
     44 
     45 	deUint32			getError		(void) const { return m_error; }
     46 
     47 private:
     48 	deUint32			m_error;
     49 };
     50 
     51 class BadAllocError : public tcu::ResourceError
     52 {
     53 public:
     54 						BadAllocError	(const char* errStr);
     55 						BadAllocError	(const char* message, const char* expr, const char* file, int line);
     56 						~BadAllocError	(void) throw() {}
     57 };
     58 
     59 void	checkError		(deUint32 err, const char* msg, const char* file, int line);
     60 
     61 class Version
     62 {
     63 public:
     64 						Version			(int major, int minor) : m_major(major), m_minor(minor) {}
     65 
     66 	int					getMajor		(void) const { return m_major; }
     67 	int					getMinor		(void) const { return m_minor; }
     68 
     69 	bool				operator<		(const Version& v) const;
     70 	bool				operator==		(const Version& v) const;
     71 
     72 	bool				operator!=		(const Version& v) const;
     73 	bool				operator>		(const Version& v) const;
     74 	bool				operator<=		(const Version& v) const;
     75 	bool				operator>=		(const Version& v) const;
     76 
     77 private:
     78 	int 				m_major;
     79 	int					m_minor;
     80 };
     81 
     82 } // eglu
     83 
     84 #endif // _EGLUDEFS_HPP
     85