xref: /aosp_15_r20/external/deqp/modules/egl/teglRenderCase.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
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,
41                const eglu::FilterList &filters);
42     virtual ~RenderCase(void);
43 
44 protected:
45     struct Config
46     {
47         eglw::EGLConfig config;
48         eglw::EGLint surfaceTypeBit;
49         eglw::EGLint apiBits;
50 
Configdeqp::egl::RenderCase::Config51         Config(eglw::EGLConfig config_, eglw::EGLint surfaceTypeBit_, eglw::EGLint apiBits_)
52             : config(config_)
53             , surfaceTypeBit(surfaceTypeBit_)
54             , apiBits(apiBits_)
55         {
56         }
57     };
58 
59     virtual void executeForConfig(eglw::EGLDisplay display, eglw::EGLConfig config);
60     virtual void executeForSurface(eglw::EGLDisplay display, eglw::EGLSurface surface, const Config &config) = DE_NULL;
61 
62     eglw::EGLint m_surfaceTypeMask;
63 };
64 
65 class SingleContextRenderCase : public RenderCase
66 {
67 public:
68     SingleContextRenderCase(EglTestContext &eglTestCtx, const char *name, const char *description, eglw::EGLint apiMask,
69                             eglw::EGLint surfaceTypeMask, const eglu::FilterList &filters);
70     virtual ~SingleContextRenderCase(void);
71 
72 protected:
73     virtual void executeForSurface(eglw::EGLDisplay display, eglw::EGLSurface surface, const Config &config);
74     virtual void executeForContext(eglw::EGLDisplay display, eglw::EGLContext context, eglw::EGLSurface surface,
75                                    const Config &config) = DE_NULL;
76 
77     eglw::EGLint m_apiMask;
78 };
79 
80 class MultiContextRenderCase : public RenderCase
81 {
82 public:
83     MultiContextRenderCase(EglTestContext &eglTestCtx, const char *name, const char *description, eglw::EGLint api,
84                            eglw::EGLint surfaceType, const eglu::FilterList &filters, int numContextsPerApi);
85     virtual ~MultiContextRenderCase(void);
86 
87 protected:
88     virtual void executeForSurface(eglw::EGLDisplay display, eglw::EGLSurface surface, const Config &config);
89     virtual void executeForContexts(eglw::EGLDisplay display, eglw::EGLSurface surface, const Config &config,
90                                     const std::vector<std::pair<eglw::EGLint, eglw::EGLContext>> &contexts) = DE_NULL;
91 
92     int m_numContextsPerApi;
93     eglw::EGLint m_apiMask;
94 };
95 
96 class RenderFilterList : public NamedFilterList
97 {
98 public:
RenderFilterList(const char * name,const char * description,eglw::EGLint surfaceTypeMask)99     RenderFilterList(const char *name, const char *description, eglw::EGLint surfaceTypeMask)
100         : NamedFilterList(name, description)
101         , m_surfaceTypeMask(surfaceTypeMask)
102     {
103     }
104 
getSurfaceTypeMask(void) const105     eglw::EGLint getSurfaceTypeMask(void) const
106     {
107         return m_surfaceTypeMask;
108     }
109 
110 private:
111     eglw::EGLint m_surfaceTypeMask;
112 };
113 
114 void getDefaultRenderFilterLists(std::vector<RenderFilterList> &configSets, const eglu::FilterList &baseFilters);
115 
116 //! Client APIs supported in current build
117 eglw::EGLint getBuildClientAPIMask(void);
118 
119 } // namespace egl
120 } // namespace deqp
121 
122 #endif // _TEGLRENDERCASE_HPP
123