Merge changes I688d84e5,Icce01201
[platform/upstream/VK-GL-CTS.git] / modules / gles31 / functional / es31fFunctionalTests.cpp
1 /*-------------------------------------------------------------------------
2  * drawElements Quality Program OpenGL ES 3.1 Module
3  * -------------------------------------------------
4  *
5  * Copyright 2014 The Android Open Source Project
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  *//*!
20  * \file
21  * \brief Functional Tests.
22  *//*--------------------------------------------------------------------*/
23
24 #include "es31fFunctionalTests.hpp"
25
26 #include "glsShaderLibrary.hpp"
27 #include "es31fBasicComputeShaderTests.hpp"
28 #include "es31fComputeShaderBuiltinVarTests.hpp"
29 #include "es31fDrawTests.hpp"
30 #include "es31fShaderSharedVarTests.hpp"
31 #include "es31fAtomicCounterTests.hpp"
32 #include "es31fShaderAtomicOpTests.hpp"
33 #include "es31fShaderImageLoadStoreTests.hpp"
34 #include "es31fTessellationTests.hpp"
35 #include "es31fSSBOLayoutTests.hpp"
36 #include "es31fSSBOArrayLengthTests.hpp"
37 #include "es31fShaderCommonFunctionTests.hpp"
38 #include "es31fShaderPackingFunctionTests.hpp"
39 #include "es31fShaderIntegerFunctionTests.hpp"
40 #include "es31fStencilTexturingTests.hpp"
41 #include "es31fShaderTextureSizeTests.hpp"
42 #include "es31fShaderStateQueryTests.hpp"
43 #include "es31fLayoutBindingTests.hpp"
44 #include "es31fTextureLevelStateQueryTests.hpp"
45 #include "es31fIntegerStateQueryTests.hpp"
46 #include "es31fInternalFormatQueryTests.hpp"
47 #include "es31fBooleanStateQueryTests.hpp"
48 #include "es31fIndexedStateQueryTests.hpp"
49 #include "es31fTextureStateQueryTests.hpp"
50 #include "es31fFramebufferDefaultStateQueryTests.hpp"
51 #include "es31fProgramPipelineStateQueryTests.hpp"
52 #include "es31fProgramStateQueryTests.hpp"
53 #include "es31fTextureFilteringTests.hpp"
54 #include "es31fTextureFormatTests.hpp"
55 #include "es31fTextureSpecificationTests.hpp"
56 #include "es31fTextureMultisampleTests.hpp"
57 #include "es31fMultisampleTests.hpp"
58 #include "es31fSynchronizationTests.hpp"
59 #include "es31fGeometryShaderTests.hpp"
60 #include "es31fSampleShadingTests.hpp"
61 #include "es31fSampleVariableTests.hpp"
62 #include "es31fIndirectComputeDispatchTests.hpp"
63 #include "es31fVertexAttributeBindingTests.hpp"
64 #include "es31fVertexAttributeBindingStateQueryTests.hpp"
65 #include "es31fShaderMultisampleInterpolationTests.hpp"
66 #include "es31fShaderMultisampleInterpolationStateQueryTests.hpp"
67 #include "es31fProgramUniformTests.hpp"
68 #include "es31fOpaqueTypeIndexingTests.hpp"
69 #include "es31fAdvancedBlendTests.hpp"
70 #include "es31fSeparateShaderTests.hpp"
71 #include "es31fUniformLocationTests.hpp"
72 #include "es31fBuiltinPrecisionTests.hpp"
73 #include "es31fTessellationGeometryInteractionTests.hpp"
74 #include "es31fUniformBlockTests.hpp"
75 #include "es31fDebugTests.hpp"
76 #include "es31fFboColorbufferTests.hpp"
77 #include "es31fFboNoAttachmentTests.hpp"
78 #include "es31fProgramInterfaceQueryTests.hpp"
79 #include "es31fTextureGatherTests.hpp"
80 #include "es31fTextureFormatTests.hpp"
81 #include "es31fTextureBufferTests.hpp"
82 #include "es31fShaderBuiltinConstantTests.hpp"
83 #include "es31fShaderHelperInvocationTests.hpp"
84 #include "es31fPrimitiveBoundingBoxTests.hpp"
85 #include "es31fAndroidExtensionPackES31ATests.hpp"
86 #include "es31fCopyImageTests.hpp"
87
88 namespace deqp
89 {
90 namespace gles31
91 {
92 namespace Functional
93 {
94
95 class ShaderLibraryTest : public TestCaseGroup
96 {
97 public:
98         ShaderLibraryTest (Context& context, const char* name, const char* description)
99                 : TestCaseGroup (context, name, description)
100                 , m_filename    (name + std::string(".test"))
101         {
102         }
103
104         ShaderLibraryTest (Context& context, const char* filename, const char* name, const char* description)
105                 : TestCaseGroup (context, name, description)
106                 , m_filename    (filename)
107         {
108         }
109
110         void init (void)
111         {
112                 gls::ShaderLibrary                      shaderLibrary(m_testCtx, m_context.getRenderContext(), m_context.getContextInfo());
113                 std::string                                     fileName        = "shaders/" + m_filename;
114                 std::vector<tcu::TestNode*>     children        = shaderLibrary.loadShaderFile(fileName.c_str());
115
116                 for (int i = 0; i < (int)children.size(); i++)
117                         addChild(children[i]);
118         }
119
120 private:
121         const std::string m_filename;
122 };
123
124 class ShaderBuiltinVarTests : public TestCaseGroup
125 {
126 public:
127         ShaderBuiltinVarTests (Context& context)
128                 : TestCaseGroup(context, "builtin_var", "Shader Built-in Variable Tests")
129         {
130         }
131
132         void init (void)
133         {
134                 addChild(new ComputeShaderBuiltinVarTests(m_context));
135         }
136 };
137
138 class ShaderBuiltinFunctionTests : public TestCaseGroup
139 {
140 public:
141         ShaderBuiltinFunctionTests (Context& context)
142                 : TestCaseGroup(context, "builtin_functions", "Built-in Function Tests")
143         {
144         }
145
146         void init (void)
147         {
148                 addChild(new ShaderCommonFunctionTests  (m_context));
149                 addChild(new ShaderPackingFunctionTests (m_context));
150                 addChild(new ShaderIntegerFunctionTests (m_context));
151                 addChild(new ShaderTextureSizeTests             (m_context));
152                 addChild(createBuiltinPrecisionTests    (m_context));
153         }
154 };
155
156 class ShaderLinkageTests : public TestCaseGroup
157 {
158 public:
159         ShaderLinkageTests (Context& context)
160                 : TestCaseGroup(context,  "linkage", "Linkage Tests")
161         {
162         }
163
164         void init (void)
165         {
166                 addChild(new ShaderLibraryTest(m_context, "linkage_geometry.test", "geometry", "Geometry shader"));
167                 addChild(new ShaderLibraryTest(m_context, "linkage_tessellation.test", "tessellation", "Tessellation shader"));
168                 addChild(new ShaderLibraryTest(m_context, "linkage_tessellation_geometry.test", "tessellation_geometry", "Tessellation and geometry shader"));
169                 addChild(new ShaderLibraryTest(m_context, "linkage_shader_storage_block.test", "shader_storage_block", "Shader storage blocks"));
170                 addChild(new ShaderLibraryTest(m_context, "linkage_io_block.test", "io_block", "Shader io blocks"));
171         }
172 };
173
174 class ShaderTests : public TestCaseGroup
175 {
176 public:
177         ShaderTests (Context& context)
178                 : TestCaseGroup(context, "shaders", "Shading Language Tests")
179         {
180         }
181
182         void init (void)
183         {
184                 addChild(new ShaderBuiltinVarTests                              (m_context));
185                 addChild(new ShaderBuiltinFunctionTests                 (m_context));
186                 addChild(new SampleVariableTests                                (m_context));
187                 addChild(new ShaderMultisampleInterpolationTests(m_context));
188                 addChild(new OpaqueTypeIndexingTests                    (m_context));
189                 addChild(new ShaderLibraryTest                                  (m_context, "functions", "Function Tests"));
190                 addChild(new ShaderLibraryTest                                  (m_context, "arrays_of_arrays", "Arrays of Arrays Tests"));
191                 addChild(new ShaderLinkageTests                                 (m_context));
192                 addChild(new ShaderBuiltinConstantTests                 (m_context));
193                 addChild(new ShaderHelperInvocationTests                (m_context));
194                 addChild(new ShaderLibraryTest                                  (m_context, "implicit_conversions", "GL_EXT_shader_implicit_conversions Tests"));
195         }
196 };
197
198 class ComputeTests : public TestCaseGroup
199 {
200 public:
201         ComputeTests (Context& context)
202                 : TestCaseGroup(context, "compute", "Compute Shader Tests")
203         {
204         }
205
206         void init (void)
207         {
208                 addChild(new BasicComputeShaderTests            (m_context));
209                 addChild(new ShaderSharedVarTests                       (m_context));
210                 addChild(new IndirectComputeDispatchTests       (m_context));
211         }
212 };
213
214 class SSBOTests : public TestCaseGroup
215 {
216 public:
217         SSBOTests (Context& context)
218                 : TestCaseGroup(context, "ssbo", "Shader Storage Buffer Object Tests")
219         {
220         }
221
222         void init (void)
223         {
224                 addChild(new SSBOLayoutTests                    (m_context));
225                 addChild(new ShaderAtomicOpTests                (m_context, "atomic", ATOMIC_OPERAND_BUFFER_VARIABLE));
226                 addChild(new SSBOArrayLengthTests               (m_context));
227         }
228 };
229
230 class TextureTests : public TestCaseGroup
231 {
232 public:
233         TextureTests (Context& context)
234                 : TestCaseGroup(context, "texture", "Texture tests")
235         {
236         }
237
238         void init (void)
239         {
240                 addChild(new TextureFilteringTests              (m_context));
241                 addChild(new TextureFormatTests                 (m_context));
242                 addChild(new TextureSpecificationTests  (m_context));
243                 addChild(new TextureMultisampleTests    (m_context));
244                 addChild(new TextureGatherTests                 (m_context));
245                 addChild(createTextureBufferTests               (m_context));
246         }
247 };
248
249 class StateQueryTests : public TestCaseGroup
250 {
251 public:
252         StateQueryTests (Context& context)
253                 : TestCaseGroup(context, "state_query", "State query tests")
254         {
255         }
256
257         void init (void)
258         {
259                 addChild(new BooleanStateQueryTests                                                     (m_context));
260                 addChild(new IntegerStateQueryTests                                                     (m_context));
261                 addChild(new IndexedStateQueryTests                                                     (m_context));
262                 addChild(new TextureStateQueryTests                                                     (m_context));
263                 addChild(new TextureLevelStateQueryTests                                        (m_context));
264                 addChild(new ShaderStateQueryTests                                                      (m_context));
265                 addChild(new InternalFormatQueryTests                                           (m_context));
266                 addChild(new VertexAttributeBindingStateQueryTests                      (m_context));
267                 addChild(new ShaderMultisampleInterpolationStateQueryTests      (m_context));
268                 addChild(new FramebufferDefaultStateQueryTests                          (m_context));
269                 addChild(new ProgramStateQueryTests                                                     (m_context));
270                 addChild(new ProgramPipelineStateQueryTests                                     (m_context));
271         }
272 };
273
274 class FboTests : public TestCaseGroup
275 {
276 public:
277         FboTests (Context& context)
278                 : TestCaseGroup(context, "fbo", "Framebuffer Object Tests")
279         {
280         }
281
282         void init (void)
283         {
284                 addChild(new FboColorTests                                              (m_context));
285                 addChild(createFboNoAttachmentTests                             (m_context));
286                 addChild(createFboNoAttachmentCompletenessTests (m_context));
287         }
288 };
289
290 FunctionalTests::FunctionalTests (Context& context)
291         : TestCaseGroup(context, "functional", "Functionality Tests")
292 {
293 }
294
295 FunctionalTests::~FunctionalTests (void)
296 {
297 }
298
299 void FunctionalTests::init (void)
300 {
301         addChild(new ShaderTests                                                        (m_context));
302         addChild(new ComputeTests                                                       (m_context));
303         addChild(new DrawTests                                                          (m_context));
304         addChild(new TessellationTests                                          (m_context));
305         addChild(new SSBOTests                                                          (m_context));
306         addChild(new UniformBlockTests                                          (m_context));
307         addChild(new ShaderImageLoadStoreTests                          (m_context));
308         addChild(new AtomicCounterTests                                         (m_context));
309         addChild(new StencilTexturingTests                                      (m_context));
310         addChild(new TextureTests                                                       (m_context));
311         addChild(new StateQueryTests                                            (m_context));
312         addChild(new MultisampleTests                                           (m_context));
313         addChild(new SynchronizationTests                                       (m_context));
314         addChild(new GeometryShaderTests                                        (m_context));
315         addChild(new SampleShadingTests                                         (m_context));
316         addChild(new VertexAttributeBindingTests                        (m_context));
317         addChild(new ProgramUniformTests                                        (m_context));
318         addChild(new AdvancedBlendTests                                         (m_context));
319         addChild(createSeparateShaderTests                                      (m_context));
320         addChild(new UniformLocationTests                                       (m_context));
321         addChild(new TessellationGeometryInteractionTests       (m_context));
322         addChild(new DebugTests                                                         (m_context));
323         addChild(new FboTests                                                           (m_context));
324         addChild(new ProgramInterfaceQueryTests                         (m_context));
325         addChild(new LayoutBindingTests                                         (m_context));
326         addChild(new PrimitiveBoundingBoxTests                          (m_context));
327         addChild(new AndroidExtensionPackES31ATests                     (m_context));
328         addChild(createCopyImageTests                                           (m_context));
329 }
330
331 } // Functional
332 } // gles31
333 } // deqp