xref: /aosp_15_r20/external/deqp/external/openglcts/modules/common/glcTestSubcase.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 #ifndef _GLCTESTSUBCASE_HPP
2 #define _GLCTESTSUBCASE_HPP
3 /*-------------------------------------------------------------------------
4  * OpenGL Conformance Test Suite
5  * -----------------------------
6  *
7  * Copyright (c) 2014-2016 The Khronos Group Inc.
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
24  */ /*-------------------------------------------------------------------*/
25 
26 #include "deSharedPtr.hpp"
27 #include "glcTestCase.hpp"
28 #include "gluCallLogWrapper.hpp"
29 #include "gluStrUtil.hpp"
30 #include "tcuDefs.hpp"
31 
32 #include <exception>
33 
34 #define NO_ERROR 0
35 #define ERROR -1
36 #define NOT_SUPPORTED 0x10
37 #define NL "\n"
38 
39 namespace deqp
40 {
41 
42 class GLWrapper : public glu::CallLogWrapper
43 {
44 public:
~GLWrapper()45     virtual ~GLWrapper()
46     {
47     }
48 
49     GLWrapper();
50     Context &m_context;
51 };
52 
53 class SubcaseBase : public GLWrapper
54 {
55 public:
56     typedef de::SharedPtr<SubcaseBase> SubcaseBasePtr;
57     SubcaseBase();
58     virtual ~SubcaseBase();
59     virtual long Run() = 0;
60     virtual long Setup();
61     virtual long Cleanup();
62 
63     virtual std::string Title()        = 0;
64     virtual std::string Purpose()      = 0;
65     virtual std::string Method()       = 0;
66     virtual std::string PassCriteria() = 0;
67     std::string VertexShader();
68     std::string VertexShader2();
69 
70     std::string TessControlShader();
71     std::string TessControlShader2();
72 
73     std::string TessEvalShader();
74     std::string TessEvalShader2();
75 
76     std::string GeometryShader();
77     std::string GeometryShader2();
78 
79     std::string FragmentShader();
80     std::string FragmentShader2();
81     void Documentation();
82     void OutputNotSupported(std::string message);
83 };
84 
85 class TestSubcase : public TestCase
86 {
87 public:
88     TestSubcase(Context &context, const char *name, SubcaseBase::SubcaseBasePtr (*factoryFunc)());
89     virtual ~TestSubcase(void);
90 
91     IterateResult iterate(void);
92 
93     template <class Type>
Create()94     static SubcaseBase::SubcaseBasePtr Create()
95     {
96         return SubcaseBase::SubcaseBasePtr(new Type());
97     }
98 
99 private:
100     TestSubcase(const TestSubcase &other);
101     TestSubcase &operator=(const TestSubcase &other);
102     void init(void);
103     void deinit(void);
104     SubcaseBase::SubcaseBasePtr (*m_factoryFunc)();
105     int m_iterationCount;
106 };
107 
108 } // namespace deqp
109 
110 #endif // _GLCTESTSUBCASE_HPP
111