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 "es31fDefaultVertexArrayObjectTests.hpp"
91 #include "es31fSRGBDecodeTests.hpp"
92 #include "es31fDrawElementsBaseVertexTests.hpp"
93 #include "es31fShaderFramebufferFetchTests.hpp"
94 #include "es31fShaderUniformIntegerFunctionTests.hpp"
95
96 namespace deqp
97 {
98 namespace gles31
99 {
100 namespace Functional
101 {
102
103 class ShaderLibraryTest : public TestCaseGroup
104 {
105 public:
ShaderLibraryTest(Context & context,const char * filename,const char * name,const char * description)106 ShaderLibraryTest(Context &context, const char *filename, const char *name, const char *description)
107 : TestCaseGroup(context, name, description)
108 , m_filename(filename)
109 {
110 }
111
init(void)112 void init(void)
113 {
114 gls::ShaderLibrary shaderLibrary(m_testCtx, m_context.getRenderContext(), m_context.getContextInfo());
115 std::string fileName = m_filename;
116 std::vector<tcu::TestNode *> children = shaderLibrary.loadShaderFile(fileName.c_str());
117
118 for (int i = 0; i < (int)children.size(); i++)
119 addChild(children[i]);
120 }
121
122 private:
123 const std::string m_filename;
124 };
125
126 class ShaderLibraryGroup : public TestCaseGroup
127 {
128 public:
129 struct File
130 {
131 const char *fileName;
132 const char *testName;
133 const char *description;
134 };
135
ShaderLibraryGroup(Context & context,const char * name,const char * description,int numFiles,const File * files)136 ShaderLibraryGroup(Context &context, const char *name, const char *description, int numFiles, const File *files)
137 : TestCaseGroup(context, name, description)
138 , m_numFiles(numFiles)
139 , m_files(files)
140 {
141 }
142
init(void)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,
147 m_files[ndx].description));
148 }
149
150 private:
151 const int m_numFiles;
152 const File *const m_files;
153 };
154
155 class ShaderBuiltinVarTests : public TestCaseGroup
156 {
157 public:
ShaderBuiltinVarTests(Context & context)158 ShaderBuiltinVarTests(Context &context) : TestCaseGroup(context, "builtin_var", "Shader Built-in Variable Tests")
159 {
160 }
161
init(void)162 void init(void)
163 {
164 addChild(new ComputeShaderBuiltinVarTests(m_context));
165 }
166 };
167
168 class ShaderBuiltinFunctionTests : public TestCaseGroup
169 {
170 public:
ShaderBuiltinFunctionTests(Context & context)171 ShaderBuiltinFunctionTests(Context &context)
172 : TestCaseGroup(context, "builtin_functions", "Built-in Function Tests")
173 {
174 }
175
init(void)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:
ShaderLinkageTests(Context & context,bool isGL45)190 ShaderLinkageTests(Context &context, bool isGL45)
191 : TestCaseGroup(context, "linkage", "Linkage Tests")
192 , m_isGL45(isGL45)
193 {
194 }
195
196 private:
197 bool m_isGL45;
198
init(void)199 void init(void)
200 {
201 static const ShaderLibraryGroup::File s_filesES31[] = {
202 {"shaders/es31/declarations.test", "declarations", "Declarations"},
203 {"shaders/es31/linkage_geometry.test", "geometry", "Geometry shader"},
204 {"shaders/es31/linkage_tessellation.test", "tessellation", "Tessellation shader"},
205 {"shaders/es31/linkage_tessellation_geometry.test", "tessellation_geometry",
206 "Tessellation and geometry shader"},
207 {"shaders/es31/linkage_shader_storage_block.test", "shader_storage_block", "Shader storage blocks"},
208 {"shaders/es31/linkage_io_block.test", "io_block", "Shader io blocks"},
209 {"shaders/es31/linkage_uniform.test", "uniform", "Uniform linkage"},
210 };
211 static const ShaderLibraryGroup::File s_filesES32[] = {
212 {"shaders/es32/linkage_geometry.test", "geometry", "Geometry shader"},
213 {"shaders/es32/linkage_tessellation.test", "tessellation", "Tessellation shader"},
214 {"shaders/es32/linkage_tessellation_geometry.test", "tessellation_geometry",
215 "Tessellation and geometry shader"},
216 {"shaders/es32/linkage_shader_storage_block.test", "shader_storage_block", "Shader storage blocks"},
217 {"shaders/es32/linkage_io_block.test", "io_block", "Shader io blocks"},
218 {"shaders/es32/linkage_uniform.test", "uniform", "Uniform linkage"},
219 };
220 static const ShaderLibraryGroup::File s_filesGL45[] = {
221 {"shaders/gl45/linkage_geometry.test", "geometry", "Geometry shader"},
222 {"shaders/gl45/linkage_tessellation.test", "tessellation", "Tessellation shader"},
223 {"shaders/gl45/linkage_tessellation_geometry.test", "tessellation_geometry",
224 "Tessellation and geometry shader"},
225 {"shaders/gl45/linkage_shader_storage_block.test", "shader_storage_block", "Shader storage blocks"},
226 {"shaders/gl45/linkage_io_block.test", "io_block", "Shader io blocks"},
227 {"shaders/gl45/linkage_uniform.test", "uniform", "Uniform linkage"},
228 };
229
230 if (m_isGL45)
231 addChild(new ShaderLibraryGroup(m_context, "gl45", "GL 4.5 Linkage", DE_LENGTH_OF_ARRAY(s_filesGL45),
232 s_filesGL45));
233 else
234 {
235 addChild(new ShaderLibraryGroup(m_context, "es31", "GLSL ES 3.1 Linkage", DE_LENGTH_OF_ARRAY(s_filesES31),
236 s_filesES31));
237 addChild(new ShaderLibraryGroup(m_context, "es32", "GLSL ES 3.2 Linkage", DE_LENGTH_OF_ARRAY(s_filesES32),
238 s_filesES32));
239 }
240 }
241 };
242
243 class ShaderTests : public TestCaseGroup
244 {
245 public:
ShaderTests(Context & context,bool isGL45)246 ShaderTests(Context &context, bool isGL45)
247 : TestCaseGroup(context, "shaders", "Shading Language Tests")
248 , m_isGL45(isGL45)
249 {
250 }
251
252 private:
253 bool m_isGL45;
254
init(void)255 void init(void)
256 {
257 addChild(new ShaderBuiltinVarTests(m_context));
258 addChild(new ShaderBuiltinFunctionTests(m_context));
259 addChild(new SampleVariableTests(m_context));
260 addChild(new ShaderMultisampleInterpolationTests(m_context));
261 addChild(new OpaqueTypeIndexingTests(m_context));
262
263 {
264 static const ShaderLibraryGroup::File s_functionFiles[] = {
265 {"shaders/es31/functions.test", "es31", "GLSL ES 3.1 Function Tests"},
266 {"shaders/es32/functions.test", "es32", "GLSL ES 3.2 Function Tests"},
267 };
268 addChild(new ShaderLibraryGroup(m_context, "functions", "Function Tests",
269 DE_LENGTH_OF_ARRAY(s_functionFiles), s_functionFiles));
270 }
271
272 {
273 static const ShaderLibraryGroup::File s_arraysFiles[] = {
274 {"shaders/es31/arrays.test", "es31", "GLSL ES 3.1 Array Tests"},
275 {"shaders/es32/arrays.test", "es32", "GLSL ES 3.2 Array Tests"},
276 };
277 addChild(new ShaderLibraryGroup(m_context, "arrays", "Array Tests", DE_LENGTH_OF_ARRAY(s_arraysFiles),
278 s_arraysFiles));
279 }
280
281 {
282 static const ShaderLibraryGroup::File s_arraysOfArraysFilesES[] = {
283 {"shaders/es31/arrays_of_arrays.test", "es31", "GLSL ES 3.1 Arrays of Arrays Tests"},
284 {"shaders/es32/arrays_of_arrays.test", "es32", "GLSL ES 3.2 Arrays of Arrays Tests"},
285 };
286
287 static const ShaderLibraryGroup::File s_arraysOfArraysFilesGL[] = {
288 {"shaders/gl45/arrays_of_arrays.test", "gl45", "GLSL 4.5 Arrays of Arrays Tests"},
289 };
290 if (m_isGL45)
291 addChild(new ShaderLibraryGroup(m_context, "arrays_of_arrays", "Arrays of Arras Tests",
292 DE_LENGTH_OF_ARRAY(s_arraysOfArraysFilesGL), s_arraysOfArraysFilesGL));
293 else
294 addChild(new ShaderLibraryGroup(m_context, "arrays_of_arrays", "Arrays of Arras Tests",
295 DE_LENGTH_OF_ARRAY(s_arraysOfArraysFilesES), s_arraysOfArraysFilesES));
296 }
297
298 addChild(new ShaderLinkageTests(m_context, m_isGL45));
299 addChild(new ShaderBuiltinConstantTests(m_context));
300 addChild(new ShaderHelperInvocationTests(m_context));
301
302 {
303 static const ShaderLibraryGroup::File s_implicitConversionsFilesES[] = {
304 {"shaders/es31/implicit_conversions.test", "es31",
305 "GLSL ES 3.1 GL_EXT_shader_implicit_conversions Tests"},
306 {"shaders/es32/implicit_conversions.test", "es32",
307 "GLSL ES 3.2 GL_EXT_shader_implicit_conversions Tests"},
308 };
309 static const ShaderLibraryGroup::File s_implicitConversionsFilesGL[] = {
310 {"shaders/gl45/implicit_conversions.test", "gl45", "GL45 implicit conversions Tests"},
311 };
312 if (m_isGL45)
313 addChild(new ShaderLibraryGroup(m_context, "implicit_conversions", "GL45 implicit conversions Tests",
314 DE_LENGTH_OF_ARRAY(s_implicitConversionsFilesGL),
315 s_implicitConversionsFilesGL));
316 else
317 addChild(new ShaderLibraryGroup(
318 m_context, "implicit_conversions", "GL_EXT_shader_implicit_conversions Tests",
319 DE_LENGTH_OF_ARRAY(s_implicitConversionsFilesES), s_implicitConversionsFilesES));
320 }
321
322 {
323 static const ShaderLibraryGroup::File s_uniformBlockFiles[] = {
324 {"shaders/es31/uniform_block.test", "es31", "GLSL ES 3.1 Uniform block tests"},
325 {"shaders/es32/uniform_block.test", "es32", "GLSL ES 3.2 Uniform block tests"},
326 };
327 addChild(new ShaderLibraryGroup(m_context, "uniform_block", "Uniform block tests",
328 DE_LENGTH_OF_ARRAY(s_uniformBlockFiles), s_uniformBlockFiles));
329 }
330
331 addChild(new ShaderFramebufferFetchTests(m_context));
332 }
333 };
334
335 class ComputeTests : public TestCaseGroup
336 {
337 public:
ComputeTests(Context & context)338 ComputeTests(Context &context) : TestCaseGroup(context, "compute", "Compute Shader Tests")
339 {
340 }
341
init(void)342 void init(void)
343 {
344 addChild(new BasicComputeShaderTests(m_context));
345 addChild(new ShaderSharedVarTests(m_context));
346 addChild(new IndirectComputeDispatchTests(m_context));
347 }
348 };
349
350 class SSBOTests : public TestCaseGroup
351 {
352 public:
SSBOTests(Context & context)353 SSBOTests(Context &context) : TestCaseGroup(context, "ssbo", "Shader Storage Buffer Object Tests")
354 {
355 }
356
init(void)357 void init(void)
358 {
359 addChild(new SSBOLayoutTests(m_context));
360 addChild(new ShaderAtomicOpTests(m_context, "atomic", ATOMIC_OPERAND_BUFFER_VARIABLE));
361 addChild(new SSBOArrayLengthTests(m_context));
362 }
363 };
364
365 class TextureTests : public TestCaseGroup
366 {
367 public:
TextureTests(Context & context,bool isGL45)368 TextureTests(Context &context, bool isGL45) : TestCaseGroup(context, "texture", "Texture tests"), m_isGL45(isGL45)
369 {
370 }
371
init(void)372 void init(void)
373 {
374 addChild(new TextureFilteringTests(m_context));
375 addChild(new TextureFormatTests(m_context));
376 addChild(new TextureSpecificationTests(m_context));
377 addChild(new TextureMultisampleTests(m_context));
378 addChild(new TextureGatherTests(m_context));
379 addChild(createTextureBufferTests(m_context));
380 addChild(new TextureBorderClampTests(m_context, m_isGL45));
381 }
382
383 private:
384 bool m_isGL45;
385 };
386
387 class StateQueryTests : public TestCaseGroup
388 {
389 public:
StateQueryTests(Context & context)390 StateQueryTests(Context &context) : TestCaseGroup(context, "state_query", "State query tests")
391 {
392 }
393
init(void)394 void init(void)
395 {
396 addChild(new BooleanStateQueryTests(m_context));
397 addChild(new IntegerStateQueryTests(m_context));
398 addChild(new IndexedStateQueryTests(m_context));
399 addChild(new TextureStateQueryTests(m_context));
400 addChild(new TextureLevelStateQueryTests(m_context));
401 addChild(new SamplerStateQueryTests(m_context));
402 addChild(new ShaderStateQueryTests(m_context));
403 addChild(new InternalFormatQueryTests(m_context));
404 addChild(new VertexAttributeBindingStateQueryTests(m_context));
405 addChild(new ShaderMultisampleInterpolationStateQueryTests(m_context));
406 addChild(new FramebufferDefaultStateQueryTests(m_context));
407 addChild(new ProgramStateQueryTests(m_context));
408 addChild(new ProgramPipelineStateQueryTests(m_context));
409 }
410 };
411
412 class FboTests : public TestCaseGroup
413 {
414 public:
FboTests(Context & context)415 FboTests(Context &context) : TestCaseGroup(context, "fbo", "Framebuffer Object Tests")
416 {
417 }
418
init(void)419 void init(void)
420 {
421 addChild(new FboColorTests(m_context));
422 addChild(createFboNoAttachmentTests(m_context));
423 addChild(createFboNoAttachmentCompletenessTests(m_context));
424 addChild(new FboSRGBWriteControlTests(m_context));
425 }
426 };
427
428 class SRGBTextureDecodeTests : public TestCaseGroup
429 {
430 public:
SRGBTextureDecodeTests(Context & context)431 SRGBTextureDecodeTests(Context &context)
432 : TestCaseGroup(context, "srgb_texture_decode", "GL_EXT_texture_sRGB_decode tests")
433 {
434 }
435
init(void)436 void init(void)
437 {
438 addChild(new SRGBDecodeTests(m_context));
439 }
440 };
441
GLES31FunctionalTests(Context & context)442 GLES31FunctionalTests::GLES31FunctionalTests(Context &context)
443 : TestCaseGroup(context, "functional", "Functionality Tests")
444 {
445 }
446
~GLES31FunctionalTests(void)447 GLES31FunctionalTests::~GLES31FunctionalTests(void)
448 {
449 }
450
init(void)451 void GLES31FunctionalTests::init(void)
452 {
453 addChild(new ShaderTests(m_context, false));
454 addChild(new ComputeTests(m_context));
455 addChild(new DrawTests(m_context));
456 addChild(new TessellationTests(m_context, false));
457 addChild(new SSBOTests(m_context));
458 addChild(new UniformBlockTests(m_context));
459 addChild(new ShaderImageLoadStoreTests(m_context));
460 addChild(new AtomicCounterTests(m_context));
461 addChild(new StencilTexturingTests(m_context));
462 addChild(new TextureTests(m_context, false));
463 addChild(new StateQueryTests(m_context));
464 addChild(new MultisampleTests(m_context));
465 addChild(new SynchronizationTests(m_context));
466 addChild(new GeometryShaderTests(m_context, false));
467 addChild(new SampleShadingTests(m_context));
468 addChild(new VertexAttributeBindingTests(m_context));
469 addChild(new ProgramUniformTests(m_context));
470 addChild(new AdvancedBlendTests(m_context));
471 addChild(createGLESSeparateShaderTests(m_context));
472 addChild(new UniformLocationTests(m_context, false));
473 addChild(new TessellationGeometryInteractionTests(m_context, false));
474 addChild(new DebugTests(m_context));
475 addChild(new FboTests(m_context));
476 addChild(new ProgramInterfaceQueryTests(m_context, false));
477 addChild(new LayoutBindingTests(m_context));
478 addChild(new PrimitiveBoundingBoxTests(m_context));
479 addChild(new AndroidExtensionPackES31ATests(m_context));
480 addChild(createCopyImageTests(m_context, false));
481 addChild(new DefaultVertexArrayObjectTests(m_context));
482 addChild(new SRGBTextureDecodeTests(m_context));
483 addChild(new DrawElementsBaseVertexTests(m_context));
484 }
485
GL45ES31FunctionalTests(Context & context)486 GL45ES31FunctionalTests::GL45ES31FunctionalTests(Context &context)
487 : TestCaseGroup(context, "functional", "Functionality Tests")
488 {
489 }
490
~GL45ES31FunctionalTests(void)491 GL45ES31FunctionalTests::~GL45ES31FunctionalTests(void)
492 {
493 }
494
init(void)495 void GL45ES31FunctionalTests::init(void)
496 {
497 addChild(new ShaderTests(m_context, true));
498 addChild(new ComputeTests(m_context));
499 addChild(new DrawTests(m_context));
500 addChild(new TessellationTests(m_context, true));
501 addChild(new SSBOTests(m_context));
502 addChild(new UniformBlockTests(m_context));
503 addChild(new ShaderImageLoadStoreTests(m_context));
504 addChild(new AtomicCounterTests(m_context));
505 addChild(new StencilTexturingTests(m_context));
506 addChild(new TextureTests(m_context, true));
507 addChild(new StateQueryTests(m_context));
508 addChild(new MultisampleTests(m_context));
509 addChild(new SynchronizationTests(m_context));
510 addChild(new GeometryShaderTests(m_context, true));
511 addChild(new SampleShadingTests(m_context));
512 addChild(new VertexAttributeBindingTests(m_context));
513 addChild(new ProgramUniformTests(m_context));
514 addChild(new AdvancedBlendTests(m_context));
515 addChild(createCommonSeparateShaderTests(m_context));
516 addChild(new UniformLocationTests(m_context, true));
517 addChild(new TessellationGeometryInteractionTests(m_context, true));
518 addChild(new DebugTests(m_context));
519 addChild(new FboTests(m_context));
520 addChild(new ProgramInterfaceQueryTests(m_context, true));
521 addChild(new LayoutBindingTests(m_context));
522 addChild(new PrimitiveBoundingBoxTests(m_context));
523 addChild(createCopyImageTests(m_context, true));
524 addChild(new SRGBTextureDecodeTests(m_context));
525 addChild(new DrawElementsBaseVertexTests(m_context));
526 }
527
528 } // namespace Functional
529 } // namespace gles31
530 } // namespace deqp
531