1e5c31af7Sopenharmony_ci#ifndef _ESEXTCTESSELLATIONSHADERTCTE_HPP
2e5c31af7Sopenharmony_ci#define _ESEXTCTESSELLATIONSHADERTCTE_HPP
3e5c31af7Sopenharmony_ci/*-------------------------------------------------------------------------
4e5c31af7Sopenharmony_ci * OpenGL Conformance Test Suite
5e5c31af7Sopenharmony_ci * -----------------------------
6e5c31af7Sopenharmony_ci *
7e5c31af7Sopenharmony_ci * Copyright (c) 2014-2016 The Khronos Group Inc.
8e5c31af7Sopenharmony_ci *
9e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
10e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License.
11e5c31af7Sopenharmony_ci * You may obtain a copy of the License at
12e5c31af7Sopenharmony_ci *
13e5c31af7Sopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
14e5c31af7Sopenharmony_ci *
15e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
16e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
17e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and
19e5c31af7Sopenharmony_ci * limitations under the License.
20e5c31af7Sopenharmony_ci *
21e5c31af7Sopenharmony_ci */ /*!
22e5c31af7Sopenharmony_ci * \file
23e5c31af7Sopenharmony_ci * \brief
24e5c31af7Sopenharmony_ci */ /*-------------------------------------------------------------------*/
25e5c31af7Sopenharmony_ci
26e5c31af7Sopenharmony_ci#include "../esextcTestCaseBase.hpp"
27e5c31af7Sopenharmony_ci#include "esextcTessellationShaderUtils.hpp"
28e5c31af7Sopenharmony_ci#include "gluShaderUtil.hpp"
29e5c31af7Sopenharmony_ci#include "tcuDefs.hpp"
30e5c31af7Sopenharmony_ci
31e5c31af7Sopenharmony_cinamespace glcts
32e5c31af7Sopenharmony_ci{
33e5c31af7Sopenharmony_ci
34e5c31af7Sopenharmony_ci/** A DEQP CTS test group that collects all tests that verify various
35e5c31af7Sopenharmony_ci *  interactions between tessellation control and tessellation evaluation
36e5c31af7Sopenharmony_ci *  shaders
37e5c31af7Sopenharmony_ci */
38e5c31af7Sopenharmony_ciclass TessellationShaderTCTETests : public glcts::TestCaseGroupBase
39e5c31af7Sopenharmony_ci{
40e5c31af7Sopenharmony_cipublic:
41e5c31af7Sopenharmony_ci	/* Public methods */
42e5c31af7Sopenharmony_ci	TessellationShaderTCTETests(glcts::Context& context, const ExtParameters& extParams);
43e5c31af7Sopenharmony_ci
44e5c31af7Sopenharmony_ci	virtual ~TessellationShaderTCTETests(void)
45e5c31af7Sopenharmony_ci	{
46e5c31af7Sopenharmony_ci	}
47e5c31af7Sopenharmony_ci
48e5c31af7Sopenharmony_ci	void init(void);
49e5c31af7Sopenharmony_ci
50e5c31af7Sopenharmony_ciprivate:
51e5c31af7Sopenharmony_ci	/* Private methods */
52e5c31af7Sopenharmony_ci	TessellationShaderTCTETests(const TessellationShaderTCTETests& other);
53e5c31af7Sopenharmony_ci	TessellationShaderTCTETests& operator=(const TessellationShaderTCTETests& other);
54e5c31af7Sopenharmony_ci};
55e5c31af7Sopenharmony_ci
56e5c31af7Sopenharmony_ci/** Implementation of Test Case 50
57e5c31af7Sopenharmony_ci *
58e5c31af7Sopenharmony_ci *  Make sure that tessellation control shader can correctly read per-vertex
59e5c31af7Sopenharmony_ci *  values, as modified by a vertex shader. Verify per-vertex gl_Position
60e5c31af7Sopenharmony_ci *  and gl_PointSize values are assigned values as in vertex shader.
61e5c31af7Sopenharmony_ci *  Make sure that per-vertex & per-patch outputs written to in tessellation
62e5c31af7Sopenharmony_ci *  control shader can be correctly read by tessellation evaluation shader.
63e5c31af7Sopenharmony_ci *  Pay special attention to gl_Position and gl_PointSize.
64e5c31af7Sopenharmony_ci *  Make sure that per-vertex output variables of a tessellation evaluation
65e5c31af7Sopenharmony_ci *  shader can be correctly read by a geometry shader.
66e5c31af7Sopenharmony_ci *
67e5c31af7Sopenharmony_ci * Note: gl_PointSize should only be passed down the rendering pipeline and
68e5c31af7Sopenharmony_ci *          then verified by the test if GL_EXT_tessellation_point_size
69e5c31af7Sopenharmony_ci *          extension support is reported.
70e5c31af7Sopenharmony_ci *
71e5c31af7Sopenharmony_ci *  1. The test should run in three iterations:
72e5c31af7Sopenharmony_ci *  1a. Vertex + TC + TE stages should be defined;
73e5c31af7Sopenharmony_ci *  1b. Vertex + TC + TE + GS stages should be defined (if geometry
74e5c31af7Sopenharmony_ci *      shaders are supported);
75e5c31af7Sopenharmony_ci *  2. The test should be run for all three tessellator primitive types,
76e5c31af7Sopenharmony_ci *     with inner and outer tessellation levels set to reasonably small
77e5c31af7Sopenharmony_ci *     values but not equal to 1 for the levels that affect the tessellation
78e5c31af7Sopenharmony_ci *     process for the primitive type considered.
79e5c31af7Sopenharmony_ci *  3. Vertex shader should set:
80e5c31af7Sopenharmony_ci *  3a. gl_Position to vec4(gl_VertexID);
81e5c31af7Sopenharmony_ci *  3b. gl_PointSize to 1.0 / float(gl_VertexID);
82e5c31af7Sopenharmony_ci *  3c. an output vec4 variable to:
83e5c31af7Sopenharmony_ci *      vec4(gl_VertexID, gl_VertexID * 0.5, gl_VertexID * 0.25, gl_VertexID * 0.125);
84e5c31af7Sopenharmony_ci *  3d. an outpt ivec4 variable to:
85e5c31af7Sopenharmony_ci *      ivec4(gl_VertexID, gl_VertexID + 1, gl_VertexID + 2, gl_VertexID + 3);
86e5c31af7Sopenharmony_ci *  4. TC shader should define corresponding input variables and patch
87e5c31af7Sopenharmony_ci *     their contents through (for gl_InvocationID invocation) to
88e5c31af7Sopenharmony_ci *     differently named output variables;
89e5c31af7Sopenharmony_ci *     gl_Position and gl_PointSize values for the invocation
90e5c31af7Sopenharmony_ci *     considered should also be forwarded.
91e5c31af7Sopenharmony_ci *     One of the invocations for each patch should also set a vec4
92e5c31af7Sopenharmony_ci *     and ivec4 per-patch variables to values as above, multiplied by two.
93e5c31af7Sopenharmony_ci *  5. TE shader should define corresponding input variables and patch
94e5c31af7Sopenharmony_ci *     their contents through to a differently named output variables;
95e5c31af7Sopenharmony_ci *     gl_Position, gl_PointSize, gl_TessLevelOuter and gl_TessLevelInner
96e5c31af7Sopenharmony_ci *     values for the primitive being processed should also be forwarded.
97e5c31af7Sopenharmony_ci *     If TC is present in the pipeline, TE stage should also define
98e5c31af7Sopenharmony_ci *     two new output variables and set them to per-patch variable
99e5c31af7Sopenharmony_ci *     values, as set by TC.
100e5c31af7Sopenharmony_ci *  6. Geometry shader should define corresponding input variables and
101e5c31af7Sopenharmony_ci *     patch their contents through to a differently named output
102e5c31af7Sopenharmony_ci *     variables;
103e5c31af7Sopenharmony_ci *  7. Test implementation should retrieve the captured data once a single
104e5c31af7Sopenharmony_ci *     instance of geometry is rendered and verify it.
105e5c31af7Sopenharmony_ci *
106e5c31af7Sopenharmony_ci **/
107e5c31af7Sopenharmony_ciclass TessellationShaderTCTEDataPassThrough : public TestCaseBase
108e5c31af7Sopenharmony_ci{
109e5c31af7Sopenharmony_cipublic:
110e5c31af7Sopenharmony_ci	/* Public methods */
111e5c31af7Sopenharmony_ci	TessellationShaderTCTEDataPassThrough(Context& context, const ExtParameters& extParams);
112e5c31af7Sopenharmony_ci
113e5c31af7Sopenharmony_ci	virtual ~TessellationShaderTCTEDataPassThrough(void)
114e5c31af7Sopenharmony_ci	{
115e5c31af7Sopenharmony_ci	}
116e5c31af7Sopenharmony_ci
117e5c31af7Sopenharmony_ci	virtual void		  deinit();
118e5c31af7Sopenharmony_ci	void				  initTest(void);
119e5c31af7Sopenharmony_ci	virtual IterateResult iterate(void);
120e5c31af7Sopenharmony_ci
121e5c31af7Sopenharmony_ciprivate:
122e5c31af7Sopenharmony_ci	/* Private type definitions */
123e5c31af7Sopenharmony_ci	/* Stores all properties of a single test run */
124e5c31af7Sopenharmony_ci	typedef struct _run
125e5c31af7Sopenharmony_ci	{
126e5c31af7Sopenharmony_ci		glw::GLuint fs_id;
127e5c31af7Sopenharmony_ci		glw::GLuint gs_id;
128e5c31af7Sopenharmony_ci		glw::GLuint po_id;
129e5c31af7Sopenharmony_ci		glw::GLuint tcs_id;
130e5c31af7Sopenharmony_ci		glw::GLuint tes_id;
131e5c31af7Sopenharmony_ci		glw::GLuint vs_id;
132e5c31af7Sopenharmony_ci
133e5c31af7Sopenharmony_ci		_tessellation_primitive_mode primitive_mode;
134e5c31af7Sopenharmony_ci		unsigned int				 n_result_vertices_per_patch;
135e5c31af7Sopenharmony_ci
136e5c31af7Sopenharmony_ci		std::vector<glw::GLfloat> result_tc_pointSize_data;
137e5c31af7Sopenharmony_ci		std::vector<_vec4>		  result_tc_position_data;
138e5c31af7Sopenharmony_ci		std::vector<_vec4>		  result_tc_value1_data;
139e5c31af7Sopenharmony_ci		std::vector<_ivec4>		  result_tc_value2_data;
140e5c31af7Sopenharmony_ci		std::vector<_vec4>		  result_te_patch_data;
141e5c31af7Sopenharmony_ci		std::vector<glw::GLfloat> result_te_pointSize_data;
142e5c31af7Sopenharmony_ci		std::vector<_vec4>		  result_te_position_data;
143e5c31af7Sopenharmony_ci
144e5c31af7Sopenharmony_ci		/* Constructor */
145e5c31af7Sopenharmony_ci		_run()
146e5c31af7Sopenharmony_ci		{
147e5c31af7Sopenharmony_ci			fs_id						= 0;
148e5c31af7Sopenharmony_ci			gs_id						= 0;
149e5c31af7Sopenharmony_ci			n_result_vertices_per_patch = 0;
150e5c31af7Sopenharmony_ci			po_id						= 0;
151e5c31af7Sopenharmony_ci			primitive_mode				= TESSELLATION_SHADER_PRIMITIVE_MODE_UNKNOWN;
152e5c31af7Sopenharmony_ci			tcs_id						= 0;
153e5c31af7Sopenharmony_ci			tes_id						= 0;
154e5c31af7Sopenharmony_ci			vs_id						= 0;
155e5c31af7Sopenharmony_ci		}
156e5c31af7Sopenharmony_ci	} _run;
157e5c31af7Sopenharmony_ci
158e5c31af7Sopenharmony_ci	/* Encapsulates all test runs */
159e5c31af7Sopenharmony_ci	typedef std::vector<_run>	 _runs;
160e5c31af7Sopenharmony_ci	typedef _runs::const_iterator _runs_const_iterator;
161e5c31af7Sopenharmony_ci
162e5c31af7Sopenharmony_ci	/* Private methods */
163e5c31af7Sopenharmony_ci	void deinitTestRun(_run& run);
164e5c31af7Sopenharmony_ci	void executeTestRun(_run& run, _tessellation_primitive_mode primitive_mode, bool should_use_geometry_shader,
165e5c31af7Sopenharmony_ci						bool should_pass_point_size_data_in_gs, bool should_pass_point_size_data_in_ts);
166e5c31af7Sopenharmony_ci
167e5c31af7Sopenharmony_ci	/* Private variables */
168e5c31af7Sopenharmony_ci	glw::GLuint				 m_bo_id;
169e5c31af7Sopenharmony_ci	const unsigned int		 m_n_input_vertices_per_run;
170e5c31af7Sopenharmony_ci	_runs					 m_runs;
171e5c31af7Sopenharmony_ci	TessellationShaderUtils* m_utils_ptr;
172e5c31af7Sopenharmony_ci	glw::GLuint				 m_vao_id;
173e5c31af7Sopenharmony_ci};
174e5c31af7Sopenharmony_ci
175e5c31af7Sopenharmony_ci/** Implementation of Test Case 52
176e5c31af7Sopenharmony_ci *
177e5c31af7Sopenharmony_ci *  This test should iterate over all vertex ordering / spacing / primitive /
178e5c31af7Sopenharmony_ci *  point mode permutations, as well as over a number of inner/outer tessellation
179e5c31af7Sopenharmony_ci *  level configurations.
180e5c31af7Sopenharmony_ci *  The tessellation evaluation shaders used for the test should:
181e5c31af7Sopenharmony_ci *
182e5c31af7Sopenharmony_ci *  - Make sure that up to gl_MaxPatchVertices vertices' data can be read in
183e5c31af7Sopenharmony_ci *    a tessellation evaluation shader.
184e5c31af7Sopenharmony_ci *  - Make sure gl_Position and gl_PointSize per-vertex variables can be
185e5c31af7Sopenharmony_ci *    accessed for all vertices.
186e5c31af7Sopenharmony_ci *
187e5c31af7Sopenharmony_ci *  The tessellation control shader used for the test should set iteration-
188e5c31af7Sopenharmony_ci *  -specific properties and configure aforementioned per-vertex variables
189e5c31af7Sopenharmony_ci *  accordingly.
190e5c31af7Sopenharmony_ci *
191e5c31af7Sopenharmony_ci *  Both pipeline objects and program objects should be used for the purpose
192e5c31af7Sopenharmony_ci *  of the test. For each case, the test should verify that correct objects
193e5c31af7Sopenharmony_ci *  defining tessellation control and tessellation stages are reported.
194e5c31af7Sopenharmony_ci *  For program objects' case, the test should also confirm that valid shader
195e5c31af7Sopenharmony_ci *  types are reported for TC and TE shader objects.
196e5c31af7Sopenharmony_ci *  The test should also verify that no objects are assigned to either
197e5c31af7Sopenharmony_ci *  stage by default.
198e5c31af7Sopenharmony_ci *
199e5c31af7Sopenharmony_ci *  The test should check that tessellation-specific properties are reported
200e5c31af7Sopenharmony_ci *  correctly.
201e5c31af7Sopenharmony_ci *
202e5c31af7Sopenharmony_ci **/
203e5c31af7Sopenharmony_ciclass TessellationShaderTCTEgl_MaxPatchVertices_Position_PointSize : public TestCaseBase
204e5c31af7Sopenharmony_ci{
205e5c31af7Sopenharmony_cipublic:
206e5c31af7Sopenharmony_ci	/* Public methods */
207e5c31af7Sopenharmony_ci	TessellationShaderTCTEgl_MaxPatchVertices_Position_PointSize(Context& context, const ExtParameters& extParams);
208e5c31af7Sopenharmony_ci
209e5c31af7Sopenharmony_ci	virtual ~TessellationShaderTCTEgl_MaxPatchVertices_Position_PointSize(void)
210e5c31af7Sopenharmony_ci	{
211e5c31af7Sopenharmony_ci	}
212e5c31af7Sopenharmony_ci
213e5c31af7Sopenharmony_ci	virtual void		  deinit();
214e5c31af7Sopenharmony_ci	void				  initTest(void);
215e5c31af7Sopenharmony_ci	virtual IterateResult iterate(void);
216e5c31af7Sopenharmony_ci
217e5c31af7Sopenharmony_ciprivate:
218e5c31af7Sopenharmony_ci	/* Private type definitions */
219e5c31af7Sopenharmony_ci	/** Describes a single test run */
220e5c31af7Sopenharmony_ci	typedef struct _run
221e5c31af7Sopenharmony_ci	{
222e5c31af7Sopenharmony_ci		glw::GLuint fs_id;
223e5c31af7Sopenharmony_ci		glw::GLuint fs_program_id;
224e5c31af7Sopenharmony_ci		glw::GLuint pipeline_object_id;
225e5c31af7Sopenharmony_ci		glw::GLuint po_id;
226e5c31af7Sopenharmony_ci		glw::GLuint tc_id;
227e5c31af7Sopenharmony_ci		glw::GLuint tc_program_id;
228e5c31af7Sopenharmony_ci		glw::GLuint te_id;
229e5c31af7Sopenharmony_ci		glw::GLuint te_program_id;
230e5c31af7Sopenharmony_ci		glw::GLuint vs_id;
231e5c31af7Sopenharmony_ci		glw::GLuint vs_program_id;
232e5c31af7Sopenharmony_ci
233e5c31af7Sopenharmony_ci		glw::GLfloat						 inner[2];
234e5c31af7Sopenharmony_ci		glw::GLfloat						 outer[4];
235e5c31af7Sopenharmony_ci		bool								 point_mode;
236e5c31af7Sopenharmony_ci		_tessellation_primitive_mode		 primitive_mode;
237e5c31af7Sopenharmony_ci		_tessellation_shader_vertex_ordering vertex_ordering;
238e5c31af7Sopenharmony_ci		_tessellation_shader_vertex_spacing  vertex_spacing;
239e5c31af7Sopenharmony_ci
240e5c31af7Sopenharmony_ci		std::vector<float>  result_pointsize_data;
241e5c31af7Sopenharmony_ci		std::vector<_vec4>  result_position_data;
242e5c31af7Sopenharmony_ci		std::vector<_vec2>  result_value1_data;
243e5c31af7Sopenharmony_ci		std::vector<_ivec4> result_value2_data;
244e5c31af7Sopenharmony_ci
245e5c31af7Sopenharmony_ci		/* Constructor */
246e5c31af7Sopenharmony_ci		_run()
247e5c31af7Sopenharmony_ci			: fs_id(0)
248e5c31af7Sopenharmony_ci			, fs_program_id(0)
249e5c31af7Sopenharmony_ci			, pipeline_object_id(0)
250e5c31af7Sopenharmony_ci			, po_id(0)
251e5c31af7Sopenharmony_ci			, tc_id(0)
252e5c31af7Sopenharmony_ci			, tc_program_id(0)
253e5c31af7Sopenharmony_ci			, te_id(0)
254e5c31af7Sopenharmony_ci			, te_program_id(0)
255e5c31af7Sopenharmony_ci			, vs_id(0)
256e5c31af7Sopenharmony_ci			, vs_program_id(0)
257e5c31af7Sopenharmony_ci			, point_mode(false)
258e5c31af7Sopenharmony_ci			, primitive_mode(TESSELLATION_SHADER_PRIMITIVE_MODE_UNKNOWN)
259e5c31af7Sopenharmony_ci			, vertex_ordering(TESSELLATION_SHADER_VERTEX_ORDERING_UNKNOWN)
260e5c31af7Sopenharmony_ci			, vertex_spacing(TESSELLATION_SHADER_VERTEX_SPACING_UNKNOWN)
261e5c31af7Sopenharmony_ci		{
262e5c31af7Sopenharmony_ci			memset(inner, 0, sizeof(inner));
263e5c31af7Sopenharmony_ci			memset(outer, 0, sizeof(outer));
264e5c31af7Sopenharmony_ci		}
265e5c31af7Sopenharmony_ci	} _run;
266e5c31af7Sopenharmony_ci
267e5c31af7Sopenharmony_ci	/** Describes a set of test runs */
268e5c31af7Sopenharmony_ci	typedef std::vector<_run>	 _runs;
269e5c31af7Sopenharmony_ci	typedef _runs::const_iterator _runs_const_iterator;
270e5c31af7Sopenharmony_ci
271e5c31af7Sopenharmony_ci	/* Private methods */
272e5c31af7Sopenharmony_ci	void deinitTestRun(_run& run);
273e5c31af7Sopenharmony_ci	std::string getFragmentShaderCode(bool should_accept_pointsize_data);
274e5c31af7Sopenharmony_ci
275e5c31af7Sopenharmony_ci	std::string getTessellationControlShaderCode(bool should_pass_pointsize_data, const glw::GLfloat* inner_tess_levels,
276e5c31af7Sopenharmony_ci												 const glw::GLfloat* outer_tess_levels);
277e5c31af7Sopenharmony_ci
278e5c31af7Sopenharmony_ci	std::string getTessellationEvaluationShaderCode(bool								 should_pass_pointsize_data,
279e5c31af7Sopenharmony_ci													_tessellation_primitive_mode		 primitive_mode,
280e5c31af7Sopenharmony_ci													_tessellation_shader_vertex_ordering vertex_ordering,
281e5c31af7Sopenharmony_ci													_tessellation_shader_vertex_spacing  vertex_spacing,
282e5c31af7Sopenharmony_ci													bool								 is_point_mode_enabled);
283e5c31af7Sopenharmony_ci
284e5c31af7Sopenharmony_ci	std::string getVertexShaderCode(bool should_pass_pointsize_data);
285e5c31af7Sopenharmony_ci	void initTestRun(_run& run);
286e5c31af7Sopenharmony_ci
287e5c31af7Sopenharmony_ci	/* Private variables */
288e5c31af7Sopenharmony_ci	glw::GLuint				 m_bo_id;
289e5c31af7Sopenharmony_ci	glw::GLint				 m_gl_max_patch_vertices_value;
290e5c31af7Sopenharmony_ci	glw::GLint				 m_gl_max_tess_gen_level_value;
291e5c31af7Sopenharmony_ci	_runs					 m_runs;
292e5c31af7Sopenharmony_ci	TessellationShaderUtils* m_utils_ptr;
293e5c31af7Sopenharmony_ci	glw::GLuint				 m_vao_id;
294e5c31af7Sopenharmony_ci};
295e5c31af7Sopenharmony_ci
296e5c31af7Sopenharmony_ci/** Implementation of Test Case 36
297e5c31af7Sopenharmony_ci *
298e5c31af7Sopenharmony_ci *  Make sure that values of gl_in[] in a tessellation evaluation shader are
299e5c31af7Sopenharmony_ci *  taken from output variables of a tessellation control shader if one is
300e5c31af7Sopenharmony_ci *  present. This test should verify that the values are not taken from
301e5c31af7Sopenharmony_ci *  a vertex shader.
302e5c31af7Sopenharmony_ci *
303e5c31af7Sopenharmony_ci *  Technical details:
304e5c31af7Sopenharmony_ci *
305e5c31af7Sopenharmony_ci *  0. A program consisting of vertex, TC and TE stages should be considered.
306e5c31af7Sopenharmony_ci *  1. Vertex shader should output a set of output variables of different types.
307e5c31af7Sopenharmony_ci *  2. TC shader should define exactly the same set of output variables.
308e5c31af7Sopenharmony_ci *     The data the shader writes to these variables must be different than
309e5c31af7Sopenharmony_ci *     in the vertex shader's case.
310e5c31af7Sopenharmony_ci *  3. TE shader should define these variables as input variables. It should
311e5c31af7Sopenharmony_ci *     copy their values to a set of corresponding output variables, which
312e5c31af7Sopenharmony_ci *     the test should then validate by means of Transform Feedback.
313e5c31af7Sopenharmony_ci *
314e5c31af7Sopenharmony_ci **/
315e5c31af7Sopenharmony_ciclass TessellationShaderTCTEgl_in : public TestCaseBase
316e5c31af7Sopenharmony_ci{
317e5c31af7Sopenharmony_cipublic:
318e5c31af7Sopenharmony_ci	/* Public methods */
319e5c31af7Sopenharmony_ci	TessellationShaderTCTEgl_in(Context& context, const ExtParameters& extParams);
320e5c31af7Sopenharmony_ci
321e5c31af7Sopenharmony_ci	virtual ~TessellationShaderTCTEgl_in(void)
322e5c31af7Sopenharmony_ci	{
323e5c31af7Sopenharmony_ci	}
324e5c31af7Sopenharmony_ci
325e5c31af7Sopenharmony_ci	virtual void		  deinit();
326e5c31af7Sopenharmony_ci	void				  initTest(void);
327e5c31af7Sopenharmony_ci	virtual IterateResult iterate(void);
328e5c31af7Sopenharmony_ci
329e5c31af7Sopenharmony_ciprivate:
330e5c31af7Sopenharmony_ci	/* Private methods */
331e5c31af7Sopenharmony_ci	void getXFBProperties(const glw::GLchar*** out_names, glw::GLint* out_n_names, glw::GLint* out_xfb_size);
332e5c31af7Sopenharmony_ci
333e5c31af7Sopenharmony_ci	/* Private variables */
334e5c31af7Sopenharmony_ci	glw::GLuint m_bo_id;
335e5c31af7Sopenharmony_ci	glw::GLuint m_fs_id;
336e5c31af7Sopenharmony_ci	glw::GLuint m_po_id;
337e5c31af7Sopenharmony_ci	glw::GLuint m_tcs_id;
338e5c31af7Sopenharmony_ci	glw::GLuint m_tes_id;
339e5c31af7Sopenharmony_ci	glw::GLuint m_vao_id;
340e5c31af7Sopenharmony_ci	glw::GLuint m_vs_id;
341e5c31af7Sopenharmony_ci};
342e5c31af7Sopenharmony_ci
343e5c31af7Sopenharmony_ci/**  Implementation of Test Case 37
344e5c31af7Sopenharmony_ci *
345e5c31af7Sopenharmony_ci *   Make sure that gl_TessLevelOuter[] and gl_TessLevelInner[] accessed from
346e5c31af7Sopenharmony_ci *   tessellation evaluation shader hold values, as used in tessellation control
347e5c31af7Sopenharmony_ci *   shader for a processed patch (assuming tessellation control shader is
348e5c31af7Sopenharmony_ci *   present in the pipeline)
349e5c31af7Sopenharmony_ci *   Make sure that gl_TessLevelOuter[] and gl_TessLevelInner[] accessed from
350e5c31af7Sopenharmony_ci *   tessellation evaluation shader hold patch parameter values, if no
351e5c31af7Sopenharmony_ci *   tessellation control shader is present in the pipeline.
352e5c31af7Sopenharmony_ci *   Reported values should not be clamped and rounded, owing to active
353e5c31af7Sopenharmony_ci *   vertex spacing mode.
354e5c31af7Sopenharmony_ci *
355e5c31af7Sopenharmony_ci *   Technical details:
356e5c31af7Sopenharmony_ci *
357e5c31af7Sopenharmony_ci *   0. The test should use two program objects: one defining a TC stage,
358e5c31af7Sopenharmony_ci *      the other one should lack a tessellation control shader.
359e5c31af7Sopenharmony_ci *   1. For the first case, the test implementation should check a couple
360e5c31af7Sopenharmony_ci *      of different inner/outer tessellation level configurations by reading
361e5c31af7Sopenharmony_ci *      them from an uniform that the test will update prior to doing a draw
362e5c31af7Sopenharmony_ci *      call.
363e5c31af7Sopenharmony_ci *      For the other case, the parameters can be modified using ES API.
364e5c31af7Sopenharmony_ci *   2. TE should output inner and output tessellation levels to a varying,
365e5c31af7Sopenharmony_ci *      for which Transform Feedback should be configured.
366e5c31af7Sopenharmony_ci *   3. Test passes if tessellation levels in TE stage match the ones
367e5c31af7Sopenharmony_ci *      defined in TC stage. Pay attention to making sure no clamping
368e5c31af7Sopenharmony_ci *      or rounding occurs for any vertex spacing mode.
369e5c31af7Sopenharmony_ci *
370e5c31af7Sopenharmony_ci **/
371e5c31af7Sopenharmony_ciclass TessellationShaderTCTEgl_TessLevel : public TestCaseBase
372e5c31af7Sopenharmony_ci{
373e5c31af7Sopenharmony_cipublic:
374e5c31af7Sopenharmony_ci	/* Public methods */
375e5c31af7Sopenharmony_ci	TessellationShaderTCTEgl_TessLevel(Context& context, const ExtParameters& extParams);
376e5c31af7Sopenharmony_ci
377e5c31af7Sopenharmony_ci	virtual ~TessellationShaderTCTEgl_TessLevel(void)
378e5c31af7Sopenharmony_ci	{
379e5c31af7Sopenharmony_ci	}
380e5c31af7Sopenharmony_ci
381e5c31af7Sopenharmony_ci	virtual void		  deinit();
382e5c31af7Sopenharmony_ci	void				  initTest(void);
383e5c31af7Sopenharmony_ci	virtual IterateResult iterate(void);
384e5c31af7Sopenharmony_ci
385e5c31af7Sopenharmony_ciprivate:
386e5c31af7Sopenharmony_ci	/* Private type definitions */
387e5c31af7Sopenharmony_ci	typedef struct _test_descriptor
388e5c31af7Sopenharmony_ci	{
389e5c31af7Sopenharmony_ci		_tessellation_test_type				type;
390e5c31af7Sopenharmony_ci		_tessellation_shader_vertex_spacing vertex_spacing;
391e5c31af7Sopenharmony_ci
392e5c31af7Sopenharmony_ci		glw::GLuint fs_id;
393e5c31af7Sopenharmony_ci		glw::GLuint po_id;
394e5c31af7Sopenharmony_ci		glw::GLuint tcs_id;
395e5c31af7Sopenharmony_ci		glw::GLuint tes_id;
396e5c31af7Sopenharmony_ci		glw::GLuint vs_id;
397e5c31af7Sopenharmony_ci
398e5c31af7Sopenharmony_ci		glw::GLint inner_tess_levels_uniform_location;
399e5c31af7Sopenharmony_ci		glw::GLint outer_tess_levels_uniform_location;
400e5c31af7Sopenharmony_ci
401e5c31af7Sopenharmony_ci		_test_descriptor()
402e5c31af7Sopenharmony_ci		{
403e5c31af7Sopenharmony_ci			fs_id  = 0;
404e5c31af7Sopenharmony_ci			po_id  = 0;
405e5c31af7Sopenharmony_ci			tcs_id = 0;
406e5c31af7Sopenharmony_ci			tes_id = 0;
407e5c31af7Sopenharmony_ci			vs_id  = 0;
408e5c31af7Sopenharmony_ci
409e5c31af7Sopenharmony_ci			inner_tess_levels_uniform_location = 0;
410e5c31af7Sopenharmony_ci			outer_tess_levels_uniform_location = 0;
411e5c31af7Sopenharmony_ci
412e5c31af7Sopenharmony_ci			type		   = TESSELLATION_TEST_TYPE_COUNT;
413e5c31af7Sopenharmony_ci			vertex_spacing = TESSELLATION_SHADER_VERTEX_SPACING_UNKNOWN;
414e5c31af7Sopenharmony_ci		}
415e5c31af7Sopenharmony_ci	} _test_descriptor;
416e5c31af7Sopenharmony_ci
417e5c31af7Sopenharmony_ci	typedef std::vector<_test_descriptor> _tests;
418e5c31af7Sopenharmony_ci	typedef _tests::const_iterator		  _tests_const_iterator;
419e5c31af7Sopenharmony_ci
420e5c31af7Sopenharmony_ci	/* Private methods */
421e5c31af7Sopenharmony_ci	void deinitTestDescriptor(_test_descriptor* test_ptr);
422e5c31af7Sopenharmony_ci
423e5c31af7Sopenharmony_ci	void initTestDescriptor(_tessellation_test_type test_type, _test_descriptor* out_test_ptr,
424e5c31af7Sopenharmony_ci							_tessellation_shader_vertex_spacing vertex_spacing_mode);
425e5c31af7Sopenharmony_ci
426e5c31af7Sopenharmony_ci	/* Private variables */
427e5c31af7Sopenharmony_ci	glw::GLint m_gl_max_tess_gen_level_value;
428e5c31af7Sopenharmony_ci
429e5c31af7Sopenharmony_ci	glw::GLuint m_bo_id;
430e5c31af7Sopenharmony_ci	_tests		m_tests;
431e5c31af7Sopenharmony_ci	glw::GLuint m_vao_id;
432e5c31af7Sopenharmony_ci};
433e5c31af7Sopenharmony_ci
434e5c31af7Sopenharmony_ci/**  Implementation of Test Case 35
435e5c31af7Sopenharmony_ci *
436e5c31af7Sopenharmony_ci *   Make sure that the number of vertices in input patch of a tessellation
437e5c31af7Sopenharmony_ci *   evaluation shader is:
438e5c31af7Sopenharmony_ci *
439e5c31af7Sopenharmony_ci *   * fixed and equal to tessellation control shader output patch size parameter
440e5c31af7Sopenharmony_ci *     from the time the program object was linked last time, should tessellation
441e5c31af7Sopenharmony_ci *     control shader be present in the pipeline;
442e5c31af7Sopenharmony_ci *   * equal to patch size parameter at the time of a draw call, if there
443e5c31af7Sopenharmony_ci *     is no tessellation control shader present in the pipeline.
444e5c31af7Sopenharmony_ci *
445e5c31af7Sopenharmony_ci *   Technical details:
446e5c31af7Sopenharmony_ci *
447e5c31af7Sopenharmony_ci *   0. Apart from the two cases described in the test summary, the implementation
448e5c31af7Sopenharmony_ci *      should also iterate over a number of different patch size values.
449e5c31af7Sopenharmony_ci *   1. TE shader should save gl_PatchVerticesIn.length() in an output
450e5c31af7Sopenharmony_ci *      variable. This variable should be XFBed to a buffer object and then
451e5c31af7Sopenharmony_ci *      verified in the actual test.
452e5c31af7Sopenharmony_ci *
453e5c31af7Sopenharmony_ci **/
454e5c31af7Sopenharmony_ciclass TessellationShaderTCTEgl_PatchVerticesIn : public TestCaseBase
455e5c31af7Sopenharmony_ci{
456e5c31af7Sopenharmony_cipublic:
457e5c31af7Sopenharmony_ci	/* Public methods */
458e5c31af7Sopenharmony_ci	TessellationShaderTCTEgl_PatchVerticesIn(Context& context, const ExtParameters& extParams);
459e5c31af7Sopenharmony_ci
460e5c31af7Sopenharmony_ci	virtual ~TessellationShaderTCTEgl_PatchVerticesIn(void)
461e5c31af7Sopenharmony_ci	{
462e5c31af7Sopenharmony_ci	}
463e5c31af7Sopenharmony_ci
464e5c31af7Sopenharmony_ci	virtual void		  deinit();
465e5c31af7Sopenharmony_ci	void				  initTest(void);
466e5c31af7Sopenharmony_ci	virtual IterateResult iterate(void);
467e5c31af7Sopenharmony_ci
468e5c31af7Sopenharmony_ciprivate:
469e5c31af7Sopenharmony_ci	/* Private type definitions */
470e5c31af7Sopenharmony_ci	typedef struct _test_descriptor
471e5c31af7Sopenharmony_ci	{
472e5c31af7Sopenharmony_ci		_tessellation_test_type type;
473e5c31af7Sopenharmony_ci
474e5c31af7Sopenharmony_ci		glw::GLuint fs_id;
475e5c31af7Sopenharmony_ci		glw::GLuint po_id;
476e5c31af7Sopenharmony_ci		glw::GLuint tcs_id;
477e5c31af7Sopenharmony_ci		glw::GLuint tes_id;
478e5c31af7Sopenharmony_ci		glw::GLuint vs_id;
479e5c31af7Sopenharmony_ci
480e5c31af7Sopenharmony_ci		unsigned int input_patch_size;
481e5c31af7Sopenharmony_ci
482e5c31af7Sopenharmony_ci		_test_descriptor()
483e5c31af7Sopenharmony_ci		{
484e5c31af7Sopenharmony_ci			fs_id  = 0;
485e5c31af7Sopenharmony_ci			po_id  = 0;
486e5c31af7Sopenharmony_ci			tcs_id = 0;
487e5c31af7Sopenharmony_ci			tes_id = 0;
488e5c31af7Sopenharmony_ci			vs_id  = 0;
489e5c31af7Sopenharmony_ci
490e5c31af7Sopenharmony_ci			input_patch_size = 0;
491e5c31af7Sopenharmony_ci			type			 = TESSELLATION_TEST_TYPE_COUNT;
492e5c31af7Sopenharmony_ci		}
493e5c31af7Sopenharmony_ci	} _test_descriptor;
494e5c31af7Sopenharmony_ci
495e5c31af7Sopenharmony_ci	typedef std::vector<_test_descriptor> _tests;
496e5c31af7Sopenharmony_ci	typedef _tests::const_iterator		  _tests_const_iterator;
497e5c31af7Sopenharmony_ci
498e5c31af7Sopenharmony_ci	/* Private methods */
499e5c31af7Sopenharmony_ci	void deinitTestDescriptor(_test_descriptor* test_ptr);
500e5c31af7Sopenharmony_ci	void initTestDescriptor(_tessellation_test_type test_type, _test_descriptor* out_test_ptr,
501e5c31af7Sopenharmony_ci							unsigned int input_patch_size);
502e5c31af7Sopenharmony_ci
503e5c31af7Sopenharmony_ci	/* Private variables */
504e5c31af7Sopenharmony_ci	glw::GLint m_gl_max_patch_vertices_value;
505e5c31af7Sopenharmony_ci
506e5c31af7Sopenharmony_ci	glw::GLuint m_bo_id;
507e5c31af7Sopenharmony_ci	_tests		m_tests;
508e5c31af7Sopenharmony_ci	glw::GLuint m_vao_id;
509e5c31af7Sopenharmony_ci};
510e5c31af7Sopenharmony_ci
511e5c31af7Sopenharmony_ci} // namespace glcts
512e5c31af7Sopenharmony_ci
513e5c31af7Sopenharmony_ci#endif // _ESEXTCTESSELLATIONSHADERTCTE_HPP
514