Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / framework / egl / egluDefs.hpp
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 #define EGLU_CHECK_CALL_FPTR(EGLW, CALL)        do { CALL; eglu::checkError((EGLW).getError(), #CALL, __FILE__, __LINE__); } while (deGetFalse())
32
33 /*--------------------------------------------------------------------*//*!
34  * \brief EGL utilities
35  *//*--------------------------------------------------------------------*/
36 namespace eglu
37 {
38
39 class Error : public tcu::TestError
40 {
41 public:
42                                                 Error                   (deUint32 errCode, const char* errStr);
43                                                 Error                   (deUint32 errCode, const char* message, const char* expr, const char* file, int line);
44                                                 ~Error                  (void) throw() {}
45
46         deUint32                        getError                (void) const { return m_error; }
47
48 private:
49         deUint32                        m_error;
50 };
51
52 class BadAllocError : public tcu::ResourceError
53 {
54 public:
55                                                 BadAllocError   (const char* errStr);
56                                                 BadAllocError   (const char* message, const char* expr, const char* file, int line);
57                                                 ~BadAllocError  (void) throw() {}
58 };
59
60 void    checkError              (deUint32 err, const char* msg, const char* file, int line);
61
62 class Version
63 {
64 public:
65                                                 Version                 (int major, int minor) : m_major(major), m_minor(minor) {}
66
67         int                                     getMajor                (void) const { return m_major; }
68         int                                     getMinor                (void) const { return m_minor; }
69
70         bool                            operator<               (const Version& v) const;
71         bool                            operator==              (const Version& v) const;
72
73         bool                            operator!=              (const Version& v) const;
74         bool                            operator>               (const Version& v) const;
75         bool                            operator<=              (const Version& v) const;
76         bool                            operator>=              (const Version& v) const;
77
78 private:
79         int                                     m_major;
80         int                                     m_minor;
81 };
82
83 } // eglu
84
85 #endif // _EGLUDEFS_HPP