egluDefs.hpp revision 3c827367444ee418f129b2c238299f49d3264554
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#include <vector> 29#include <string> 30 31#define EGLU_CHECK() eglu::checkError(DE_NULL, __FILE__, __LINE__) 32#define EGLU_CHECK_MSG(MSG) eglu::checkError(MSG, __FILE__, __LINE__) 33#define EGLU_CHECK_CALL(CALL) do { CALL; eglu::checkError(#CALL, __FILE__, __LINE__); } while (deGetFalse()) 34 35/*--------------------------------------------------------------------*//*! 36 * \brief EGL utilities 37 *//*--------------------------------------------------------------------*/ 38namespace eglu 39{ 40 41class Error : public tcu::TestError 42{ 43public: 44 Error (deInt32 errCode, const char* errStr); 45 Error (deInt32 errCode, const char* message, const char* expr, const char* file, int line); 46 ~Error (void) throw() {} 47 48 deInt32 getError (void) const { return m_error; } 49 50private: 51 deInt32 m_error; 52}; 53 54class BadAllocError : public tcu::ResourceError 55{ 56public: 57 BadAllocError (const char* errStr); 58 BadAllocError (const char* message, const char* expr, const char* file, int line); 59 ~BadAllocError (void) throw() {} 60}; 61 62void checkError (const char* msg, const char* file, int line); 63 64class Version 65{ 66public: 67 Version (int major, int minor) : m_major(major), m_minor(minor) {} 68 69 int getMajor (void) const { return m_major; } 70 int getMinor (void) const { return m_minor; } 71 72 bool operator< (const Version& v) const; 73 bool operator== (const Version& v) const; 74 75 bool operator!= (const Version& v) const; 76 bool operator> (const Version& v) const; 77 bool operator<= (const Version& v) const; 78 bool operator>= (const Version& v) const; 79 80private: 81 int m_major; 82 int m_minor; 83}; 84 85} // eglu 86 87#endif // _EGLUDEFS_HPP 88