Add new draw elements base vertex tests am: 3c865084eb am: f573b5fc43
[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 "es31fSamplerStateQueryTests.hpp"
54 #include "es31fTextureFilteringTests.hpp"
55 #include "es31fTextureFormatTests.hpp"
56 #include "es31fTextureSpecificationTests.hpp"
57 #include "es31fTextureMultisampleTests.hpp"
58 #include "es31fMultisampleTests.hpp"
59 #include "es31fSynchronizationTests.hpp"
60 #include "es31fGeometryShaderTests.hpp"
61 #include "es31fSampleShadingTests.hpp"
62 #include "es31fSampleVariableTests.hpp"
63 #include "es31fIndirectComputeDispatchTests.hpp"
64 #include "es31fVertexAttributeBindingTests.hpp"
65 #include "es31fVertexAttributeBindingStateQueryTests.hpp"
66 #include "es31fShaderMultisampleInterpolationTests.hpp"
67 #include "es31fShaderMultisampleInterpolationStateQueryTests.hpp"
68 #include "es31fProgramUniformTests.hpp"
69 #include "es31fOpaqueTypeIndexingTests.hpp"
70 #include "es31fAdvancedBlendTests.hpp"
71 #include "es31fSeparateShaderTests.hpp"
72 #include "es31fUniformLocationTests.hpp"
73 #include "es31fBuiltinPrecisionTests.hpp"
74 #include "es31fTessellationGeometryInteractionTests.hpp"
75 #include "es31fUniformBlockTests.hpp"
76 #include "es31fDebugTests.hpp"
77 #include "es31fFboColorbufferTests.hpp"
78 #include "es31fFboNoAttachmentTests.hpp"
79 #include "es31fFboSRGBWriteControlTests.hpp"
80 #include "es31fProgramInterfaceQueryTests.hpp"
81 #include "es31fTextureGatherTests.hpp"
82 #include "es31fTextureFormatTests.hpp"
83 #include "es31fTextureBufferTests.hpp"
84 #include "es31fTextureBorderClampTests.hpp"
85 #include "es31fShaderBuiltinConstantTests.hpp"
86 #include "es31fShaderHelperInvocationTests.hpp"
87 #include "es31fPrimitiveBoundingBoxTests.hpp"
88 #include "es31fAndroidExtensionPackES31ATests.hpp"
89 #include "es31fCopyImageTests.hpp"
90 #include "es31fDrawBuffersIndexedTests.hpp"
91 #include "es31fDefaultVertexArrayObjectTests.hpp"
92 #include "es31fSRGBDecodeTests.hpp"
93 #include "es31fDrawElementsBaseVertexTests.hpp"
94
95 namespace deqp
96 {
97 namespace gles31
98 {
99 namespace Functional
100 {
101
102 class ShaderLibraryTest : public TestCaseGroup
103 {
104 public:
105         ShaderLibraryTest (Context& context, const char* name, const char* description)
106                 : TestCaseGroup (context, name, description)
107                 , m_filename    (name + std::string(".test"))
108         {
109         }
110
111         ShaderLibraryTest (Context& context, const char* filename, const char* name, const char* description)
112                 : TestCaseGroup (context, name, description)
113                 , m_filename    (filename)
114         {
115         }
116
117         void init (void)
118         {
119                 gls::ShaderLibrary                      shaderLibrary(m_testCtx, m_context.getRenderContext(), m_context.getContextInfo());
120                 std::string                                     fileName        = "shaders/" + m_filename;
121                 std::vector<tcu::TestNode*>     children        = shaderLibrary.loadShaderFile(fileName.c_str());
122
123                 for (int i = 0; i < (int)children.size(); i++)
124                         addChild(children[i]);
125         }
126
127 private:
128         const std::string m_filename;
129 };
130
131 class ShaderBuiltinVarTests : public TestCaseGroup
132 {
133 public:
134         ShaderBuiltinVarTests (Context& context)
135                 : TestCaseGroup(context, "builtin_var", "Shader Built-in Variable Tests")
136         {
137         }
138
139         void init (void)
140         {
141                 addChild(new ComputeShaderBuiltinVarTests(m_context));
142         }
143 };
144
145 class ShaderBuiltinFunctionTests : public TestCaseGroup
146 {
147 public:
148         ShaderBuiltinFunctionTests (Context& context)
149                 : TestCaseGroup(context, "builtin_functions", "Built-in Function Tests")
150         {
151         }
152
153         void init (void)
154         {
155                 addChild(new ShaderCommonFunctionTests  (m_context));
156                 addChild(new ShaderPackingFunctionTests (m_context));
157                 addChild(new ShaderIntegerFunctionTests (m_context));
158                 addChild(new ShaderTextureSizeTests             (m_context));
159                 addChild(createBuiltinPrecisionTests    (m_context));
160         }
161 };
162
163 class ShaderLinkageTests : public TestCaseGroup
164 {
165 public:
166         ShaderLinkageTests (Context& context)
167                 : TestCaseGroup(context,  "linkage", "Linkage Tests")
168         {
169         }
170
171         void init (void)
172         {
173                 addChild(new ShaderLibraryTest(m_context, "linkage_geometry.test", "geometry", "Geometry shader"));
174                 addChild(new ShaderLibraryTest(m_context, "linkage_tessellation.test", "tessellation", "Tessellation shader"));
175                 addChild(new ShaderLibraryTest(m_context, "linkage_tessellation_geometry.test", "tessellation_geometry", "Tessellation and geometry shader"));
176                 addChild(new ShaderLibraryTest(m_context, "linkage_shader_storage_block.test", "shader_storage_block", "Shader storage blocks"));
177                 addChild(new ShaderLibraryTest(m_context, "linkage_io_block.test", "io_block", "Shader io blocks"));
178                 addChild(new ShaderLibraryTest(m_context, "linkage_uniform.test", "uniform", "Uniform linkage"));
179         }
180 };
181
182 class ShaderTests : public TestCaseGroup
183 {
184 public:
185         ShaderTests (Context& context)
186                 : TestCaseGroup(context, "shaders", "Shading Language Tests")
187         {
188         }
189
190         void init (void)
191         {
192                 addChild(new ShaderBuiltinVarTests                              (m_context));
193                 addChild(new ShaderBuiltinFunctionTests                 (m_context));
194                 addChild(new SampleVariableTests                                (m_context));
195                 addChild(new ShaderMultisampleInterpolationTests(m_context));
196                 addChild(new OpaqueTypeIndexingTests                    (m_context));
197                 addChild(new ShaderLibraryTest                                  (m_context, "functions", "Function Tests"));
198                 addChild(new ShaderLibraryTest                                  (m_context, "arrays", "Arrays Tests"));
199                 addChild(new ShaderLibraryTest                                  (m_context, "arrays_of_arrays", "Arrays of Arrays Tests"));
200                 addChild(new ShaderLinkageTests                                 (m_context));
201                 addChild(new ShaderBuiltinConstantTests                 (m_context));
202                 addChild(new ShaderHelperInvocationTests                (m_context));
203                 addChild(new ShaderLibraryTest                                  (m_context, "implicit_conversions", "GL_EXT_shader_implicit_conversions Tests"));
204                 addChild(new ShaderLibraryTest                                  (m_context, "uniform_block", "Uniform block tests"));
205         }
206 };
207
208 class ComputeTests : public TestCaseGroup
209 {
210 public:
211         ComputeTests (Context& context)
212                 : TestCaseGroup(context, "compute", "Compute Shader Tests")
213         {
214         }
215
216         void init (void)
217         {
218                 addChild(new BasicComputeShaderTests            (m_context));
219                 addChild(new ShaderSharedVarTests                       (m_context));
220                 addChild(new IndirectComputeDispatchTests       (m_context));
221         }
222 };
223
224 class SSBOTests : public TestCaseGroup
225 {
226 public:
227         SSBOTests (Context& context)
228                 : TestCaseGroup(context, "ssbo", "Shader Storage Buffer Object Tests")
229         {
230         }
231
232         void init (void)
233         {
234                 addChild(new SSBOLayoutTests                    (m_context));
235                 addChild(new ShaderAtomicOpTests                (m_context, "atomic", ATOMIC_OPERAND_BUFFER_VARIABLE));
236                 addChild(new SSBOArrayLengthTests               (m_context));
237         }
238 };
239
240 class TextureTests : public TestCaseGroup
241 {
242 public:
243         TextureTests (Context& context)
244                 : TestCaseGroup(context, "texture", "Texture tests")
245         {
246         }
247
248         void init (void)
249         {
250                 addChild(new TextureFilteringTests              (m_context));
251                 addChild(new TextureFormatTests                 (m_context));
252                 addChild(new TextureSpecificationTests  (m_context));
253                 addChild(new TextureMultisampleTests    (m_context));
254                 addChild(new TextureGatherTests                 (m_context));
255                 addChild(createTextureBufferTests               (m_context));
256                 addChild(new TextureBorderClampTests    (m_context));
257         }
258 };
259
260 class StateQueryTests : public TestCaseGroup
261 {
262 public:
263         StateQueryTests (Context& context)
264                 : TestCaseGroup(context, "state_query", "State query tests")
265         {
266         }
267
268         void init (void)
269         {
270                 addChild(new BooleanStateQueryTests                                                     (m_context));
271                 addChild(new IntegerStateQueryTests                                                     (m_context));
272                 addChild(new IndexedStateQueryTests                                                     (m_context));
273                 addChild(new TextureStateQueryTests                                                     (m_context));
274                 addChild(new TextureLevelStateQueryTests                                        (m_context));
275                 addChild(new SamplerStateQueryTests                                                     (m_context));
276                 addChild(new ShaderStateQueryTests                                                      (m_context));
277                 addChild(new InternalFormatQueryTests                                           (m_context));
278                 addChild(new VertexAttributeBindingStateQueryTests                      (m_context));
279                 addChild(new ShaderMultisampleInterpolationStateQueryTests      (m_context));
280                 addChild(new FramebufferDefaultStateQueryTests                          (m_context));
281                 addChild(new ProgramStateQueryTests                                                     (m_context));
282                 addChild(new ProgramPipelineStateQueryTests                                     (m_context));
283         }
284 };
285
286 class FboTests : public TestCaseGroup
287 {
288 public:
289         FboTests (Context& context)
290                 : TestCaseGroup(context, "fbo", "Framebuffer Object Tests")
291         {
292         }
293
294         void init (void)
295         {
296                 addChild(new FboColorTests                                              (m_context));
297                 addChild(createFboNoAttachmentTests                             (m_context));
298                 addChild(createFboNoAttachmentCompletenessTests (m_context));
299                 addChild(new FboSRGBWriteControlTests                   (m_context));
300         }
301 };
302
303 class SRGBTextureDecodeTests : public TestCaseGroup
304 {
305 public:
306         SRGBTextureDecodeTests (Context& context)
307                 : TestCaseGroup (context, "srgb_texture_decode", "GL_EXT_texture_sRGB_decode tests")
308         {
309         }
310
311         void init (void)
312         {
313                 addChild(new SRGBDecodeTests    (m_context));
314         }
315 };
316
317 FunctionalTests::FunctionalTests (Context& context)
318         : TestCaseGroup(context, "functional", "Functionality Tests")
319 {
320 }
321
322 FunctionalTests::~FunctionalTests (void)
323 {
324 }
325
326 void FunctionalTests::init (void)
327 {
328         addChild(new ShaderTests                                                        (m_context));
329         addChild(new ComputeTests                                                       (m_context));
330         addChild(new DrawTests                                                          (m_context));
331         addChild(new TessellationTests                                          (m_context));
332         addChild(new SSBOTests                                                          (m_context));
333         addChild(new UniformBlockTests                                          (m_context));
334         addChild(new ShaderImageLoadStoreTests                          (m_context));
335         addChild(new AtomicCounterTests                                         (m_context));
336         addChild(new StencilTexturingTests                                      (m_context));
337         addChild(new TextureTests                                                       (m_context));
338         addChild(new StateQueryTests                                            (m_context));
339         addChild(new MultisampleTests                                           (m_context));
340         addChild(new SynchronizationTests                                       (m_context));
341         addChild(new GeometryShaderTests                                        (m_context));
342         addChild(new SampleShadingTests                                         (m_context));
343         addChild(new VertexAttributeBindingTests                        (m_context));
344         addChild(new ProgramUniformTests                                        (m_context));
345         addChild(new AdvancedBlendTests                                         (m_context));
346         addChild(createSeparateShaderTests                                      (m_context));
347         addChild(new UniformLocationTests                                       (m_context));
348         addChild(new TessellationGeometryInteractionTests       (m_context));
349         addChild(new DebugTests                                                         (m_context));
350         addChild(new FboTests                                                           (m_context));
351         addChild(new ProgramInterfaceQueryTests                         (m_context));
352         addChild(new LayoutBindingTests                                         (m_context));
353         addChild(new PrimitiveBoundingBoxTests                          (m_context));
354         addChild(new AndroidExtensionPackES31ATests                     (m_context));
355         addChild(createCopyImageTests                                           (m_context));
356         addChild(createDrawBuffersIndexedTests                          (m_context));
357         addChild(new DefaultVertexArrayObjectTests                      (m_context));
358         addChild(new SRGBTextureDecodeTests                                     (m_context));
359         addChild(new DrawElementsBaseVertexTests                        (m_context));
360 }
361
362 } // Functional
363 } // gles31
364 } // deqp