• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _TEGLTESTCASE_HPP
2 #define _TEGLTESTCASE_HPP
3 /*-------------------------------------------------------------------------
4  * drawElements Quality Program EGL Module
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 Test Case
24  *//*--------------------------------------------------------------------*/
25 
26 #include "tcuDefs.hpp"
27 #include "tcuTestCase.hpp"
28 #include "tcuEgl.hpp"
29 #include "egluNativeWindow.hpp"
30 #include "egluConfigInfo.hpp"
31 #include "tcuFunctionLibrary.hpp"
32 #include "gluRenderContext.hpp"
33 
34 #include <set>
35 #include <map>
36 
37 namespace eglu
38 {
39 class NativeDisplay;
40 class NativeWindow;
41 class NativePixmap;
42 class NativeDisplayFactory;
43 class NativeWindowFactory;
44 class NativePixmapFactory;
45 } // eglu
46 
47 namespace deqp
48 {
49 namespace egl
50 {
51 
52 class EglTestContext
53 {
54 public:
55 												EglTestContext			(tcu::TestContext& testCtx, const eglu::NativeDisplayFactory& displayFactory, const eglu::NativeWindowFactory* windowFactory, const eglu::NativePixmapFactory* pixmapFactory);
56 												~EglTestContext			(void);
57 
getTestContext(void)58 	tcu::TestContext&							getTestContext			(void) 			{ return m_testCtx;													}
getNativeDisplay(void)59 	eglu::NativeDisplay&						getNativeDisplay		(void)			{ return *m_defaultNativeDisplay;									}
getDisplay(void)60 	tcu::egl::Display&							getDisplay				(void)			{ return *m_defaultEGLDisplay;										}
getConfigs(void) const61 	const std::vector<eglu::ConfigInfo>&		getConfigs				(void) const	{ return m_configs;													}
62 
63 	const eglu::NativeWindowFactory&			getNativeWindowFactory	(void) const;
64 	const eglu::NativePixmapFactory&			getNativePixmapFactory	(void) const;
65 
66 	eglu::NativeWindow*							createNativeWindow		(EGLDisplay display, EGLConfig config, const EGLAttrib* attribList, int width, int height, eglu::WindowParams::Visibility visibility);
67 	eglu::NativePixmap*							createNativePixmap		(EGLDisplay display, EGLConfig config, const EGLAttrib* attribList, int width, int height);
68 
69 	deFunctionPtr								getGLFunction			(glu::ApiType apiType, const char* name) const;
70 	void										getGLFunctions			(glw::Functions& gl, glu::ApiType apiType) const;
71 
isAPISupported(EGLint api)72 	bool										isAPISupported			(EGLint api)	{ return m_supportedAPIs.find(api) != m_supportedAPIs.end();		}
73 
74 	// Test case wrapper will instruct test context to create display upon case init and destroy it in deinit
75 	void										createDefaultDisplay	(void);
76 	void										destroyDefaultDisplay	(void);
77 
78 private:
79 												EglTestContext			(const EglTestContext&);
80 	EglTestContext&								operator=				(const EglTestContext&);
81 
82 	const tcu::FunctionLibrary*					getGLLibrary			(glu::ApiType apiType) const;
83 
84 	tcu::TestContext&							m_testCtx;
85 	const eglu::NativeDisplayFactory&			m_displayFactory;
86 	const eglu::NativeWindowFactory*			m_windowFactory;
87 	const eglu::NativePixmapFactory*			m_pixmapFactory;
88 
89 	typedef std::map<deUint32, tcu::FunctionLibrary*> GLLibraryMap;
90 	mutable GLLibraryMap						m_glLibraries;			//!< GL library cache.
91 
92 	eglu::NativeDisplay*						m_defaultNativeDisplay;
93 	tcu::egl::Display*							m_defaultEGLDisplay;
94 	std::vector<eglu::ConfigInfo>				m_configs;
95 	std::set<EGLint>							m_supportedAPIs;
96 };
97 
98 class TestCaseGroup : public tcu::TestCaseGroup
99 {
100 public:
101 						TestCaseGroup	(EglTestContext& eglTestCtx, const char* name, const char* description);
102 	virtual				~TestCaseGroup	(void);
103 
104 protected:
105 	EglTestContext&		m_eglTestCtx;
106 };
107 
108 class TestCase : public tcu::TestCase
109 {
110 public:
111 						TestCase		(EglTestContext& eglTestCtx, const char* name, const char* description);
112 						TestCase		(EglTestContext& eglTestCtx, tcu::TestNodeType type, const char* name, const char* description);
113 	virtual				~TestCase		(void);
114 
115 protected:
116 	EglTestContext&		m_eglTestCtx;
117 };
118 
119 } // egl
120 } // deqp
121 
122 #endif // _TEGLTESTCASE_HPP
123