1 #ifndef _TEGLRENDERCASE_HPP
2 #define _TEGLRENDERCASE_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 Base class for rendering tests.
24  *//*--------------------------------------------------------------------*/
25 
26 #include "tcuDefs.hpp"
27 #include "teglTestCase.hpp"
28 #include "teglSimpleConfigCase.hpp"
29 
30 #include <vector>
31 
32 namespace deqp
33 {
34 namespace egl
35 {
36 
37 class RenderCase : public SimpleConfigCase
38 {
39 public:
40 						RenderCase				(EglTestContext& eglTestCtx, const char* name, const char* description, eglw::EGLint surfaceTypeMask, const eglu::FilterList& filters);
41 	virtual				~RenderCase				(void);
42 
43 protected:
44 	struct Config
45 	{
46 		eglw::EGLConfig		config;
47 		eglw::EGLint		surfaceTypeBit;
48 		eglw::EGLint		apiBits;
49 
Configdeqp::egl::RenderCase::Config50 		Config (eglw::EGLConfig config_, eglw::EGLint surfaceTypeBit_, eglw::EGLint apiBits_)
51 			: config			(config_)
52 			, surfaceTypeBit	(surfaceTypeBit_)
53 			, apiBits			(apiBits_)
54 		{
55 		}
56 	};
57 
58 	virtual void		executeForConfig		(eglw::EGLDisplay display, eglw::EGLConfig config);
59 	virtual void		executeForSurface		(eglw::EGLDisplay display, eglw::EGLSurface surface, const Config& config) = DE_NULL;
60 
61 	eglw::EGLint		m_surfaceTypeMask;
62 };
63 
64 class SingleContextRenderCase : public RenderCase
65 {
66 public:
67 					SingleContextRenderCase		(EglTestContext& eglTestCtx, const char* name, const char* description, eglw::EGLint apiMask, eglw::EGLint surfaceTypeMask, const eglu::FilterList& filters);
68 	virtual			~SingleContextRenderCase	(void);
69 
70 protected:
71 	virtual void	executeForSurface			(eglw::EGLDisplay display, eglw::EGLSurface surface, const Config& config);
72 	virtual void	executeForContext			(eglw::EGLDisplay display, eglw::EGLContext context, eglw::EGLSurface surface, const Config& config) = DE_NULL;
73 
74 	eglw::EGLint	m_apiMask;
75 };
76 
77 class MultiContextRenderCase : public RenderCase
78 {
79 public:
80 					MultiContextRenderCase		(EglTestContext& eglTestCtx, const char* name, const char* description, eglw::EGLint api, eglw::EGLint surfaceType, const eglu::FilterList& filters, int numContextsPerApi);
81 	virtual			~MultiContextRenderCase		(void);
82 
83 protected:
84 	virtual void	executeForSurface			(eglw::EGLDisplay display, eglw::EGLSurface surface, const Config& config);
85 	virtual void	executeForContexts			(eglw::EGLDisplay display, eglw::EGLSurface surface, const Config& config, const std::vector<std::pair<eglw::EGLint, eglw::EGLContext> >& contexts) = DE_NULL;
86 
87 	int				m_numContextsPerApi;
88 	eglw::EGLint	m_apiMask;
89 };
90 
91 class RenderFilterList : public NamedFilterList
92 {
93 public:
RenderFilterList(const char * name,const char * description,eglw::EGLint surfaceTypeMask)94 	RenderFilterList (const char* name, const char* description, eglw::EGLint surfaceTypeMask)
95 		: NamedFilterList	(name, description)
96 		, m_surfaceTypeMask	(surfaceTypeMask)
97 	{
98 	}
99 
getSurfaceTypeMask(void) const100 	eglw::EGLint getSurfaceTypeMask (void) const
101 	{
102 		return m_surfaceTypeMask;
103 	}
104 
105 private:
106 	eglw::EGLint	m_surfaceTypeMask;
107 };
108 
109 void			getDefaultRenderFilterLists	(std::vector<RenderFilterList>& configSets, const eglu::FilterList& baseFilters);
110 
111 //! Client APIs supported in current build
112 eglw::EGLint	getBuildClientAPIMask		(void);
113 
114 } // egl
115 } // deqp
116 
117 #endif // _TEGLRENDERCASE_HPP
118