1/*-------------------------------------------------------------------------
2 * OpenGL Conformance Test Suite
3 * -----------------------------
4 *
5 * Copyright (c) 2014-2016 The Khronos Group Inc.
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
22 */ /*-------------------------------------------------------------------*/
23
24#include "esextcGeometryShaderTests.hpp"
25#include "deRandom.hpp"
26#include "deStringUtil.hpp"
27#include "tcuCommandLine.hpp"
28
29#include "esextcGeometryShaderAPI.hpp"
30#include "esextcGeometryShaderAdjacencyTests.hpp"
31#include "esextcGeometryShaderBlitting.hpp"
32#include "esextcGeometryShaderClipping.hpp"
33#include "esextcGeometryShaderConstantVariables.hpp"
34#include "esextcGeometryShaderInput.hpp"
35#include "esextcGeometryShaderLayeredFBO.hpp"
36#include "esextcGeometryShaderLayeredFramebuffer.hpp"
37#include "esextcGeometryShaderLayeredRendering.hpp"
38#include "esextcGeometryShaderLayeredRenderingBoundaryCondition.hpp"
39#include "esextcGeometryShaderLayeredRenderingFBONoAttachment.hpp"
40#include "esextcGeometryShaderLimits.hpp"
41#include "esextcGeometryShaderLinking.hpp"
42#include "esextcGeometryShaderNonarrayInput.hpp"
43#include "esextcGeometryShaderOutput.hpp"
44#include "esextcGeometryShaderPrimitiveCounter.hpp"
45#include "esextcGeometryShaderPrimitiveQueries.hpp"
46#include "esextcGeometryShaderProgramResource.hpp"
47#include "esextcGeometryShaderQualifiers.hpp"
48#include "esextcGeometryShaderRendering.hpp"
49
50namespace glcts
51{
52/** Constructor
53 *
54 * @param context       Test context
55 * @param glslVersion   GLSL version
56 * @param extType       Extension type
57 **/
58GeometryShaderTests::GeometryShaderTests(Context& context, const ExtParameters& extParams)
59	: TestCaseGroupBase(context, extParams, "geometry_shader", "Geometry Shader tests")
60{
61}
62
63/**
64 * Initializes test groups for geometry shader tests
65 **/
66void GeometryShaderTests::init(void)
67{
68	/* Creating Test Groups */
69	TestCaseGroupBase* renderingTestGroup =
70		new TestCaseGroupBase(m_context, m_extParams, "rendering", "Rendering (Test Group 1)");
71	TestCaseGroupBase* adjacencyTestGroup =
72		new GeometryShaderAdjacencyTests(m_context, m_extParams, "adjacency", "Adjacency (Test Group 2)");
73	TestCaseGroupBase* programResourceTestGroup =
74		new TestCaseGroupBase(m_context, m_extParams, "program_resource", "Program Resource (Test Group 3)");
75	TestCaseGroupBase* nonarrayInputTestGroup =
76		new TestCaseGroupBase(m_context, m_extParams, "nonarray_input", "Nonarray input (Test Group 4)");
77	TestCaseGroupBase* inputTestGroup = new TestCaseGroupBase(m_context, m_extParams, "input", "Input (Test Group 5)");
78
79	GeometryShaderPrimitiveCounterTestGroup* primitiveCounterTestGroup = new GeometryShaderPrimitiveCounterTestGroup(
80		m_context, m_extParams, "primitive_counter", "PrimitiveCounter (Test Group 6)");
81
82	TestCaseGroupBase* layeredRenderingTestGroup =
83		new TestCaseGroupBase(m_context, m_extParams, "layered_rendering", "Layered rendering (Test Group 7)");
84	TestCaseGroupBase* clippingTestGroup =
85		new TestCaseGroupBase(m_context, m_extParams, "clipping", "Clipping (Test Group 8)");
86	TestCaseGroupBase* blittingTestGroup =
87		new TestCaseGroupBase(m_context, m_extParams, "blitting", "Blitting (Test Group 9)");
88
89	TestCaseGroupBase* layeredRenderingBoudaryCondition =
90		new TestCaseGroupBase(m_context, m_extParams, "layered_rendering_boundary_condition",
91							  "Layered Rendering Boundary Condition (Test Group 10)");
92
93	TestCaseGroupBase* layeredFramebufferTestGroup =
94		new TestCaseGroupBase(m_context, m_extParams, "layered_framebuffer", "Layered framebuffer (Test Group 11)");
95
96	TestCaseGroupBase* outputTestGroup =
97		new TestCaseGroupBase(m_context, m_extParams, "output", "Output (Test Group 12)");
98	TestCaseGroupBase* primitiveQueriesTestGroup =
99		new TestCaseGroupBase(m_context, m_extParams, "primitive_queries", "Primitive Queries (Test Group 13)");
100
101	TestCaseGroupBase* layeredRenderingFBONoAttachmentTestGroup =
102		new TestCaseGroupBase(m_context, m_extParams, "layered_rendering_fbo_no_attachment",
103							  "Layered rendering FBO no attachment (Test Group 14)");
104
105	TestCaseGroupBase* constantVariablesTestGroup =
106		new TestCaseGroupBase(m_context, m_extParams, "constant_variables", "Constant Variables (Test Group 15)");
107	TestCaseGroupBase* limitsTestGroup =
108		new TestCaseGroupBase(m_context, m_extParams, "limits", "Limits (Test Group 16)");
109	TestCaseGroupBase* linkingTestGroup =
110		new TestCaseGroupBase(m_context, m_extParams, "linking", "Linking (Test Group 17 & Test Group 20)");
111	TestCaseGroupBase* apiTestGroup =
112		new TestCaseGroupBase(m_context, m_extParams, "api", "API interactions (Test Group 18)");
113	TestCaseGroupBase* qualifiersTestGroup =
114		new TestCaseGroupBase(m_context, m_extParams, "qualifiers", "Layout qualifiers (Test Group 22)");
115	TestCaseGroupBase* layeredFBOTestGroup =
116		new TestCaseGroupBase(m_context, m_extParams, "layered_fbo", "Layered FBOs (Test Group 21) & Test Group 26 ");
117
118	/* Adding tests groups as children of this test suite */
119	addChild(adjacencyTestGroup);
120	addChild(renderingTestGroup);
121	addChild(programResourceTestGroup);
122	addChild(nonarrayInputTestGroup);
123	addChild(inputTestGroup);
124	addChild(primitiveCounterTestGroup);
125	addChild(layeredRenderingTestGroup);
126	addChild(clippingTestGroup);
127	addChild(blittingTestGroup);
128	addChild(layeredRenderingBoudaryCondition);
129	addChild(layeredFramebufferTestGroup);
130	addChild(outputTestGroup);
131	addChild(primitiveQueriesTestGroup);
132	addChild(layeredRenderingFBONoAttachmentTestGroup);
133	addChild(constantVariablesTestGroup);
134	addChild(limitsTestGroup);
135	addChild(linkingTestGroup);
136	addChild(apiTestGroup);
137	addChild(qualifiersTestGroup);
138	addChild(layeredFBOTestGroup);
139
140	/* Adding tests to test groups */
141
142	/* Rendering test (Test Group 1) */
143	renderingTestGroup->addChild(new GeometryShaderRendering(m_context, m_extParams, "rendering", "Test 1"));
144
145	/* Program Resource test (Test Group 3) */
146	programResourceTestGroup->addChild(
147		new GeometryShaderProgramResourceTest(m_context, m_extParams, "program_resource", "Test 3.1"));
148
149	/* Nonarray input tests (Test Group 4) */
150	nonarrayInputTestGroup->addChild(
151		new GeometryShaderNonarrayInputCase(m_context, m_extParams, "nonarray_input", "Test 4.1"));
152
153	/* Input tests (Test Group 5) */
154	inputTestGroup->addChild(
155		new GeometryShader_gl_in_ArrayContentsTest(m_context, m_extParams, "gl_in_array_contents", "Test 5.1"));
156	inputTestGroup->addChild(
157		new GeometryShader_gl_in_ArrayLengthTest(m_context, m_extParams, "gl_in_array_length", "Test 5.2"));
158	inputTestGroup->addChild(
159		new GeometryShader_gl_PointSize_ValueTest(m_context, m_extParams, "gl_pointsize_value", "Test 5.3"));
160	inputTestGroup->addChild(
161		new GeometryShader_gl_Position_ValueTest(m_context, m_extParams, "gl_position_value", "Test 5.4"));
162
163	/* PrimitiveCounter tests (Test Group 6) */
164	//inputTestGroup->addChild(new PrimitiveCounter(m_context, m_extParams, "gl_primitive_counter", "Test 6"));
165	/* Layered rendering (Test Group 7 & Test Group 21) */
166	layeredRenderingTestGroup->addChild(new GeometryShaderLayeredRendering(m_context, m_extParams, "layered_rendering",
167																		   "Tests 7.1, 7.2, 7.3, 7.4 & 21.3"));
168
169	/* Clipping (Test group 8)*/
170	clippingTestGroup->addChild(new GeometryShaderClipping(m_context, m_extParams, "clipping", "Test 8.1"));
171
172	/* Clipping (Test group 9)*/
173	blittingTestGroup->addChild(
174		new GeometryShaderBlittingLayeredToNonLayered(m_context, m_extParams, "layered_nonlayered", "Test 9.1"));
175	blittingTestGroup->addChild(
176		new GeometryShaderBlittingNonLayeredToLayered(m_context, m_extParams, "nonlayered_layered", "Test 9.2"));
177	blittingTestGroup->addChild(
178		new GeometryShaderBlittingLayeredToLayered(m_context, m_extParams, "layered_layered", "Test 9.3"));
179
180	/* Layered rendering Boundary Condition FBO no attachment (Test Group 10) */
181	layeredRenderingBoudaryCondition->addChild(new GeometryShaderLayeredRenderingBoundaryConditionVariousTextures(
182		m_context, m_extParams, "layered_rendering_boundary_condition_various_textures", "Test 10.1"));
183
184	layeredRenderingBoudaryCondition->addChild(new GeometryShaderLayeredRenderingBoundaryConditionNoGS(
185		m_context, m_extParams, "layered_rendering_boundary_condition_no_gs", "Test 10.2"));
186
187	layeredRenderingBoudaryCondition->addChild(new GeometryShaderLayeredRenderingBoundaryConditionNoLayerSet(
188		m_context, m_extParams, "layered_rendering_boundary_condition_no_default_layer", "Test 10.3"));
189
190	layeredRenderingBoudaryCondition->addChild(new GeometryShaderLayeredRenderingBoundaryConditionNoLayeredFBO(
191		m_context, m_extParams, "layered_rendering_boundary_condition_no_layered_fbo", "Test 10.4"));
192
193	/* Layered framebuffer (Test Group 11) */
194	layeredFramebufferTestGroup->addChild(
195		new GeometryShaderLayeredFramebufferStencil(m_context, m_extParams, "stencil_support", "Test 11.1"));
196	layeredFramebufferTestGroup->addChild(
197		new GeometryShaderLayeredFramebufferDepth(m_context, m_extParams, "depth_support", "Test 11.2"));
198	layeredFramebufferTestGroup->addChild(
199		new GeometryShaderLayeredFramebufferBlending(m_context, m_extParams, "blending_support", "Tests 11.3"));
200	layeredFramebufferTestGroup->addChild(
201		new GeometryShaderLayeredFramebufferClear(m_context, m_extParams, "clear_call_support", "Tests 11.4, 11.5"));
202
203	/* Output (Test Group 12) */
204	outputTestGroup->addChild(new GeometryShaderDuplicateOutputLayoutQualifierTest(
205		m_context, m_extParams, "conflicted_output_primitive", "Test 12.1"));
206	outputTestGroup->addChild(new GeometryShaderDuplicateMaxVerticesLayoutQualifierTest(
207		m_context, m_extParams, "conflicted_output_vertices_max", "Test 12.2"));
208	outputTestGroup->addChild(
209		new GeometryShaderIfVertexEmitIsDoneAtEndTest(m_context, m_extParams, "vertex_emit_at_end", "Test 12.3"));
210	outputTestGroup->addChild(new GeometryShaderMissingEndPrimitiveCallTest(m_context, m_extParams,
211																			"primitive_end_done_at_end", "Test 12.4"));
212	outputTestGroup->addChild(new GeometryShaderMissingEndPrimitiveCallForSinglePrimitiveTest(
213		m_context, m_extParams, "primite_end_done_for_single_primitive", "Test 12.5"));
214
215	/* Layered rendering FBO no attachment (Test Group 13) */
216	primitiveQueriesTestGroup->addChild(new GeometryShaderPrimitiveQueriesPoints(
217		m_context, m_extParams, "primitive_queries_points", "Test 13.1, 13.2 - Points"));
218	primitiveQueriesTestGroup->addChild(new GeometryShaderPrimitiveQueriesLines(
219		m_context, m_extParams, "primitive_queries_lines", "Test 13.1, 13.2 - Lines"));
220	primitiveQueriesTestGroup->addChild(new GeometryShaderPrimitiveQueriesTriangles(
221		m_context, m_extParams, "primitive_queries_triangles", "Test 13.1, 13.2 - Triangles"));
222
223	/* Layered rendering FBO no attachment (Test Group 14 & Test Group 21) */
224	layeredRenderingFBONoAttachmentTestGroup->addChild(new GeometryShaderLayeredRenderingFBONoAttachment(
225		m_context, m_extParams, "layered_rendering_fbo_no_attachment", "Test 14.1, 14.2, Test 21.4"));
226
227	/* Constants Variables (Test Group 15) */
228	constantVariablesTestGroup->addChild(
229		new GeometryShaderConstantVariables(m_context, m_extParams, "constant_variables", "Test 15.1, Test 15.2"));
230
231	/* Limits (Test Group 16) */
232	limitsTestGroup->addChild(
233		new GeometryShaderMaxUniformComponentsTest(m_context, m_extParams, "max_uniform_components", "Test 16.1"));
234	limitsTestGroup->addChild(
235		new GeometryShaderMaxUniformBlocksTest(m_context, m_extParams, "max_uniform_blocks", "Test 16.2"));
236	limitsTestGroup->addChild(
237		new GeometryShaderMaxInputComponentsTest(m_context, m_extParams, "max_input_components", "Test 16.3"));
238	limitsTestGroup->addChild(
239		new GeometryShaderMaxOutputComponentsTest(m_context, m_extParams, "max_output_components", "Test 16.4"));
240	limitsTestGroup->addChild(
241		new GeometryShaderMaxOutputVerticesTest(m_context, m_extParams, "max_output_vertices", "Test 16.5"));
242	limitsTestGroup->addChild(new GeometryShaderMaxOutputComponentsSinglePointTest(
243		m_context, m_extParams, "max_output_components_single_point", "Test 16.6"));
244	limitsTestGroup->addChild(
245		new GeometryShaderMaxTextureUnitsTest(m_context, m_extParams, "max_texture_units", "Test 16.7"));
246	limitsTestGroup->addChild(
247		new GeometryShaderMaxInvocationsTest(m_context, m_extParams, "max_invocations", "Test 16.8"));
248	limitsTestGroup->addChild(new GeometryShaderMaxCombinedTextureUnitsTest(m_context, m_extParams,
249																			"max_combined_texture_units", "Test 16.9"));
250
251	/* Linking (Test Group 17 & Test Group 20 & part of Test Group 23 & part of Test Group 24 & part of Test Group 25) */
252	linkingTestGroup->addChild(new GeometryShaderIncompleteProgramObjectsTest(
253		m_context, m_extParams, "incomplete_program_objects", "Test 17.1, 17.2"));
254	linkingTestGroup->addChild(
255		new GeometryShaderIncompleteGSTest(m_context, m_extParams, "incomplete_gs", "Test 17.3"));
256	linkingTestGroup->addChild(new GeometryShaderInvalidArrayedInputVariablesTest(
257		m_context, m_extParams, "invalid_arrayed_input_variables", "Test 17.4"));
258
259	linkingTestGroup->addChild(new GeometryShaderVSGSVariableTypeMismatchTest(
260		m_context, m_extParams, "vs_gs_variable_type_mismatch", "Test 20.1"));
261	linkingTestGroup->addChild(new GeometryShaderVSGSVariableQualifierMismatchTest(
262		m_context, m_extParams, "vs_gs_variable_qualifier_mismatch", "Test 20.2"));
263	linkingTestGroup->addChild(new GeometryShaderVSGSArrayedVariableSizeMismatchTest(
264		m_context, m_extParams, "vs_gs_arrayed_variable_size_mismatch", "Test 20.3"));
265	linkingTestGroup->addChild(
266		new GeometryShaderFragCoordRedeclarationTest(m_context, m_extParams, "fragcoord_redeclaration", "Test 20.4"));
267	linkingTestGroup->addChild(
268		new GeometryShaderLocationAliasingTest(m_context, m_extParams, "location_aliasing", "Test 20.5"));
269
270	linkingTestGroup->addChild(new GeometryShaderMoreACsInGSThanSupportedTest(
271		m_context, m_extParams, "more_ACs_in_GS_than_supported", "Test 23.4"));
272	linkingTestGroup->addChild(new GeometryShaderMoreACBsInGSThanSupportedTest(
273		m_context, m_extParams, "more_ACBs_in_GS_than_supported", "Test 23.6"));
274
275	linkingTestGroup->addChild(
276		new GeometryShaderCompilationFailTest(m_context, m_extParams, "geometry_shader_compilation_fail", "Test 24.1"));
277	linkingTestGroup->addChild(new GeometryShaderMoreInputVerticesThanAvailableTest(
278		m_context, m_extParams, "more_input_vertices_in_GS_than_available", "Test 24.4"));
279
280	linkingTestGroup->addChild(new GeometryShaderTransformFeedbackVertexAndGeometryShaderCaptureTest(
281		m_context, m_extParams, "tf_capture_from_gs_and_vs_variables", "Test 25.1"));
282
283	/* API interactions (Test Group 18 & Test Group 19 & part of Test Group 23  & part of Test Group 24 & part of Test Group 25) */
284	apiTestGroup->addChild(
285		new GeometryShaderCreateShaderProgramvTest(m_context, m_extParams, "createShaderProgramv", "Test 18.1"));
286	apiTestGroup->addChild(new GeometryShaderGetShaderivTest(m_context, m_extParams, "shader_type", "Test 18.2"));
287	apiTestGroup->addChild(new GeometryShaderGetProgramivTest(m_context, m_extParams, "getProgramiv", "Test 18.3"));
288	apiTestGroup->addChild(new GeometryShaderGetProgramiv2Test(m_context, m_extParams, "getProgramiv2", "Test 18.4"));
289
290	apiTestGroup->addChild(new GeometryShaderGetProgramiv3Test(m_context, m_extParams, "getProgramiv3", "Test 19.1"));
291	apiTestGroup->addChild(
292		new GeometryShaderDrawCallWithFSAndGS(m_context, m_extParams, "fs_gs_draw_call", "Test 19.2"));
293
294	apiTestGroup->addChild(
295		new GeometryShaderMaxImageUniformsTest(m_context, m_extParams, "max_image_uniforms", "Test 23.1"));
296	apiTestGroup->addChild(
297		new GeometryShaderMaxShaderStorageBlocksTest(m_context, m_extParams, "max_shader_storage_blocks", "Test 23.2"));
298	apiTestGroup->addChild(
299		new GeometryShaderMaxAtomicCountersTest(m_context, m_extParams, "max_atomic_counters", "Test 23.3"));
300	apiTestGroup->addChild(new GeometryShaderMaxAtomicCounterBuffersTest(m_context, m_extParams,
301																		 "max_atomic_counter_buffers", "Test 23.5"));
302
303	apiTestGroup->addChild(new GeometryShaderPiplineProgramObjectWithoutActiveVSProgramTest(
304		m_context, m_extParams, "pipeline_program_without_active_vs", "Test 24.2"));
305	apiTestGroup->addChild(new GeometryShaderIncompatibleDrawCallModeTest(m_context, m_extParams,
306																		  "incompatible_draw_call_mode", "Test 24.3"));
307	apiTestGroup->addChild(new GeometryShaderInsufficientEmittedVerticesTest(
308		m_context, m_extParams, "insufficient_emitted_vertices", "Test 24.5"));
309
310	apiTestGroup->addChild(new GeometryShaderPipelineObjectTransformFeedbackVertexAndGeometryShaderCaptureTest(
311		m_context, m_extParams, "program_pipeline_vs_gs_capture", "Test 25.2"));
312
313	apiTestGroup->addChild(new GeometryShaderDrawPrimitivesDoNotMatchOutputPrimitives(
314		m_context, m_extParams, "draw_primitives_do_not_match_output_primitives", "Test 25.3"));
315	apiTestGroup->addChild(
316		new GeometryShaderDrawCallsWhileTFPaused(m_context, m_extParams, "draw_calls_while_tf_is_paused", "Test 25.4"));
317
318	/* Layered FBOs (Test Group 21) & Test Group 26 */
319	layeredFBOTestGroup->addChild(
320		new GeometryShaderIncompleteLayeredFBOTest(m_context, m_extParams, "layered_fbo", "Test 21.1"));
321	layeredFBOTestGroup->addChild(new GeometryShaderIncompleteLayeredAttachmentsTest(
322		m_context, m_extParams, "layered_fbo_attachments", "Test 21.2"));
323
324	layeredFBOTestGroup->addChild(new GeometryShaderFramebufferTextureInvalidTarget(
325		m_context, m_extParams, "fb_texture_invalid_target", "Test 26.1"));
326	layeredFBOTestGroup->addChild(new GeometryShaderFramebufferTextureNoFBOBoundToTarget(
327		m_context, m_extParams, "fb_texture_no_fbo_bound_to_target", "Test 26.2"));
328	layeredFBOTestGroup->addChild(new GeometryShaderFramebufferTextureInvalidAttachment(
329		m_context, m_extParams, "fb_texture_invalid_attachment", "Test 26.3"));
330	layeredFBOTestGroup->addChild(new GeometryShaderFramebufferTextureInvalidValue(
331		m_context, m_extParams, "fb_texture_invalid_value", "Test 26.4"));
332	layeredFBOTestGroup->addChild(new GeometryShaderFramebufferTextureInvalidLevelNumber(
333		m_context, m_extParams, "fb_texture_invalid_level_number", "Test 26.5"));
334	layeredFBOTestGroup->addChild(new GeometryShaderFramebufferTextureArgumentRefersToBufferTexture(
335		m_context, m_extParams, "fb_texture_argument_refers_to_buffer_texture", "Test 26.6"));
336
337	/* Layout qualifiers (Test Group 22) */
338	qualifiersTestGroup->addChild(
339		new GeometryShaderFlatInterpolationTest(m_context, m_extParams, "flat_interpolation", "Test 22.1"));
340}
341
342} // glcts
343