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) \ 31 do \ 32 { \ 33 (EGLW).CALL; \ 34 eglu::checkError((EGLW).getError(), #CALL, __FILE__, __LINE__); \ 35 } while (false) 36 #define EGLU_CHECK_CALL_FPTR(EGLW, CALL) \ 37 do \ 38 { \ 39 CALL; \ 40 eglu::checkError((EGLW).getError(), #CALL, __FILE__, __LINE__); \ 41 } while (false) 42 43 /*--------------------------------------------------------------------*//*! 44 * \brief EGL utilities 45 *//*--------------------------------------------------------------------*/ 46 namespace eglu 47 { 48 49 class Error : public tcu::TestError 50 { 51 public: 52 Error(uint32_t errCode, const char *errStr); 53 Error(uint32_t errCode, const char *message, const char *expr, const char *file, int line); ~Error(void)54 ~Error(void) throw() 55 { 56 } 57 getError(void) const58 uint32_t getError(void) const 59 { 60 return m_error; 61 } 62 63 private: 64 uint32_t m_error; 65 }; 66 67 class BadAllocError : public tcu::ResourceError 68 { 69 public: 70 BadAllocError(const char *errStr); 71 BadAllocError(const char *message, const char *expr, const char *file, int line); ~BadAllocError(void)72 ~BadAllocError(void) throw() 73 { 74 } 75 }; 76 77 void checkError(uint32_t err, const char *msg, const char *file, int line); 78 79 class Version 80 { 81 public: Version(int major,int minor)82 Version(int major, int minor) : m_major(major), m_minor(minor) 83 { 84 } 85 getMajor(void) const86 int getMajor(void) const 87 { 88 return m_major; 89 } getMinor(void) const90 int getMinor(void) const 91 { 92 return m_minor; 93 } 94 95 bool operator<(const Version &v) const; 96 bool operator==(const Version &v) const; 97 98 bool operator!=(const Version &v) const; 99 bool operator>(const Version &v) const; 100 bool operator<=(const Version &v) const; 101 bool operator>=(const Version &v) const; 102 103 private: 104 int m_major; 105 int m_minor; 106 }; 107 108 } // namespace eglu 109 110 #endif // _EGLUDEFS_HPP 111