[automerger skipped] DO NOT MERGE: Make the tests permissive for Lollipop MR1 am...
[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 #include "es31fShaderFramebufferFetchTests.hpp"
95 #include "es31fShaderUniformIntegerFunctionTests.hpp"
96
97 namespace deqp
98 {
99 namespace gles31
100 {
101 namespace Functional
102 {
103
104 class ShaderLibraryTest : public TestCaseGroup
105 {
106 public:
107         ShaderLibraryTest (Context& context, const char* filename, const char* name, const char* description)
108                 : TestCaseGroup (context, name, description)
109                 , m_filename    (filename)
110         {
111         }
112
113         void init (void)
114         {
115                 gls::ShaderLibrary                      shaderLibrary(m_testCtx, m_context.getRenderContext(), m_context.getContextInfo());
116                 std::string                                     fileName        = m_filename;
117                 std::vector<tcu::TestNode*>     children        = shaderLibrary.loadShaderFile(fileName.c_str());
118
119                 for (int i = 0; i < (int)children.size(); i++)
120                         addChild(children[i]);
121         }
122
123 private:
124         const std::string m_filename;
125 };
126
127 class ShaderLibraryGroup : public TestCaseGroup
128 {
129 public:
130         struct File
131         {
132                 const char*             fileName;
133                 const char*             testName;
134                 const char*             description;
135         };
136
137         ShaderLibraryGroup (Context& context, const char* name, const char* description, int numFiles, const File* files)
138                 : TestCaseGroup (context, name, description)
139                 , m_numFiles    (numFiles)
140                 , m_files               (files)
141         {}
142
143         void init (void)
144         {
145                 for (int ndx = 0; ndx < m_numFiles; ++ndx)
146                         addChild(new ShaderLibraryTest(m_context, m_files[ndx].fileName, m_files[ndx].testName, m_files[ndx].description));
147         }
148
149 private:
150         const int                       m_numFiles;
151         const File* const       m_files;
152 };
153
154 class ShaderBuiltinVarTests : public TestCaseGroup
155 {
156 public:
157         ShaderBuiltinVarTests (Context& context)
158                 : TestCaseGroup(context, "builtin_var", "Shader Built-in Variable Tests")
159         {
160         }
161
162         void init (void)
163         {
164                 addChild(new ComputeShaderBuiltinVarTests(m_context));
165         }
166 };
167
168 class ShaderBuiltinFunctionTests : public TestCaseGroup
169 {
170 public:
171         ShaderBuiltinFunctionTests (Context& context)
172                 : TestCaseGroup(context, "builtin_functions", "Built-in Function Tests")
173         {
174         }
175
176         void init (void)
177         {
178                 addChild(new ShaderCommonFunctionTests                  (m_context));
179                 addChild(new ShaderPackingFunctionTests                 (m_context));
180                 addChild(new ShaderIntegerFunctionTests                 (m_context));
181                 addChild(new ShaderUniformIntegerFunctionTests  (m_context));
182                 addChild(new ShaderTextureSizeTests                             (m_context));
183                 addChild(createBuiltinPrecisionTests                    (m_context));
184         }
185 };
186
187 class ShaderLinkageTests : public TestCaseGroup
188 {
189 public:
190         ShaderLinkageTests (Context& context)
191                 : TestCaseGroup(context,  "linkage", "Linkage Tests")
192         {
193         }
194
195         void init (void)
196         {
197                 static const ShaderLibraryGroup::File   s_filesES31[]   =
198                 {
199                         { "shaders/es31/linkage_geometry.test",                                 "geometry",                                     "Geometry shader"                                       },
200                         { "shaders/es31/linkage_tessellation.test",                             "tessellation",                         "Tessellation shader"                           },
201                         { "shaders/es31/linkage_tessellation_geometry.test",    "tessellation_geometry",        "Tessellation and geometry shader"      },
202                         { "shaders/es31/linkage_shader_storage_block.test",             "shader_storage_block",         "Shader storage blocks"                         },
203                         { "shaders/es31/linkage_io_block.test",                                 "io_block",                                     "Shader io blocks"                                      },
204                         { "shaders/es31/linkage_uniform.test",                                  "uniform",                                      "Uniform linkage"                                       },
205                 };
206                 static const ShaderLibraryGroup::File   s_filesES32[]   =
207                 {
208                         { "shaders/es32/linkage_geometry.test",                                 "geometry",                                     "Geometry shader"                                       },
209                         { "shaders/es32/linkage_tessellation.test",                             "tessellation",                         "Tessellation shader"                           },
210                         { "shaders/es32/linkage_tessellation_geometry.test",    "tessellation_geometry",        "Tessellation and geometry shader"      },
211                         { "shaders/es32/linkage_shader_storage_block.test",             "shader_storage_block",         "Shader storage blocks"                         },
212                         { "shaders/es32/linkage_io_block.test",                                 "io_block",                                     "Shader io blocks"                                      },
213                         { "shaders/es32/linkage_uniform.test",                                  "uniform",                                      "Uniform linkage"                                       },
214                 };
215
216                 addChild(new ShaderLibraryGroup(m_context,      "es31",         "GLSL ES 3.1 Linkage",  DE_LENGTH_OF_ARRAY(s_filesES31), s_filesES31));
217                 addChild(new ShaderLibraryGroup(m_context,      "es32",         "GLSL ES 3.2 Linkage",  DE_LENGTH_OF_ARRAY(s_filesES32), s_filesES32));
218         }
219 };
220
221 class ShaderTests : public TestCaseGroup
222 {
223 public:
224         ShaderTests (Context& context)
225                 : TestCaseGroup(context, "shaders", "Shading Language Tests")
226         {
227         }
228
229         void init (void)
230         {
231                 addChild(new ShaderBuiltinVarTests                              (m_context));
232                 addChild(new ShaderBuiltinFunctionTests                 (m_context));
233                 addChild(new SampleVariableTests                                (m_context));
234                 addChild(new ShaderMultisampleInterpolationTests(m_context));
235                 addChild(new OpaqueTypeIndexingTests                    (m_context));
236
237                 {
238                         static const ShaderLibraryGroup::File s_functionFiles[] =
239                         {
240                                 { "shaders/es31/functions.test",        "es31",         "GLSL ES 3.1 Function Tests"    },
241                                 { "shaders/es32/functions.test",        "es32",         "GLSL ES 3.2 Function Tests"    },
242                         };
243                         addChild(new ShaderLibraryGroup(m_context, "functions", "Function Tests", DE_LENGTH_OF_ARRAY(s_functionFiles), s_functionFiles));
244                 }
245
246                 {
247                         static const ShaderLibraryGroup::File s_arraysFiles[] =
248                         {
249                                 { "shaders/es31/arrays.test",   "es31",         "GLSL ES 3.1 Array Tests"       },
250                                 { "shaders/es32/arrays.test",   "es32",         "GLSL ES 3.2 Array Tests"       },
251                         };
252                         addChild(new ShaderLibraryGroup(m_context, "arrays", "Array Tests", DE_LENGTH_OF_ARRAY(s_arraysFiles), s_arraysFiles));
253                 }
254
255                 {
256                         static const ShaderLibraryGroup::File s_arraysOfArraysFiles[] =
257                         {
258                                 { "shaders/es31/arrays_of_arrays.test",         "es31",         "GLSL ES 3.1 Arrays of Arrays Tests"    },
259                                 { "shaders/es32/arrays_of_arrays.test",         "es32",         "GLSL ES 3.2 Arrays of Arrays Tests"    },
260                         };
261                         addChild(new ShaderLibraryGroup(m_context, "arrays_of_arrays", "Arrays of Arras Tests", DE_LENGTH_OF_ARRAY(s_arraysOfArraysFiles), s_arraysOfArraysFiles));
262                 }
263
264                 addChild(new ShaderLinkageTests                                 (m_context));
265                 addChild(new ShaderBuiltinConstantTests                 (m_context));
266                 addChild(new ShaderHelperInvocationTests                (m_context));
267
268                 {
269                         static const ShaderLibraryGroup::File s_implicitConversionsFiles[] =
270                         {
271                                 { "shaders/es31/implicit_conversions.test",             "es31",         "GLSL ES 3.1 GL_EXT_shader_implicit_conversions Tests"  },
272                                 { "shaders/es32/implicit_conversions.test",             "es32",         "GLSL ES 3.2 GL_EXT_shader_implicit_conversions Tests"  },
273                         };
274                         addChild(new ShaderLibraryGroup(m_context, "implicit_conversions", "GL_EXT_shader_implicit_conversions Tests", DE_LENGTH_OF_ARRAY(s_implicitConversionsFiles), s_implicitConversionsFiles));
275                 }
276
277                 {
278                         static const ShaderLibraryGroup::File s_uniformBlockFiles[] =
279                         {
280                                 { "shaders/es31/uniform_block.test",    "es31",         "GLSL ES 3.1 Uniform block tests"       },
281                                 { "shaders/es32/uniform_block.test",    "es32",         "GLSL ES 3.2 Uniform block tests"       },
282                         };
283                         addChild(new ShaderLibraryGroup(m_context, "uniform_block", "Uniform block tests", DE_LENGTH_OF_ARRAY(s_uniformBlockFiles), s_uniformBlockFiles));
284                 }
285
286                 addChild(new ShaderFramebufferFetchTests                (m_context));
287         }
288 };
289
290 class ComputeTests : public TestCaseGroup
291 {
292 public:
293         ComputeTests (Context& context)
294                 : TestCaseGroup(context, "compute", "Compute Shader Tests")
295         {
296         }
297
298         void init (void)
299         {
300                 addChild(new BasicComputeShaderTests            (m_context));
301                 addChild(new ShaderSharedVarTests                       (m_context));
302                 addChild(new IndirectComputeDispatchTests       (m_context));
303         }
304 };
305
306 class SSBOTests : public TestCaseGroup
307 {
308 public:
309         SSBOTests (Context& context)
310                 : TestCaseGroup(context, "ssbo", "Shader Storage Buffer Object Tests")
311         {
312         }
313
314         void init (void)
315         {
316                 addChild(new SSBOLayoutTests                    (m_context));
317                 addChild(new ShaderAtomicOpTests                (m_context, "atomic", ATOMIC_OPERAND_BUFFER_VARIABLE));
318                 addChild(new SSBOArrayLengthTests               (m_context));
319         }
320 };
321
322 class TextureTests : public TestCaseGroup
323 {
324 public:
325         TextureTests (Context& context)
326                 : TestCaseGroup(context, "texture", "Texture tests")
327         {
328         }
329
330         void init (void)
331         {
332                 addChild(new TextureFilteringTests              (m_context));
333                 addChild(new TextureFormatTests                 (m_context));
334                 addChild(new TextureSpecificationTests  (m_context));
335                 addChild(new TextureMultisampleTests    (m_context));
336                 addChild(new TextureGatherTests                 (m_context));
337                 addChild(createTextureBufferTests               (m_context));
338                 addChild(new TextureBorderClampTests    (m_context));
339         }
340 };
341
342 class StateQueryTests : public TestCaseGroup
343 {
344 public:
345         StateQueryTests (Context& context)
346                 : TestCaseGroup(context, "state_query", "State query tests")
347         {
348         }
349
350         void init (void)
351         {
352                 addChild(new BooleanStateQueryTests                                                     (m_context));
353                 addChild(new IntegerStateQueryTests                                                     (m_context));
354                 addChild(new IndexedStateQueryTests                                                     (m_context));
355                 addChild(new TextureStateQueryTests                                                     (m_context));
356                 addChild(new TextureLevelStateQueryTests                                        (m_context));
357                 addChild(new SamplerStateQueryTests                                                     (m_context));
358                 addChild(new ShaderStateQueryTests                                                      (m_context));
359                 addChild(new InternalFormatQueryTests                                           (m_context));
360                 addChild(new VertexAttributeBindingStateQueryTests                      (m_context));
361                 addChild(new ShaderMultisampleInterpolationStateQueryTests      (m_context));
362                 addChild(new FramebufferDefaultStateQueryTests                          (m_context));
363                 addChild(new ProgramStateQueryTests                                                     (m_context));
364                 addChild(new ProgramPipelineStateQueryTests                                     (m_context));
365         }
366 };
367
368 class FboTests : public TestCaseGroup
369 {
370 public:
371         FboTests (Context& context)
372                 : TestCaseGroup(context, "fbo", "Framebuffer Object Tests")
373         {
374         }
375
376         void init (void)
377         {
378                 addChild(new FboColorTests                                              (m_context));
379                 addChild(createFboNoAttachmentTests                             (m_context));
380                 addChild(createFboNoAttachmentCompletenessTests (m_context));
381                 addChild(new FboSRGBWriteControlTests                   (m_context));
382         }
383 };
384
385 class SRGBTextureDecodeTests : public TestCaseGroup
386 {
387 public:
388         SRGBTextureDecodeTests (Context& context)
389                 : TestCaseGroup (context, "srgb_texture_decode", "GL_EXT_texture_sRGB_decode tests")
390         {
391         }
392
393         void init (void)
394         {
395                 addChild(new SRGBDecodeTests    (m_context));
396         }
397 };
398
399 FunctionalTests::FunctionalTests (Context& context)
400         : TestCaseGroup(context, "functional", "Functionality Tests")
401 {
402 }
403
404 FunctionalTests::~FunctionalTests (void)
405 {
406 }
407
408 void FunctionalTests::init (void)
409 {
410         addChild(new ShaderTests                                                        (m_context));
411         addChild(new ComputeTests                                                       (m_context));
412         addChild(new DrawTests                                                          (m_context));
413         addChild(new TessellationTests                                          (m_context));
414         addChild(new SSBOTests                                                          (m_context));
415         addChild(new UniformBlockTests                                          (m_context));
416         addChild(new ShaderImageLoadStoreTests                          (m_context));
417         addChild(new AtomicCounterTests                                         (m_context));
418         addChild(new StencilTexturingTests                                      (m_context));
419         addChild(new TextureTests                                                       (m_context));
420         addChild(new StateQueryTests                                            (m_context));
421         addChild(new MultisampleTests                                           (m_context));
422         addChild(new SynchronizationTests                                       (m_context));
423         addChild(new GeometryShaderTests                                        (m_context));
424         addChild(new SampleShadingTests                                         (m_context));
425         addChild(new VertexAttributeBindingTests                        (m_context));
426         addChild(new ProgramUniformTests                                        (m_context));
427         addChild(new AdvancedBlendTests                                         (m_context));
428         addChild(createSeparateShaderTests                                      (m_context));
429         addChild(new UniformLocationTests                                       (m_context));
430         addChild(new TessellationGeometryInteractionTests       (m_context));
431         addChild(new DebugTests                                                         (m_context));
432         addChild(new FboTests                                                           (m_context));
433         addChild(new ProgramInterfaceQueryTests                         (m_context));
434         addChild(new LayoutBindingTests                                         (m_context));
435         addChild(new PrimitiveBoundingBoxTests                          (m_context));
436         addChild(new AndroidExtensionPackES31ATests                     (m_context));
437         addChild(createCopyImageTests                                           (m_context));
438         addChild(createDrawBuffersIndexedTests                          (m_context));
439         addChild(new DefaultVertexArrayObjectTests                      (m_context));
440         addChild(new SRGBTextureDecodeTests                                     (m_context));
441         addChild(new DrawElementsBaseVertexTests                        (m_context));
442 }
443
444 } // Functional
445 } // gles31
446 } // deqp