1 #ifndef _TCUPLATFORM_HPP
2 #define _TCUPLATFORM_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 Platform (OS) specific services.
24  *//*--------------------------------------------------------------------*/
25 
26 #include "tcuDefs.hpp"
27 
28 namespace glu
29 {
30 class Platform;
31 }
32 
33 namespace eglu
34 {
35 class Platform;
36 }
37 
38 namespace tcu
39 {
40 
41 class CommandLine;
42 class FunctionLibrary;
43 
44 /*--------------------------------------------------------------------*//*!
45  * \brief Base class for platform implementation.
46  *
47  * This class represents the minimum set of functionality for a platform
48  * port.
49  *
50  * In addition to implementing Platform class, main entry point must be
51  * created that takes care of parsing command line, creating log and
52  * executing tcu::App. See tcuMain.cpp for reference on implementing
53  * application stub.
54  *
55  * If the platform uses standard posix-style main() for application entry
56  * point, tcuMain.cpp can be used as is. In that case you only have to
57  * implement createPlatform().
58  *
59  * API-specific platform interfaces (glu::Platform and eglu::Platform)
60  * can be provided by implementing get<API>Platform() functions.
61  *//*--------------------------------------------------------------------*/
62 class Platform
63 {
64 public:
65 									Platform			(void);
66 	virtual							~Platform			(void);
67 
68 	/*--------------------------------------------------------------------*//*!
69 	 * \brief Process platform-specific events.
70 	 *
71 	 * Test framework will call this function between test cases and test case
72 	 * iterations. Any event handling that must be done periodically should be
73 	 * done here.
74 	 *
75 	 * Test framework will decide whether to continue test execution based on
76 	 * return code. For instance if the application receives close event from OS,
77 	 * it should communicate that to framework by returning false.
78 	 *
79 	 * \note Do not do rendering buffer swaps here.
80 	 *       Do it in RenderContext::postIterate() instead.
81 	 * \return true if test execution should continue, false otherwise.
82 	 *//*--------------------------------------------------------------------*/
83 	virtual bool					processEvents		(void);
84 
85 	/*--------------------------------------------------------------------*//*!
86 	 * \brief Get GL platform interface
87 	 *
88 	 * GL-specific platform interface is defined by glu::Platform. If your
89 	 * platform port supports OpenGL (ES), you should implement this function.
90 	 *
91 	 * Default implementation throws tcu::NotSupportedError exception.
92 	 *
93 	 * \return Reference to GL platform interface.
94 	 *//*--------------------------------------------------------------------*/
95 	virtual const glu::Platform&	getGLPlatform		(void) const;
96 
97 	/*--------------------------------------------------------------------*//*!
98 	 * \brief Get EGL platform interface
99 	 *
100 	 * EGL-specific platform interface is defined by eglu::Platform. If your
101 	 * platform port supports EGL, you should implement this function.
102 	 *
103 	 * Default implementation throws tcu::NotSupportedError exception.
104 	 *
105 	 * \return Reference to EGL platform interface.
106 	 *//*--------------------------------------------------------------------*/
107 	virtual const eglu::Platform&	getEGLPlatform		(void) const;
108 };
109 
110 } // tcu
111 
112 #endif // _TCUPLATFORM_HPP
113