1e5c31af7Sopenharmony_ci/*-------------------------------------------------------------------------
2e5c31af7Sopenharmony_ci * drawElements Quality Program OpenGL ES 3.0 Module
3e5c31af7Sopenharmony_ci * -------------------------------------------------
4e5c31af7Sopenharmony_ci *
5e5c31af7Sopenharmony_ci * Copyright 2014 The Android Open Source Project
6e5c31af7Sopenharmony_ci *
7e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
8e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License.
9e5c31af7Sopenharmony_ci * You may obtain a copy of the License at
10e5c31af7Sopenharmony_ci *
11e5c31af7Sopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
12e5c31af7Sopenharmony_ci *
13e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
14e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
15e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and
17e5c31af7Sopenharmony_ci * limitations under the License.
18e5c31af7Sopenharmony_ci *
19e5c31af7Sopenharmony_ci *//*!
20e5c31af7Sopenharmony_ci * \file
21e5c31af7Sopenharmony_ci * \brief Vertex array and buffer tests
22e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ci#include "es3fVertexArrayTest.hpp"
25e5c31af7Sopenharmony_ci#include "glsVertexArrayTests.hpp"
26e5c31af7Sopenharmony_ci
27e5c31af7Sopenharmony_ci#include <sstream>
28e5c31af7Sopenharmony_ci
29e5c31af7Sopenharmony_ciusing namespace deqp::gls;
30e5c31af7Sopenharmony_ci
31e5c31af7Sopenharmony_cinamespace deqp
32e5c31af7Sopenharmony_ci{
33e5c31af7Sopenharmony_cinamespace gles3
34e5c31af7Sopenharmony_ci{
35e5c31af7Sopenharmony_cinamespace Functional
36e5c31af7Sopenharmony_ci{
37e5c31af7Sopenharmony_ci
38e5c31af7Sopenharmony_ciclass SingleVertexArrayUsageGroup : public TestCaseGroup
39e5c31af7Sopenharmony_ci{
40e5c31af7Sopenharmony_cipublic:
41e5c31af7Sopenharmony_ci									SingleVertexArrayUsageGroup		(Context& context, Array::Usage usage);
42e5c31af7Sopenharmony_ci	virtual							~SingleVertexArrayUsageGroup	(void);
43e5c31af7Sopenharmony_ci
44e5c31af7Sopenharmony_ci	virtual void					init							(void);
45e5c31af7Sopenharmony_ci
46e5c31af7Sopenharmony_ciprivate:
47e5c31af7Sopenharmony_ci									SingleVertexArrayUsageGroup		(const SingleVertexArrayUsageGroup& other);
48e5c31af7Sopenharmony_ci	SingleVertexArrayUsageGroup&	operator=						(const SingleVertexArrayUsageGroup& other);
49e5c31af7Sopenharmony_ci
50e5c31af7Sopenharmony_ci	Array::Usage					m_usage;
51e5c31af7Sopenharmony_ci};
52e5c31af7Sopenharmony_ci
53e5c31af7Sopenharmony_ciSingleVertexArrayUsageGroup::SingleVertexArrayUsageGroup (Context& context, Array::Usage usage)
54e5c31af7Sopenharmony_ci	: TestCaseGroup	(context, Array::usageTypeToString(usage).c_str(), Array::usageTypeToString(usage).c_str())
55e5c31af7Sopenharmony_ci	, m_usage		(usage)
56e5c31af7Sopenharmony_ci{
57e5c31af7Sopenharmony_ci}
58e5c31af7Sopenharmony_ci
59e5c31af7Sopenharmony_ciSingleVertexArrayUsageGroup::~SingleVertexArrayUsageGroup (void)
60e5c31af7Sopenharmony_ci{
61e5c31af7Sopenharmony_ci}
62e5c31af7Sopenharmony_ci
63e5c31af7Sopenharmony_citemplate<class T>
64e5c31af7Sopenharmony_cistatic std::string typeToString (T t)
65e5c31af7Sopenharmony_ci{
66e5c31af7Sopenharmony_ci	std::stringstream strm;
67e5c31af7Sopenharmony_ci	strm << t;
68e5c31af7Sopenharmony_ci	return strm.str();
69e5c31af7Sopenharmony_ci}
70e5c31af7Sopenharmony_ci
71e5c31af7Sopenharmony_civoid SingleVertexArrayUsageGroup::init (void)
72e5c31af7Sopenharmony_ci{
73e5c31af7Sopenharmony_ci	int					counts[]		= {1, 256};
74e5c31af7Sopenharmony_ci	int					strides[]		= {0, -1, 17, 32}; // Tread negative value as sizeof input. Same as 0, but done outside of GL.
75e5c31af7Sopenharmony_ci	Array::InputType	inputTypes[]	= {Array::INPUTTYPE_FLOAT, Array::INPUTTYPE_FIXED, Array::INPUTTYPE_SHORT, Array::INPUTTYPE_BYTE};
76e5c31af7Sopenharmony_ci
77e5c31af7Sopenharmony_ci	for (int inputTypeNdx = 0; inputTypeNdx < DE_LENGTH_OF_ARRAY(inputTypes); inputTypeNdx++)
78e5c31af7Sopenharmony_ci	{
79e5c31af7Sopenharmony_ci		for (int countNdx = 0; countNdx < DE_LENGTH_OF_ARRAY(counts); countNdx++)
80e5c31af7Sopenharmony_ci		{
81e5c31af7Sopenharmony_ci			for (int strideNdx = 0; strideNdx < DE_LENGTH_OF_ARRAY(strides); strideNdx++)
82e5c31af7Sopenharmony_ci			{
83e5c31af7Sopenharmony_ci				const int			stride	= (strides[strideNdx] < 0 ? Array::inputTypeSize(inputTypes[inputTypeNdx]) * 2 : strides[strideNdx]);
84e5c31af7Sopenharmony_ci				const bool			aligned	= (stride % Array::inputTypeSize(inputTypes[inputTypeNdx])) == 0;
85e5c31af7Sopenharmony_ci				const std::string	name	= "stride" + typeToString(stride) + "_" + Array::inputTypeToString(inputTypes[inputTypeNdx]) + "_quads" + typeToString(counts[countNdx]);
86e5c31af7Sopenharmony_ci
87e5c31af7Sopenharmony_ci				MultiVertexArrayTest::Spec::ArraySpec arraySpec(inputTypes[inputTypeNdx],
88e5c31af7Sopenharmony_ci																Array::OUTPUTTYPE_VEC2,
89e5c31af7Sopenharmony_ci																Array::STORAGE_BUFFER,
90e5c31af7Sopenharmony_ci																m_usage,
91e5c31af7Sopenharmony_ci																2,
92e5c31af7Sopenharmony_ci																0,
93e5c31af7Sopenharmony_ci																stride,
94e5c31af7Sopenharmony_ci																false,
95e5c31af7Sopenharmony_ci																GLValue::getMinValue(inputTypes[inputTypeNdx]),
96e5c31af7Sopenharmony_ci																GLValue::getMaxValue(inputTypes[inputTypeNdx]));
97e5c31af7Sopenharmony_ci
98e5c31af7Sopenharmony_ci				MultiVertexArrayTest::Spec spec;
99e5c31af7Sopenharmony_ci				spec.primitive	= Array::PRIMITIVE_TRIANGLES;
100e5c31af7Sopenharmony_ci				spec.drawCount	= counts[countNdx];
101e5c31af7Sopenharmony_ci				spec.first		= 0;
102e5c31af7Sopenharmony_ci				spec.arrays.push_back(arraySpec);
103e5c31af7Sopenharmony_ci
104e5c31af7Sopenharmony_ci				if (aligned)
105e5c31af7Sopenharmony_ci					addChild(new MultiVertexArrayTest(m_testCtx, m_context.getRenderContext(), spec, name.c_str(), name.c_str()));
106e5c31af7Sopenharmony_ci			}
107e5c31af7Sopenharmony_ci		}
108e5c31af7Sopenharmony_ci	}
109e5c31af7Sopenharmony_ci}
110e5c31af7Sopenharmony_ci
111e5c31af7Sopenharmony_ciclass SingleVertexArrayUsageTests : public TestCaseGroup
112e5c31af7Sopenharmony_ci{
113e5c31af7Sopenharmony_cipublic:
114e5c31af7Sopenharmony_ci									SingleVertexArrayUsageTests		(Context& context);
115e5c31af7Sopenharmony_ci	virtual							~SingleVertexArrayUsageTests	(void);
116e5c31af7Sopenharmony_ci
117e5c31af7Sopenharmony_ci	virtual void					init							(void);
118e5c31af7Sopenharmony_ci
119e5c31af7Sopenharmony_ciprivate:
120e5c31af7Sopenharmony_ci									SingleVertexArrayUsageTests		(const SingleVertexArrayUsageTests& other);
121e5c31af7Sopenharmony_ci	SingleVertexArrayUsageTests&	operator=						(const SingleVertexArrayUsageTests& other);
122e5c31af7Sopenharmony_ci};
123e5c31af7Sopenharmony_ci
124e5c31af7Sopenharmony_ciSingleVertexArrayUsageTests::SingleVertexArrayUsageTests (Context& context)
125e5c31af7Sopenharmony_ci	: TestCaseGroup(context, "usages", "Single vertex atribute, usage")
126e5c31af7Sopenharmony_ci{
127e5c31af7Sopenharmony_ci}
128e5c31af7Sopenharmony_ci
129e5c31af7Sopenharmony_ciSingleVertexArrayUsageTests::~SingleVertexArrayUsageTests (void)
130e5c31af7Sopenharmony_ci{
131e5c31af7Sopenharmony_ci}
132e5c31af7Sopenharmony_ci
133e5c31af7Sopenharmony_civoid SingleVertexArrayUsageTests::init (void)
134e5c31af7Sopenharmony_ci{
135e5c31af7Sopenharmony_ci	// Test usage
136e5c31af7Sopenharmony_ci	Array::Usage		usages[]		= { Array::USAGE_STATIC_DRAW, Array::USAGE_STREAM_DRAW, Array::USAGE_DYNAMIC_DRAW, Array::USAGE_STATIC_COPY, Array::USAGE_STREAM_COPY, Array::USAGE_DYNAMIC_COPY, Array::USAGE_STATIC_READ, Array::USAGE_STREAM_READ, Array::USAGE_DYNAMIC_READ };
137e5c31af7Sopenharmony_ci	for (int usageNdx = 0; usageNdx < DE_LENGTH_OF_ARRAY(usages); usageNdx++)
138e5c31af7Sopenharmony_ci	{
139e5c31af7Sopenharmony_ci		addChild(new SingleVertexArrayUsageGroup(m_context, usages[usageNdx]));
140e5c31af7Sopenharmony_ci	}
141e5c31af7Sopenharmony_ci}
142e5c31af7Sopenharmony_ci
143e5c31af7Sopenharmony_ciclass SingleVertexArrayStrideGroup : public TestCaseGroup
144e5c31af7Sopenharmony_ci{
145e5c31af7Sopenharmony_cipublic:
146e5c31af7Sopenharmony_ci									SingleVertexArrayStrideGroup	(Context& context, Array::InputType type);
147e5c31af7Sopenharmony_ci	virtual							~SingleVertexArrayStrideGroup	(void);
148e5c31af7Sopenharmony_ci
149e5c31af7Sopenharmony_ci	virtual void					init							(void);
150e5c31af7Sopenharmony_ci
151e5c31af7Sopenharmony_ciprivate:
152e5c31af7Sopenharmony_ci									SingleVertexArrayStrideGroup	(const SingleVertexArrayStrideGroup& other);
153e5c31af7Sopenharmony_ci	SingleVertexArrayStrideGroup&	operator=						(const SingleVertexArrayStrideGroup& other);
154e5c31af7Sopenharmony_ci
155e5c31af7Sopenharmony_ci	Array::InputType				m_type;
156e5c31af7Sopenharmony_ci};
157e5c31af7Sopenharmony_ci
158e5c31af7Sopenharmony_ciSingleVertexArrayStrideGroup::SingleVertexArrayStrideGroup (Context& context, Array::InputType type)
159e5c31af7Sopenharmony_ci	: TestCaseGroup	(context, Array::inputTypeToString(type).c_str(), Array::inputTypeToString(type).c_str())
160e5c31af7Sopenharmony_ci	, m_type		(type)
161e5c31af7Sopenharmony_ci{
162e5c31af7Sopenharmony_ci}
163e5c31af7Sopenharmony_ci
164e5c31af7Sopenharmony_ciSingleVertexArrayStrideGroup::~SingleVertexArrayStrideGroup (void)
165e5c31af7Sopenharmony_ci{
166e5c31af7Sopenharmony_ci}
167e5c31af7Sopenharmony_ci
168e5c31af7Sopenharmony_civoid SingleVertexArrayStrideGroup::init (void)
169e5c31af7Sopenharmony_ci{
170e5c31af7Sopenharmony_ci	Array::Storage		storages[]		= {Array::STORAGE_USER, Array::STORAGE_BUFFER};
171e5c31af7Sopenharmony_ci	int					counts[]		= {1, 256};
172e5c31af7Sopenharmony_ci	int					strides[]		= {/*0,*/ -1, 17, 32}; // Tread negative value as sizeof input. Same as 0, but done outside of GL.
173e5c31af7Sopenharmony_ci
174e5c31af7Sopenharmony_ci	for (int storageNdx = 0; storageNdx < DE_LENGTH_OF_ARRAY(storages); storageNdx++)
175e5c31af7Sopenharmony_ci	{
176e5c31af7Sopenharmony_ci		for (int componentCount = 2; componentCount < 5; componentCount++)
177e5c31af7Sopenharmony_ci		{
178e5c31af7Sopenharmony_ci			for (int countNdx = 0; countNdx < DE_LENGTH_OF_ARRAY(counts); countNdx++)
179e5c31af7Sopenharmony_ci			{
180e5c31af7Sopenharmony_ci				for (int strideNdx = 0; strideNdx < DE_LENGTH_OF_ARRAY(strides); strideNdx++)
181e5c31af7Sopenharmony_ci				{
182e5c31af7Sopenharmony_ci					const bool	packed			= m_type == Array::INPUTTYPE_UNSIGNED_INT_2_10_10_10 || m_type == Array::INPUTTYPE_INT_2_10_10_10;
183e5c31af7Sopenharmony_ci					const int	stride			= (strides[strideNdx] < 0) ? ((packed) ? (16) : (Array::inputTypeSize(m_type) * componentCount)) : (strides[strideNdx]);
184e5c31af7Sopenharmony_ci					const int	alignment		= (packed) ? (Array::inputTypeSize(m_type) * componentCount) : (Array::inputTypeSize(m_type));
185e5c31af7Sopenharmony_ci					const bool	bufferUnaligned	= (storages[storageNdx] == Array::STORAGE_BUFFER) && (stride % alignment) != 0;
186e5c31af7Sopenharmony_ci
187e5c31af7Sopenharmony_ci					std::string name = Array::storageToString(storages[storageNdx]) + "_stride" + typeToString(stride) + "_components" + typeToString(componentCount) + "_quads" + typeToString(counts[countNdx]);
188e5c31af7Sopenharmony_ci
189e5c31af7Sopenharmony_ci					if((m_type == Array::INPUTTYPE_UNSIGNED_INT_2_10_10_10 || m_type == Array::INPUTTYPE_INT_2_10_10_10) && componentCount != 4)
190e5c31af7Sopenharmony_ci						continue;
191e5c31af7Sopenharmony_ci
192e5c31af7Sopenharmony_ci					MultiVertexArrayTest::Spec::ArraySpec arraySpec(m_type,
193e5c31af7Sopenharmony_ci																	Array::OUTPUTTYPE_VEC4,
194e5c31af7Sopenharmony_ci																	storages[storageNdx],
195e5c31af7Sopenharmony_ci																	Array::USAGE_DYNAMIC_DRAW,
196e5c31af7Sopenharmony_ci																	componentCount,
197e5c31af7Sopenharmony_ci																	0,
198e5c31af7Sopenharmony_ci																	stride,
199e5c31af7Sopenharmony_ci																	false,
200e5c31af7Sopenharmony_ci																	GLValue::getMinValue(m_type),
201e5c31af7Sopenharmony_ci																	GLValue::getMaxValue(m_type));
202e5c31af7Sopenharmony_ci
203e5c31af7Sopenharmony_ci					MultiVertexArrayTest::Spec spec;
204e5c31af7Sopenharmony_ci					spec.primitive	= Array::PRIMITIVE_TRIANGLES;
205e5c31af7Sopenharmony_ci					spec.drawCount	= counts[countNdx];
206e5c31af7Sopenharmony_ci					spec.first		= 0;
207e5c31af7Sopenharmony_ci					spec.arrays.push_back(arraySpec);
208e5c31af7Sopenharmony_ci
209e5c31af7Sopenharmony_ci					if (!bufferUnaligned)
210e5c31af7Sopenharmony_ci						addChild(new MultiVertexArrayTest(m_testCtx, m_context.getRenderContext(), spec, name.c_str(), name.c_str()));
211e5c31af7Sopenharmony_ci				}
212e5c31af7Sopenharmony_ci			}
213e5c31af7Sopenharmony_ci		}
214e5c31af7Sopenharmony_ci	}
215e5c31af7Sopenharmony_ci}
216e5c31af7Sopenharmony_ci
217e5c31af7Sopenharmony_ciclass SingleVertexArrayStrideTests : public TestCaseGroup
218e5c31af7Sopenharmony_ci{
219e5c31af7Sopenharmony_cipublic:
220e5c31af7Sopenharmony_ci									SingleVertexArrayStrideTests	(Context& context);
221e5c31af7Sopenharmony_ci	virtual							~SingleVertexArrayStrideTests	(void);
222e5c31af7Sopenharmony_ci
223e5c31af7Sopenharmony_ci	virtual void					init							(void);
224e5c31af7Sopenharmony_ci
225e5c31af7Sopenharmony_ciprivate:
226e5c31af7Sopenharmony_ci									SingleVertexArrayStrideTests	(const SingleVertexArrayStrideTests& other);
227e5c31af7Sopenharmony_ci	SingleVertexArrayStrideTests&	operator=						(const SingleVertexArrayStrideTests& other);
228e5c31af7Sopenharmony_ci};
229e5c31af7Sopenharmony_ci
230e5c31af7Sopenharmony_ciSingleVertexArrayStrideTests::SingleVertexArrayStrideTests (Context& context)
231e5c31af7Sopenharmony_ci	: TestCaseGroup(context, "strides", "Single stride vertex atribute")
232e5c31af7Sopenharmony_ci{
233e5c31af7Sopenharmony_ci}
234e5c31af7Sopenharmony_ci
235e5c31af7Sopenharmony_ciSingleVertexArrayStrideTests::~SingleVertexArrayStrideTests (void)
236e5c31af7Sopenharmony_ci{
237e5c31af7Sopenharmony_ci}
238e5c31af7Sopenharmony_ci
239e5c31af7Sopenharmony_civoid SingleVertexArrayStrideTests::init (void)
240e5c31af7Sopenharmony_ci{
241e5c31af7Sopenharmony_ci	Array::InputType	inputTypes[]	= {Array::INPUTTYPE_FLOAT, Array::INPUTTYPE_SHORT, Array::INPUTTYPE_BYTE, /*Array::INPUTTYPE_UNSIGNED_SHORT, Array::INPUTTYPE_UNSIGNED_BYTE,*/ Array::INPUTTYPE_FIXED, Array::INPUTTYPE_INT_2_10_10_10 };
242e5c31af7Sopenharmony_ci
243e5c31af7Sopenharmony_ci	for (int inputTypeNdx = 0; inputTypeNdx < DE_LENGTH_OF_ARRAY(inputTypes); inputTypeNdx++)
244e5c31af7Sopenharmony_ci	{
245e5c31af7Sopenharmony_ci		addChild(new SingleVertexArrayStrideGroup(m_context, inputTypes[inputTypeNdx]));
246e5c31af7Sopenharmony_ci	}
247e5c31af7Sopenharmony_ci}
248e5c31af7Sopenharmony_ci
249e5c31af7Sopenharmony_ciclass SingleVertexArrayFirstGroup : public TestCaseGroup
250e5c31af7Sopenharmony_ci{
251e5c31af7Sopenharmony_cipublic:
252e5c31af7Sopenharmony_ci									SingleVertexArrayFirstGroup	(Context& context, Array::InputType type);
253e5c31af7Sopenharmony_ci	virtual							~SingleVertexArrayFirstGroup	(void);
254e5c31af7Sopenharmony_ci
255e5c31af7Sopenharmony_ci	virtual void					init							(void);
256e5c31af7Sopenharmony_ci
257e5c31af7Sopenharmony_ciprivate:
258e5c31af7Sopenharmony_ci									SingleVertexArrayFirstGroup	(const SingleVertexArrayFirstGroup& other);
259e5c31af7Sopenharmony_ci	SingleVertexArrayFirstGroup&	operator=						(const SingleVertexArrayFirstGroup& other);
260e5c31af7Sopenharmony_ci	Array::InputType				m_type;
261e5c31af7Sopenharmony_ci};
262e5c31af7Sopenharmony_ci
263e5c31af7Sopenharmony_ciSingleVertexArrayFirstGroup::SingleVertexArrayFirstGroup (Context& context, Array::InputType type)
264e5c31af7Sopenharmony_ci	: TestCaseGroup	(context, Array::inputTypeToString(type).c_str(), Array::inputTypeToString(type).c_str())
265e5c31af7Sopenharmony_ci	, m_type		(type)
266e5c31af7Sopenharmony_ci{
267e5c31af7Sopenharmony_ci}
268e5c31af7Sopenharmony_ci
269e5c31af7Sopenharmony_ciSingleVertexArrayFirstGroup::~SingleVertexArrayFirstGroup (void)
270e5c31af7Sopenharmony_ci{
271e5c31af7Sopenharmony_ci}
272e5c31af7Sopenharmony_ci
273e5c31af7Sopenharmony_civoid SingleVertexArrayFirstGroup::init (void)
274e5c31af7Sopenharmony_ci{
275e5c31af7Sopenharmony_ci	int					counts[]		= {5, 256};
276e5c31af7Sopenharmony_ci	int					firsts[]		= {6, 24};
277e5c31af7Sopenharmony_ci	int					offsets[]		= {1, 16, 17};
278e5c31af7Sopenharmony_ci	int					strides[]		= {/*0,*/ -1, 17, 32}; // Tread negative value as sizeof input. Same as 0, but done outside of GL.
279e5c31af7Sopenharmony_ci
280e5c31af7Sopenharmony_ci	for (int offsetNdx = 0; offsetNdx < DE_LENGTH_OF_ARRAY(offsets); offsetNdx++)
281e5c31af7Sopenharmony_ci	{
282e5c31af7Sopenharmony_ci		for (int countNdx = 0; countNdx < DE_LENGTH_OF_ARRAY(counts); countNdx++)
283e5c31af7Sopenharmony_ci		{
284e5c31af7Sopenharmony_ci			for (int strideNdx = 0; strideNdx < DE_LENGTH_OF_ARRAY(strides); strideNdx++)
285e5c31af7Sopenharmony_ci			{
286e5c31af7Sopenharmony_ci				for (int firstNdx = 0; firstNdx < DE_LENGTH_OF_ARRAY(firsts); firstNdx++)
287e5c31af7Sopenharmony_ci				{
288e5c31af7Sopenharmony_ci					const bool	packed			= m_type == Array::INPUTTYPE_UNSIGNED_INT_2_10_10_10 || m_type == Array::INPUTTYPE_INT_2_10_10_10;
289e5c31af7Sopenharmony_ci					const int	componentCount	= (packed) ? (4) : (2);
290e5c31af7Sopenharmony_ci					const int	stride			= (strides[strideNdx] < 0) ? ((packed) ? (8) : (Array::inputTypeSize(m_type) * componentCount)) : (strides[strideNdx]);
291e5c31af7Sopenharmony_ci					const int	alignment		= (packed) ? (Array::inputTypeSize(m_type) * componentCount) : (Array::inputTypeSize(m_type));
292e5c31af7Sopenharmony_ci					const bool	aligned			= ((stride % alignment) == 0) && ((offsets[offsetNdx] % alignment) == 0);
293e5c31af7Sopenharmony_ci					std::string name			= "first" + typeToString(firsts[firstNdx]) + "_offset" + typeToString(offsets[offsetNdx]) + "_stride" + typeToString(stride) + "_quads" + typeToString(counts[countNdx]);
294e5c31af7Sopenharmony_ci
295e5c31af7Sopenharmony_ci					MultiVertexArrayTest::Spec::ArraySpec arraySpec(m_type,
296e5c31af7Sopenharmony_ci																	Array::OUTPUTTYPE_VEC2,
297e5c31af7Sopenharmony_ci																	Array::STORAGE_BUFFER,
298e5c31af7Sopenharmony_ci																	Array::USAGE_DYNAMIC_DRAW,
299e5c31af7Sopenharmony_ci																	componentCount,
300e5c31af7Sopenharmony_ci																	offsets[offsetNdx],
301e5c31af7Sopenharmony_ci																	stride,
302e5c31af7Sopenharmony_ci																	false,
303e5c31af7Sopenharmony_ci																	GLValue::getMinValue(m_type),
304e5c31af7Sopenharmony_ci																	GLValue::getMaxValue(m_type));
305e5c31af7Sopenharmony_ci
306e5c31af7Sopenharmony_ci					MultiVertexArrayTest::Spec spec;
307e5c31af7Sopenharmony_ci					spec.primitive	= Array::PRIMITIVE_TRIANGLES;
308e5c31af7Sopenharmony_ci					spec.drawCount	= counts[countNdx];
309e5c31af7Sopenharmony_ci					spec.first		= firsts[firstNdx];
310e5c31af7Sopenharmony_ci					spec.arrays.push_back(arraySpec);
311e5c31af7Sopenharmony_ci
312e5c31af7Sopenharmony_ci					if (aligned)
313e5c31af7Sopenharmony_ci						addChild(new MultiVertexArrayTest(m_testCtx, m_context.getRenderContext(), spec, name.c_str(), name.c_str()));
314e5c31af7Sopenharmony_ci				}
315e5c31af7Sopenharmony_ci			}
316e5c31af7Sopenharmony_ci		}
317e5c31af7Sopenharmony_ci	}
318e5c31af7Sopenharmony_ci}
319e5c31af7Sopenharmony_ci
320e5c31af7Sopenharmony_ciclass SingleVertexArrayFirstTests : public TestCaseGroup
321e5c31af7Sopenharmony_ci{
322e5c31af7Sopenharmony_cipublic:
323e5c31af7Sopenharmony_ci									SingleVertexArrayFirstTests	(Context& context);
324e5c31af7Sopenharmony_ci	virtual							~SingleVertexArrayFirstTests	(void);
325e5c31af7Sopenharmony_ci
326e5c31af7Sopenharmony_ci	virtual void					init							(void);
327e5c31af7Sopenharmony_ci
328e5c31af7Sopenharmony_ciprivate:
329e5c31af7Sopenharmony_ci									SingleVertexArrayFirstTests	(const SingleVertexArrayFirstTests& other);
330e5c31af7Sopenharmony_ci	SingleVertexArrayFirstTests&	operator=						(const SingleVertexArrayFirstTests& other);
331e5c31af7Sopenharmony_ci};
332e5c31af7Sopenharmony_ci
333e5c31af7Sopenharmony_ciSingleVertexArrayFirstTests::SingleVertexArrayFirstTests (Context& context)
334e5c31af7Sopenharmony_ci	: TestCaseGroup(context, "first", "Single vertex attribute, different first values to drawArrays")
335e5c31af7Sopenharmony_ci{
336e5c31af7Sopenharmony_ci}
337e5c31af7Sopenharmony_ci
338e5c31af7Sopenharmony_ciSingleVertexArrayFirstTests::~SingleVertexArrayFirstTests (void)
339e5c31af7Sopenharmony_ci{
340e5c31af7Sopenharmony_ci}
341e5c31af7Sopenharmony_ci
342e5c31af7Sopenharmony_civoid SingleVertexArrayFirstTests::init (void)
343e5c31af7Sopenharmony_ci{
344e5c31af7Sopenharmony_ci	// Test offset with different input types, component counts and storage, Usage(?)
345e5c31af7Sopenharmony_ci	Array::InputType	inputTypes[]	= {Array::INPUTTYPE_FLOAT, Array::INPUTTYPE_BYTE, Array::INPUTTYPE_INT_2_10_10_10 };
346e5c31af7Sopenharmony_ci
347e5c31af7Sopenharmony_ci	for (int inputTypeNdx = 0; inputTypeNdx < DE_LENGTH_OF_ARRAY(inputTypes); inputTypeNdx++)
348e5c31af7Sopenharmony_ci	{
349e5c31af7Sopenharmony_ci		addChild(new SingleVertexArrayFirstGroup(m_context, inputTypes[inputTypeNdx]));
350e5c31af7Sopenharmony_ci	}
351e5c31af7Sopenharmony_ci}
352e5c31af7Sopenharmony_ci
353e5c31af7Sopenharmony_ciclass SingleVertexArrayOffsetGroup : public TestCaseGroup
354e5c31af7Sopenharmony_ci{
355e5c31af7Sopenharmony_cipublic:
356e5c31af7Sopenharmony_ci									SingleVertexArrayOffsetGroup	(Context& context, Array::InputType type);
357e5c31af7Sopenharmony_ci	virtual							~SingleVertexArrayOffsetGroup	(void);
358e5c31af7Sopenharmony_ci
359e5c31af7Sopenharmony_ci	virtual void					init							(void);
360e5c31af7Sopenharmony_ci
361e5c31af7Sopenharmony_ciprivate:
362e5c31af7Sopenharmony_ci									SingleVertexArrayOffsetGroup	(const SingleVertexArrayOffsetGroup& other);
363e5c31af7Sopenharmony_ci	SingleVertexArrayOffsetGroup&	operator=						(const SingleVertexArrayOffsetGroup& other);
364e5c31af7Sopenharmony_ci	Array::InputType				m_type;
365e5c31af7Sopenharmony_ci};
366e5c31af7Sopenharmony_ci
367e5c31af7Sopenharmony_ciSingleVertexArrayOffsetGroup::SingleVertexArrayOffsetGroup (Context& context, Array::InputType type)
368e5c31af7Sopenharmony_ci	: TestCaseGroup	(context, Array::inputTypeToString(type).c_str(), Array::inputTypeToString(type).c_str())
369e5c31af7Sopenharmony_ci	, m_type		(type)
370e5c31af7Sopenharmony_ci{
371e5c31af7Sopenharmony_ci}
372e5c31af7Sopenharmony_ci
373e5c31af7Sopenharmony_ciSingleVertexArrayOffsetGroup::~SingleVertexArrayOffsetGroup (void)
374e5c31af7Sopenharmony_ci{
375e5c31af7Sopenharmony_ci}
376e5c31af7Sopenharmony_ci
377e5c31af7Sopenharmony_civoid SingleVertexArrayOffsetGroup::init (void)
378e5c31af7Sopenharmony_ci{
379e5c31af7Sopenharmony_ci	int					counts[]		= {1, 256};
380e5c31af7Sopenharmony_ci	int					offsets[]		= {1, 4, 17, 32};
381e5c31af7Sopenharmony_ci	int					strides[]		= {/*0,*/ -1, 17, 32}; // Tread negative value as sizeof input. Same as 0, but done outside of GL.
382e5c31af7Sopenharmony_ci
383e5c31af7Sopenharmony_ci	for (int offsetNdx = 0; offsetNdx < DE_LENGTH_OF_ARRAY(offsets); offsetNdx++)
384e5c31af7Sopenharmony_ci	{
385e5c31af7Sopenharmony_ci		for (int countNdx = 0; countNdx < DE_LENGTH_OF_ARRAY(counts); countNdx++)
386e5c31af7Sopenharmony_ci		{
387e5c31af7Sopenharmony_ci			for (int strideNdx = 0; strideNdx < DE_LENGTH_OF_ARRAY(strides); strideNdx++)
388e5c31af7Sopenharmony_ci			{
389e5c31af7Sopenharmony_ci				const bool			packed			= m_type == Array::INPUTTYPE_UNSIGNED_INT_2_10_10_10 || m_type == Array::INPUTTYPE_INT_2_10_10_10;
390e5c31af7Sopenharmony_ci				const int			componentCount	= (packed) ? (4) : (2);
391e5c31af7Sopenharmony_ci				const int			stride			= (strides[strideNdx] < 0 ? Array::inputTypeSize(m_type) * componentCount : strides[strideNdx]);
392e5c31af7Sopenharmony_ci				const int			alignment		= (packed) ? (Array::inputTypeSize(m_type) * componentCount) : (Array::inputTypeSize(m_type));
393e5c31af7Sopenharmony_ci				const bool			aligned			= ((stride % alignment) == 0) && ((offsets[offsetNdx] % alignment) == 0);
394e5c31af7Sopenharmony_ci				const std::string	name			= "offset" + typeToString(offsets[offsetNdx]) + "_stride" + typeToString(stride) + "_quads" + typeToString(counts[countNdx]);
395e5c31af7Sopenharmony_ci
396e5c31af7Sopenharmony_ci				MultiVertexArrayTest::Spec::ArraySpec arraySpec(m_type,
397e5c31af7Sopenharmony_ci																Array::OUTPUTTYPE_VEC2,
398e5c31af7Sopenharmony_ci																Array::STORAGE_BUFFER,
399e5c31af7Sopenharmony_ci																Array::USAGE_DYNAMIC_DRAW,
400e5c31af7Sopenharmony_ci																componentCount,
401e5c31af7Sopenharmony_ci																offsets[offsetNdx],
402e5c31af7Sopenharmony_ci																stride,
403e5c31af7Sopenharmony_ci																false,
404e5c31af7Sopenharmony_ci																GLValue::getMinValue(m_type),
405e5c31af7Sopenharmony_ci																GLValue::getMaxValue(m_type));
406e5c31af7Sopenharmony_ci
407e5c31af7Sopenharmony_ci				MultiVertexArrayTest::Spec spec;
408e5c31af7Sopenharmony_ci				spec.primitive	= Array::PRIMITIVE_TRIANGLES;
409e5c31af7Sopenharmony_ci				spec.drawCount	= counts[countNdx];
410e5c31af7Sopenharmony_ci				spec.first		= 0;
411e5c31af7Sopenharmony_ci				spec.arrays.push_back(arraySpec);
412e5c31af7Sopenharmony_ci
413e5c31af7Sopenharmony_ci				if (aligned)
414e5c31af7Sopenharmony_ci					addChild(new MultiVertexArrayTest(m_testCtx, m_context.getRenderContext(), spec, name.c_str(), name.c_str()));
415e5c31af7Sopenharmony_ci			}
416e5c31af7Sopenharmony_ci		}
417e5c31af7Sopenharmony_ci	}
418e5c31af7Sopenharmony_ci}
419e5c31af7Sopenharmony_ci
420e5c31af7Sopenharmony_ciclass SingleVertexArrayOffsetTests : public TestCaseGroup
421e5c31af7Sopenharmony_ci{
422e5c31af7Sopenharmony_cipublic:
423e5c31af7Sopenharmony_ci									SingleVertexArrayOffsetTests	(Context& context);
424e5c31af7Sopenharmony_ci	virtual							~SingleVertexArrayOffsetTests	(void);
425e5c31af7Sopenharmony_ci
426e5c31af7Sopenharmony_ci	virtual void					init							(void);
427e5c31af7Sopenharmony_ci
428e5c31af7Sopenharmony_ciprivate:
429e5c31af7Sopenharmony_ci									SingleVertexArrayOffsetTests	(const SingleVertexArrayOffsetTests& other);
430e5c31af7Sopenharmony_ci	SingleVertexArrayOffsetTests&	operator=						(const SingleVertexArrayOffsetTests& other);
431e5c31af7Sopenharmony_ci};
432e5c31af7Sopenharmony_ci
433e5c31af7Sopenharmony_ciSingleVertexArrayOffsetTests::SingleVertexArrayOffsetTests (Context& context)
434e5c31af7Sopenharmony_ci	: TestCaseGroup(context, "offset", "Single vertex atribute offset element")
435e5c31af7Sopenharmony_ci{
436e5c31af7Sopenharmony_ci}
437e5c31af7Sopenharmony_ci
438e5c31af7Sopenharmony_ciSingleVertexArrayOffsetTests::~SingleVertexArrayOffsetTests (void)
439e5c31af7Sopenharmony_ci{
440e5c31af7Sopenharmony_ci}
441e5c31af7Sopenharmony_ci
442e5c31af7Sopenharmony_civoid SingleVertexArrayOffsetTests::init (void)
443e5c31af7Sopenharmony_ci{
444e5c31af7Sopenharmony_ci	// Test offset with different input types, component counts and storage, Usage(?)
445e5c31af7Sopenharmony_ci	Array::InputType	inputTypes[]	= {Array::INPUTTYPE_FLOAT, Array::INPUTTYPE_BYTE, Array::INPUTTYPE_INT_2_10_10_10 };
446e5c31af7Sopenharmony_ci
447e5c31af7Sopenharmony_ci	for (int inputTypeNdx = 0; inputTypeNdx < DE_LENGTH_OF_ARRAY(inputTypes); inputTypeNdx++)
448e5c31af7Sopenharmony_ci	{
449e5c31af7Sopenharmony_ci		addChild(new SingleVertexArrayOffsetGroup(m_context, inputTypes[inputTypeNdx]));
450e5c31af7Sopenharmony_ci	}
451e5c31af7Sopenharmony_ci}
452e5c31af7Sopenharmony_ci
453e5c31af7Sopenharmony_ciclass SingleVertexArrayNormalizeGroup : public TestCaseGroup
454e5c31af7Sopenharmony_ci{
455e5c31af7Sopenharmony_cipublic:
456e5c31af7Sopenharmony_ci										SingleVertexArrayNormalizeGroup		(Context& context, Array::InputType type);
457e5c31af7Sopenharmony_ci	virtual								~SingleVertexArrayNormalizeGroup	(void);
458e5c31af7Sopenharmony_ci
459e5c31af7Sopenharmony_ci	virtual void						init								(void);
460e5c31af7Sopenharmony_ci
461e5c31af7Sopenharmony_ciprivate:
462e5c31af7Sopenharmony_ci										SingleVertexArrayNormalizeGroup		(const SingleVertexArrayNormalizeGroup& other);
463e5c31af7Sopenharmony_ci	SingleVertexArrayNormalizeGroup&	operator=							(const SingleVertexArrayNormalizeGroup& other);
464e5c31af7Sopenharmony_ci	Array::InputType					m_type;
465e5c31af7Sopenharmony_ci};
466e5c31af7Sopenharmony_ci
467e5c31af7Sopenharmony_ciSingleVertexArrayNormalizeGroup::SingleVertexArrayNormalizeGroup (Context& context, Array::InputType type)
468e5c31af7Sopenharmony_ci	: TestCaseGroup	(context, Array::inputTypeToString(type).c_str(), Array::inputTypeToString(type).c_str())
469e5c31af7Sopenharmony_ci	, m_type		(type)
470e5c31af7Sopenharmony_ci{
471e5c31af7Sopenharmony_ci}
472e5c31af7Sopenharmony_ci
473e5c31af7Sopenharmony_ciSingleVertexArrayNormalizeGroup::~SingleVertexArrayNormalizeGroup (void)
474e5c31af7Sopenharmony_ci{
475e5c31af7Sopenharmony_ci}
476e5c31af7Sopenharmony_ci
477e5c31af7Sopenharmony_civoid SingleVertexArrayNormalizeGroup::init (void)
478e5c31af7Sopenharmony_ci{
479e5c31af7Sopenharmony_ci	int					counts[]		= {1, 256};
480e5c31af7Sopenharmony_ci
481e5c31af7Sopenharmony_ci	for (int componentCount = 2; componentCount < 5; componentCount++)
482e5c31af7Sopenharmony_ci	{
483e5c31af7Sopenharmony_ci		for (int countNdx = 0; countNdx < DE_LENGTH_OF_ARRAY(counts); countNdx++)
484e5c31af7Sopenharmony_ci		{
485e5c31af7Sopenharmony_ci			if((m_type == Array::INPUTTYPE_UNSIGNED_INT_2_10_10_10 || m_type == Array::INPUTTYPE_INT_2_10_10_10) && componentCount != 4)
486e5c31af7Sopenharmony_ci				continue;
487e5c31af7Sopenharmony_ci
488e5c31af7Sopenharmony_ci			std::string name = "components" + typeToString(componentCount) + "_quads" + typeToString(counts[countNdx]);
489e5c31af7Sopenharmony_ci
490e5c31af7Sopenharmony_ci			MultiVertexArrayTest::Spec::ArraySpec arraySpec(m_type,
491e5c31af7Sopenharmony_ci															Array::OUTPUTTYPE_VEC4,
492e5c31af7Sopenharmony_ci															Array::STORAGE_USER,
493e5c31af7Sopenharmony_ci															Array::USAGE_DYNAMIC_DRAW,
494e5c31af7Sopenharmony_ci															componentCount,
495e5c31af7Sopenharmony_ci															0,
496e5c31af7Sopenharmony_ci															0,
497e5c31af7Sopenharmony_ci															true,
498e5c31af7Sopenharmony_ci															GLValue::getMinValue(m_type),
499e5c31af7Sopenharmony_ci															GLValue::getMaxValue(m_type));
500e5c31af7Sopenharmony_ci
501e5c31af7Sopenharmony_ci			MultiVertexArrayTest::Spec spec;
502e5c31af7Sopenharmony_ci			spec.primitive	= Array::PRIMITIVE_TRIANGLES;
503e5c31af7Sopenharmony_ci			spec.drawCount	= counts[countNdx];
504e5c31af7Sopenharmony_ci			spec.first		= 0;
505e5c31af7Sopenharmony_ci			spec.arrays.push_back(arraySpec);
506e5c31af7Sopenharmony_ci
507e5c31af7Sopenharmony_ci			addChild(new MultiVertexArrayTest(m_testCtx, m_context.getRenderContext(), spec, name.c_str(), name.c_str()));
508e5c31af7Sopenharmony_ci		}
509e5c31af7Sopenharmony_ci	}
510e5c31af7Sopenharmony_ci}
511e5c31af7Sopenharmony_ci
512e5c31af7Sopenharmony_ciclass SingleVertexArrayNormalizeTests : public TestCaseGroup
513e5c31af7Sopenharmony_ci{
514e5c31af7Sopenharmony_cipublic:
515e5c31af7Sopenharmony_ci										SingleVertexArrayNormalizeTests		(Context& context);
516e5c31af7Sopenharmony_ci	virtual								~SingleVertexArrayNormalizeTests	(void);
517e5c31af7Sopenharmony_ci
518e5c31af7Sopenharmony_ci	virtual void						init								(void);
519e5c31af7Sopenharmony_ci
520e5c31af7Sopenharmony_ciprivate:
521e5c31af7Sopenharmony_ci										SingleVertexArrayNormalizeTests		(const SingleVertexArrayNormalizeTests& other);
522e5c31af7Sopenharmony_ci	SingleVertexArrayNormalizeTests&	operator=							(const SingleVertexArrayNormalizeTests& other);
523e5c31af7Sopenharmony_ci};
524e5c31af7Sopenharmony_ci
525e5c31af7Sopenharmony_ciSingleVertexArrayNormalizeTests::SingleVertexArrayNormalizeTests (Context& context)
526e5c31af7Sopenharmony_ci	: TestCaseGroup(context, "normalize", "Single normalize vertex atribute")
527e5c31af7Sopenharmony_ci{
528e5c31af7Sopenharmony_ci}
529e5c31af7Sopenharmony_ci
530e5c31af7Sopenharmony_ciSingleVertexArrayNormalizeTests::~SingleVertexArrayNormalizeTests (void)
531e5c31af7Sopenharmony_ci{
532e5c31af7Sopenharmony_ci}
533e5c31af7Sopenharmony_ci
534e5c31af7Sopenharmony_civoid SingleVertexArrayNormalizeTests::init (void)
535e5c31af7Sopenharmony_ci{
536e5c31af7Sopenharmony_ci	// Test normalization with different input types, component counts and storage
537e5c31af7Sopenharmony_ci	Array::InputType	inputTypes[]	= {Array::INPUTTYPE_FLOAT, Array::INPUTTYPE_SHORT, Array::INPUTTYPE_BYTE, Array::INPUTTYPE_UNSIGNED_SHORT, Array::INPUTTYPE_UNSIGNED_BYTE, Array::INPUTTYPE_FIXED, Array::INPUTTYPE_UNSIGNED_INT, Array::INPUTTYPE_INT, Array::INPUTTYPE_HALF , Array::INPUTTYPE_UNSIGNED_INT_2_10_10_10, Array::INPUTTYPE_INT_2_10_10_10 };
538e5c31af7Sopenharmony_ci
539e5c31af7Sopenharmony_ci	for (int inputTypeNdx = 0; inputTypeNdx < DE_LENGTH_OF_ARRAY(inputTypes); inputTypeNdx++)
540e5c31af7Sopenharmony_ci	{
541e5c31af7Sopenharmony_ci		addChild(new SingleVertexArrayNormalizeGroup(m_context, inputTypes[inputTypeNdx]));
542e5c31af7Sopenharmony_ci	}
543e5c31af7Sopenharmony_ci}
544e5c31af7Sopenharmony_ci
545e5c31af7Sopenharmony_ciclass SingleVertexArrayOutputTypeGroup : public TestCaseGroup
546e5c31af7Sopenharmony_ci{
547e5c31af7Sopenharmony_cipublic:
548e5c31af7Sopenharmony_ci										SingleVertexArrayOutputTypeGroup	(Context& context, Array::InputType type);
549e5c31af7Sopenharmony_ci	virtual								~SingleVertexArrayOutputTypeGroup	(void);
550e5c31af7Sopenharmony_ci
551e5c31af7Sopenharmony_ci	virtual void						init								(void);
552e5c31af7Sopenharmony_ci
553e5c31af7Sopenharmony_ciprivate:
554e5c31af7Sopenharmony_ci										SingleVertexArrayOutputTypeGroup	(const SingleVertexArrayOutputTypeGroup& other);
555e5c31af7Sopenharmony_ci	SingleVertexArrayOutputTypeGroup&	operator=							(const SingleVertexArrayOutputTypeGroup& other);
556e5c31af7Sopenharmony_ci	Array::InputType					m_type;
557e5c31af7Sopenharmony_ci};
558e5c31af7Sopenharmony_ci
559e5c31af7Sopenharmony_ciSingleVertexArrayOutputTypeGroup::SingleVertexArrayOutputTypeGroup (Context& context, Array::InputType type)
560e5c31af7Sopenharmony_ci	: TestCaseGroup	(context, Array::inputTypeToString(type).c_str(), Array::inputTypeToString(type).c_str())
561e5c31af7Sopenharmony_ci	, m_type		(type)
562e5c31af7Sopenharmony_ci{
563e5c31af7Sopenharmony_ci}
564e5c31af7Sopenharmony_ci
565e5c31af7Sopenharmony_ciSingleVertexArrayOutputTypeGroup::~SingleVertexArrayOutputTypeGroup (void)
566e5c31af7Sopenharmony_ci{
567e5c31af7Sopenharmony_ci}
568e5c31af7Sopenharmony_ci
569e5c31af7Sopenharmony_civoid SingleVertexArrayOutputTypeGroup::init (void)
570e5c31af7Sopenharmony_ci{
571e5c31af7Sopenharmony_ci	Array::OutputType	outputTypes[]	= {Array::OUTPUTTYPE_VEC2, Array::OUTPUTTYPE_VEC3, Array::OUTPUTTYPE_VEC4, Array::OUTPUTTYPE_IVEC2, Array::OUTPUTTYPE_IVEC3, Array::OUTPUTTYPE_IVEC4, Array::OUTPUTTYPE_UVEC2, Array::OUTPUTTYPE_UVEC3, Array::OUTPUTTYPE_UVEC4 };
572e5c31af7Sopenharmony_ci	Array::Storage		storages[]		= {Array::STORAGE_USER};
573e5c31af7Sopenharmony_ci	int					counts[]		= {1, 256};
574e5c31af7Sopenharmony_ci
575e5c31af7Sopenharmony_ci	for (int outputTypeNdx = 0; outputTypeNdx < DE_LENGTH_OF_ARRAY(outputTypes); outputTypeNdx++)
576e5c31af7Sopenharmony_ci	{
577e5c31af7Sopenharmony_ci		for (int storageNdx = 0; storageNdx < DE_LENGTH_OF_ARRAY(storages); storageNdx++)
578e5c31af7Sopenharmony_ci		{
579e5c31af7Sopenharmony_ci			for (int componentCount = 2; componentCount < 5; componentCount++)
580e5c31af7Sopenharmony_ci			{
581e5c31af7Sopenharmony_ci				for (int countNdx = 0; countNdx < DE_LENGTH_OF_ARRAY(counts); countNdx++)
582e5c31af7Sopenharmony_ci				{
583e5c31af7Sopenharmony_ci					std::string name = "components" + typeToString(componentCount) + "_" + Array::outputTypeToString(outputTypes[outputTypeNdx]) + "_quads" + typeToString(counts[countNdx]);
584e5c31af7Sopenharmony_ci
585e5c31af7Sopenharmony_ci					const bool inputIsSignedInteger		= m_type == Array::INPUTTYPE_INT || m_type == Array::INPUTTYPE_SHORT || m_type == Array::INPUTTYPE_BYTE;
586e5c31af7Sopenharmony_ci					const bool inputIsUnignedInteger	= m_type == Array::INPUTTYPE_UNSIGNED_INT || m_type == Array::INPUTTYPE_UNSIGNED_SHORT || m_type == Array::INPUTTYPE_UNSIGNED_BYTE;
587e5c31af7Sopenharmony_ci					const bool outputIsSignedInteger	= outputTypes[outputTypeNdx] == Array::OUTPUTTYPE_IVEC2 || outputTypes[outputTypeNdx] == Array::OUTPUTTYPE_IVEC3 || outputTypes[outputTypeNdx] == Array::OUTPUTTYPE_IVEC4;
588e5c31af7Sopenharmony_ci					const bool outputIsUnsignedInteger	= outputTypes[outputTypeNdx] == Array::OUTPUTTYPE_UVEC2 || outputTypes[outputTypeNdx] == Array::OUTPUTTYPE_UVEC3 || outputTypes[outputTypeNdx] == Array::OUTPUTTYPE_UVEC4;
589e5c31af7Sopenharmony_ci
590e5c31af7Sopenharmony_ci					// If input type is float type and output type is int type skip
591e5c31af7Sopenharmony_ci					if ((m_type == Array::INPUTTYPE_FLOAT ||  m_type == Array::INPUTTYPE_HALF || m_type == Array::INPUTTYPE_FIXED) && (outputTypes[outputTypeNdx] >= Array::OUTPUTTYPE_INT))
592e5c31af7Sopenharmony_ci						continue;
593e5c31af7Sopenharmony_ci
594e5c31af7Sopenharmony_ci					if((m_type == Array::INPUTTYPE_UNSIGNED_INT_2_10_10_10 || m_type == Array::INPUTTYPE_INT_2_10_10_10) && (outputTypes[outputTypeNdx] >= Array::OUTPUTTYPE_INT))
595e5c31af7Sopenharmony_ci						continue;
596e5c31af7Sopenharmony_ci
597e5c31af7Sopenharmony_ci					if((m_type == Array::INPUTTYPE_UNSIGNED_INT_2_10_10_10 || m_type == Array::INPUTTYPE_INT_2_10_10_10) && componentCount != 4)
598e5c31af7Sopenharmony_ci						continue;
599e5c31af7Sopenharmony_ci
600e5c31af7Sopenharmony_ci					// Loading signed data as unsigned causes undefined values and vice versa
601e5c31af7Sopenharmony_ci					if (inputIsSignedInteger && outputIsUnsignedInteger)
602e5c31af7Sopenharmony_ci						continue;
603e5c31af7Sopenharmony_ci					if (inputIsUnignedInteger && outputIsSignedInteger)
604e5c31af7Sopenharmony_ci						continue;
605e5c31af7Sopenharmony_ci
606e5c31af7Sopenharmony_ci					MultiVertexArrayTest::Spec::ArraySpec arraySpec(m_type,
607e5c31af7Sopenharmony_ci																	outputTypes[outputTypeNdx],
608e5c31af7Sopenharmony_ci																	storages[storageNdx],
609e5c31af7Sopenharmony_ci																	Array::USAGE_DYNAMIC_DRAW,
610e5c31af7Sopenharmony_ci																	componentCount,
611e5c31af7Sopenharmony_ci																	0,
612e5c31af7Sopenharmony_ci																	0,
613e5c31af7Sopenharmony_ci																	false,
614e5c31af7Sopenharmony_ci																	GLValue::getMinValue(m_type),
615e5c31af7Sopenharmony_ci																	GLValue::getMaxValue(m_type));
616e5c31af7Sopenharmony_ci
617e5c31af7Sopenharmony_ci					MultiVertexArrayTest::Spec spec;
618e5c31af7Sopenharmony_ci					spec.primitive	= Array::PRIMITIVE_TRIANGLES;
619e5c31af7Sopenharmony_ci					spec.drawCount	= counts[countNdx];
620e5c31af7Sopenharmony_ci					spec.first		= 0;
621e5c31af7Sopenharmony_ci					spec.arrays.push_back(arraySpec);
622e5c31af7Sopenharmony_ci
623e5c31af7Sopenharmony_ci					addChild(new MultiVertexArrayTest(m_testCtx, m_context.getRenderContext(), spec, name.c_str(), name.c_str()));
624e5c31af7Sopenharmony_ci				}
625e5c31af7Sopenharmony_ci			}
626e5c31af7Sopenharmony_ci		}
627e5c31af7Sopenharmony_ci	}
628e5c31af7Sopenharmony_ci}
629e5c31af7Sopenharmony_ci
630e5c31af7Sopenharmony_ciclass SingleVertexArrayOutputTypeTests : public TestCaseGroup
631e5c31af7Sopenharmony_ci{
632e5c31af7Sopenharmony_cipublic:
633e5c31af7Sopenharmony_ci										SingleVertexArrayOutputTypeTests	(Context& context);
634e5c31af7Sopenharmony_ci	virtual								~SingleVertexArrayOutputTypeTests	(void);
635e5c31af7Sopenharmony_ci
636e5c31af7Sopenharmony_ci	virtual void						init								(void);
637e5c31af7Sopenharmony_ci
638e5c31af7Sopenharmony_ciprivate:
639e5c31af7Sopenharmony_ci										SingleVertexArrayOutputTypeTests	(const SingleVertexArrayOutputTypeTests& other);
640e5c31af7Sopenharmony_ci	SingleVertexArrayOutputTypeTests&	operator=							(const SingleVertexArrayOutputTypeTests& other);
641e5c31af7Sopenharmony_ci};
642e5c31af7Sopenharmony_ci
643e5c31af7Sopenharmony_ciSingleVertexArrayOutputTypeTests::SingleVertexArrayOutputTypeTests (Context& context)
644e5c31af7Sopenharmony_ci	: TestCaseGroup(context, "output_types", "Single output type vertex atribute")
645e5c31af7Sopenharmony_ci{
646e5c31af7Sopenharmony_ci}
647e5c31af7Sopenharmony_ci
648e5c31af7Sopenharmony_ciSingleVertexArrayOutputTypeTests::~SingleVertexArrayOutputTypeTests (void)
649e5c31af7Sopenharmony_ci{
650e5c31af7Sopenharmony_ci}
651e5c31af7Sopenharmony_ci
652e5c31af7Sopenharmony_civoid SingleVertexArrayOutputTypeTests::init (void)
653e5c31af7Sopenharmony_ci{
654e5c31af7Sopenharmony_ci	// Test output types with different input types, component counts and storage, Usage?, Precision?, float?
655e5c31af7Sopenharmony_ci	Array::InputType	inputTypes[]	= {Array::INPUTTYPE_FLOAT, Array::INPUTTYPE_SHORT, Array::INPUTTYPE_BYTE, Array::INPUTTYPE_UNSIGNED_SHORT, Array::INPUTTYPE_UNSIGNED_BYTE, Array::INPUTTYPE_FIXED, Array::INPUTTYPE_UNSIGNED_INT, Array::INPUTTYPE_INT, Array::INPUTTYPE_HALF, Array::INPUTTYPE_UNSIGNED_INT_2_10_10_10, Array::INPUTTYPE_INT_2_10_10_10 };
656e5c31af7Sopenharmony_ci
657e5c31af7Sopenharmony_ci	for (int inputTypeNdx = 0; inputTypeNdx < DE_LENGTH_OF_ARRAY(inputTypes); inputTypeNdx++)
658e5c31af7Sopenharmony_ci	{
659e5c31af7Sopenharmony_ci		addChild(new SingleVertexArrayOutputTypeGroup(m_context, inputTypes[inputTypeNdx]));
660e5c31af7Sopenharmony_ci	}
661e5c31af7Sopenharmony_ci}
662e5c31af7Sopenharmony_ci
663e5c31af7Sopenharmony_ci
664e5c31af7Sopenharmony_ciclass SingleVertexArrayTestGroup : public TestCaseGroup
665e5c31af7Sopenharmony_ci{
666e5c31af7Sopenharmony_cipublic:
667e5c31af7Sopenharmony_ci									SingleVertexArrayTestGroup	(Context& context);
668e5c31af7Sopenharmony_ci	virtual							~SingleVertexArrayTestGroup	(void);
669e5c31af7Sopenharmony_ci
670e5c31af7Sopenharmony_ci	virtual void					init						(void);
671e5c31af7Sopenharmony_ci
672e5c31af7Sopenharmony_ciprivate:
673e5c31af7Sopenharmony_ci									SingleVertexArrayTestGroup	(const SingleVertexArrayTestGroup& other);
674e5c31af7Sopenharmony_ci	SingleVertexArrayTestGroup&		operator=					(const SingleVertexArrayTestGroup& other);
675e5c31af7Sopenharmony_ci};
676e5c31af7Sopenharmony_ci
677e5c31af7Sopenharmony_ciSingleVertexArrayTestGroup::SingleVertexArrayTestGroup (Context& context)
678e5c31af7Sopenharmony_ci	: TestCaseGroup(context, "single_attribute", "Single vertex atribute")
679e5c31af7Sopenharmony_ci{
680e5c31af7Sopenharmony_ci}
681e5c31af7Sopenharmony_ci
682e5c31af7Sopenharmony_ciSingleVertexArrayTestGroup::~SingleVertexArrayTestGroup (void)
683e5c31af7Sopenharmony_ci{
684e5c31af7Sopenharmony_ci}
685e5c31af7Sopenharmony_ci
686e5c31af7Sopenharmony_civoid SingleVertexArrayTestGroup::init (void)
687e5c31af7Sopenharmony_ci{
688e5c31af7Sopenharmony_ci	addChild(new SingleVertexArrayStrideTests(m_context));
689e5c31af7Sopenharmony_ci	addChild(new SingleVertexArrayNormalizeTests(m_context));
690e5c31af7Sopenharmony_ci	addChild(new SingleVertexArrayOutputTypeTests(m_context));
691e5c31af7Sopenharmony_ci	addChild(new SingleVertexArrayUsageTests(m_context));
692e5c31af7Sopenharmony_ci	addChild(new SingleVertexArrayOffsetTests(m_context));
693e5c31af7Sopenharmony_ci	addChild(new SingleVertexArrayFirstTests(m_context));
694e5c31af7Sopenharmony_ci}
695e5c31af7Sopenharmony_ci
696e5c31af7Sopenharmony_ciclass MultiVertexArrayCountTests : public TestCaseGroup
697e5c31af7Sopenharmony_ci{
698e5c31af7Sopenharmony_cipublic:
699e5c31af7Sopenharmony_ci									MultiVertexArrayCountTests	(Context& context);
700e5c31af7Sopenharmony_ci	virtual							~MultiVertexArrayCountTests	(void);
701e5c31af7Sopenharmony_ci
702e5c31af7Sopenharmony_ci	virtual void					init						(void);
703e5c31af7Sopenharmony_ci
704e5c31af7Sopenharmony_ciprivate:
705e5c31af7Sopenharmony_ci									MultiVertexArrayCountTests	(const MultiVertexArrayCountTests& other);
706e5c31af7Sopenharmony_ci	MultiVertexArrayCountTests&		operator=					(const MultiVertexArrayCountTests& other);
707e5c31af7Sopenharmony_ci
708e5c31af7Sopenharmony_ci	std::string						getTestName					(const MultiVertexArrayTest::Spec& spec);
709e5c31af7Sopenharmony_ci};
710e5c31af7Sopenharmony_ci
711e5c31af7Sopenharmony_ciMultiVertexArrayCountTests::MultiVertexArrayCountTests (Context& context)
712e5c31af7Sopenharmony_ci	: TestCaseGroup(context, "attribute_count", "Attribute counts")
713e5c31af7Sopenharmony_ci{
714e5c31af7Sopenharmony_ci}
715e5c31af7Sopenharmony_ci
716e5c31af7Sopenharmony_ciMultiVertexArrayCountTests::~MultiVertexArrayCountTests (void)
717e5c31af7Sopenharmony_ci{
718e5c31af7Sopenharmony_ci}
719e5c31af7Sopenharmony_ci
720e5c31af7Sopenharmony_cistd::string MultiVertexArrayCountTests::getTestName (const MultiVertexArrayTest::Spec& spec)
721e5c31af7Sopenharmony_ci{
722e5c31af7Sopenharmony_ci	std::stringstream name;
723e5c31af7Sopenharmony_ci	name
724e5c31af7Sopenharmony_ci		<< spec.arrays.size();
725e5c31af7Sopenharmony_ci
726e5c31af7Sopenharmony_ci	return name.str();
727e5c31af7Sopenharmony_ci}
728e5c31af7Sopenharmony_ci
729e5c31af7Sopenharmony_civoid MultiVertexArrayCountTests::init (void)
730e5c31af7Sopenharmony_ci{
731e5c31af7Sopenharmony_ci	// Test attribute counts
732e5c31af7Sopenharmony_ci	int arrayCounts[] = {2, 3, 4, 5, 6, 7, 8};
733e5c31af7Sopenharmony_ci
734e5c31af7Sopenharmony_ci	for (int arrayCountNdx = 0; arrayCountNdx < DE_LENGTH_OF_ARRAY(arrayCounts); arrayCountNdx++)
735e5c31af7Sopenharmony_ci	{
736e5c31af7Sopenharmony_ci		MultiVertexArrayTest::Spec spec;
737e5c31af7Sopenharmony_ci
738e5c31af7Sopenharmony_ci		spec.primitive	= Array::PRIMITIVE_TRIANGLES;
739e5c31af7Sopenharmony_ci		spec.drawCount	= 256;
740e5c31af7Sopenharmony_ci		spec.first		= 0;
741e5c31af7Sopenharmony_ci
742e5c31af7Sopenharmony_ci		for (int arrayNdx = 0; arrayNdx < arrayCounts[arrayCountNdx]; arrayNdx++)
743e5c31af7Sopenharmony_ci		{
744e5c31af7Sopenharmony_ci			MultiVertexArrayTest::Spec::ArraySpec arraySpec(Array::INPUTTYPE_FLOAT,
745e5c31af7Sopenharmony_ci															Array::OUTPUTTYPE_VEC2,
746e5c31af7Sopenharmony_ci															Array::STORAGE_USER,
747e5c31af7Sopenharmony_ci															Array::USAGE_DYNAMIC_DRAW,
748e5c31af7Sopenharmony_ci															2,
749e5c31af7Sopenharmony_ci															0,
750e5c31af7Sopenharmony_ci															0,
751e5c31af7Sopenharmony_ci															false,
752e5c31af7Sopenharmony_ci															GLValue::getMinValue(Array::INPUTTYPE_FLOAT),
753e5c31af7Sopenharmony_ci															GLValue::getMaxValue(Array::INPUTTYPE_FLOAT));
754e5c31af7Sopenharmony_ci
755e5c31af7Sopenharmony_ci			spec.arrays.push_back(arraySpec);
756e5c31af7Sopenharmony_ci		}
757e5c31af7Sopenharmony_ci
758e5c31af7Sopenharmony_ci		std::string name = getTestName(spec);
759e5c31af7Sopenharmony_ci		std::string desc = getTestName(spec);
760e5c31af7Sopenharmony_ci
761e5c31af7Sopenharmony_ci		addChild(new MultiVertexArrayTest(m_testCtx, m_context.getRenderContext(), spec, name.c_str(), desc.c_str()));
762e5c31af7Sopenharmony_ci	}
763e5c31af7Sopenharmony_ci}
764e5c31af7Sopenharmony_ci
765e5c31af7Sopenharmony_ciclass MultiVertexArrayStorageTests : public TestCaseGroup
766e5c31af7Sopenharmony_ci{
767e5c31af7Sopenharmony_cipublic:
768e5c31af7Sopenharmony_ci									MultiVertexArrayStorageTests	(Context& context);
769e5c31af7Sopenharmony_ci	virtual							~MultiVertexArrayStorageTests	(void);
770e5c31af7Sopenharmony_ci
771e5c31af7Sopenharmony_ci	virtual void					init							(void);
772e5c31af7Sopenharmony_ci
773e5c31af7Sopenharmony_ciprivate:
774e5c31af7Sopenharmony_ci									MultiVertexArrayStorageTests	(const MultiVertexArrayStorageTests& other);
775e5c31af7Sopenharmony_ci	MultiVertexArrayStorageTests&	operator=						(const MultiVertexArrayStorageTests& other);
776e5c31af7Sopenharmony_ci
777e5c31af7Sopenharmony_ci	void							addStorageCases					(MultiVertexArrayTest::Spec spec, int depth);
778e5c31af7Sopenharmony_ci	std::string						getTestName						(const MultiVertexArrayTest::Spec& spec);
779e5c31af7Sopenharmony_ci};
780e5c31af7Sopenharmony_ci
781e5c31af7Sopenharmony_ciMultiVertexArrayStorageTests::MultiVertexArrayStorageTests (Context& context)
782e5c31af7Sopenharmony_ci	: TestCaseGroup(context, "storage", "Attribute storages")
783e5c31af7Sopenharmony_ci{
784e5c31af7Sopenharmony_ci}
785e5c31af7Sopenharmony_ci
786e5c31af7Sopenharmony_ciMultiVertexArrayStorageTests::~MultiVertexArrayStorageTests (void)
787e5c31af7Sopenharmony_ci{
788e5c31af7Sopenharmony_ci}
789e5c31af7Sopenharmony_ci
790e5c31af7Sopenharmony_cistd::string MultiVertexArrayStorageTests::getTestName (const MultiVertexArrayTest::Spec& spec)
791e5c31af7Sopenharmony_ci{
792e5c31af7Sopenharmony_ci	std::stringstream name;
793e5c31af7Sopenharmony_ci	name
794e5c31af7Sopenharmony_ci		<< spec.arrays.size();
795e5c31af7Sopenharmony_ci
796e5c31af7Sopenharmony_ci	for (int arrayNdx = 0; arrayNdx < (int)spec.arrays.size(); arrayNdx++)
797e5c31af7Sopenharmony_ci	{
798e5c31af7Sopenharmony_ci		name
799e5c31af7Sopenharmony_ci			<< "_"
800e5c31af7Sopenharmony_ci			<< Array::storageToString(spec.arrays[arrayNdx].storage);
801e5c31af7Sopenharmony_ci	}
802e5c31af7Sopenharmony_ci
803e5c31af7Sopenharmony_ci	return name.str();
804e5c31af7Sopenharmony_ci}
805e5c31af7Sopenharmony_ci
806e5c31af7Sopenharmony_civoid MultiVertexArrayStorageTests::addStorageCases (MultiVertexArrayTest::Spec spec, int depth)
807e5c31af7Sopenharmony_ci{
808e5c31af7Sopenharmony_ci	if (depth == 0)
809e5c31af7Sopenharmony_ci	{
810e5c31af7Sopenharmony_ci		// Skip trivial case, used elsewhere
811e5c31af7Sopenharmony_ci		bool ok = false;
812e5c31af7Sopenharmony_ci		for (int arrayNdx = 0; arrayNdx < (int)spec.arrays.size(); arrayNdx++)
813e5c31af7Sopenharmony_ci		{
814e5c31af7Sopenharmony_ci			if (spec.arrays[arrayNdx].storage != Array::STORAGE_USER)
815e5c31af7Sopenharmony_ci			{
816e5c31af7Sopenharmony_ci				ok = true;
817e5c31af7Sopenharmony_ci				break;
818e5c31af7Sopenharmony_ci			}
819e5c31af7Sopenharmony_ci		}
820e5c31af7Sopenharmony_ci
821e5c31af7Sopenharmony_ci		if (!ok)
822e5c31af7Sopenharmony_ci			return;
823e5c31af7Sopenharmony_ci
824e5c31af7Sopenharmony_ci		std::string name = getTestName(spec);
825e5c31af7Sopenharmony_ci		std::string desc = getTestName(spec);
826e5c31af7Sopenharmony_ci
827e5c31af7Sopenharmony_ci		addChild(new MultiVertexArrayTest(m_testCtx, m_context.getRenderContext(), spec, name.c_str(), desc.c_str()));
828e5c31af7Sopenharmony_ci		return;
829e5c31af7Sopenharmony_ci	}
830e5c31af7Sopenharmony_ci
831e5c31af7Sopenharmony_ci	Array::Storage storages[] = {Array::STORAGE_USER, Array::STORAGE_BUFFER};
832e5c31af7Sopenharmony_ci	for (int storageNdx = 0; storageNdx < DE_LENGTH_OF_ARRAY(storages); storageNdx++)
833e5c31af7Sopenharmony_ci	{
834e5c31af7Sopenharmony_ci		MultiVertexArrayTest::Spec::ArraySpec arraySpec(Array::INPUTTYPE_FLOAT,
835e5c31af7Sopenharmony_ci														Array::OUTPUTTYPE_VEC2,
836e5c31af7Sopenharmony_ci														storages[storageNdx],
837e5c31af7Sopenharmony_ci														Array::USAGE_DYNAMIC_DRAW,
838e5c31af7Sopenharmony_ci														2,
839e5c31af7Sopenharmony_ci														0,
840e5c31af7Sopenharmony_ci														0,
841e5c31af7Sopenharmony_ci														false,
842e5c31af7Sopenharmony_ci														GLValue::getMinValue(Array::INPUTTYPE_FLOAT),
843e5c31af7Sopenharmony_ci														GLValue::getMaxValue(Array::INPUTTYPE_FLOAT));
844e5c31af7Sopenharmony_ci
845e5c31af7Sopenharmony_ci		MultiVertexArrayTest::Spec _spec = spec;
846e5c31af7Sopenharmony_ci		_spec.arrays.push_back(arraySpec);
847e5c31af7Sopenharmony_ci		addStorageCases(_spec, depth-1);
848e5c31af7Sopenharmony_ci	}
849e5c31af7Sopenharmony_ci}
850e5c31af7Sopenharmony_ci
851e5c31af7Sopenharmony_ci
852e5c31af7Sopenharmony_civoid MultiVertexArrayStorageTests::init (void)
853e5c31af7Sopenharmony_ci{
854e5c31af7Sopenharmony_ci	// Test different storages
855e5c31af7Sopenharmony_ci	int arrayCounts[] = {3};
856e5c31af7Sopenharmony_ci
857e5c31af7Sopenharmony_ci	MultiVertexArrayTest::Spec spec;
858e5c31af7Sopenharmony_ci
859e5c31af7Sopenharmony_ci	spec.primitive	= Array::PRIMITIVE_TRIANGLES;
860e5c31af7Sopenharmony_ci	spec.drawCount	= 256;
861e5c31af7Sopenharmony_ci	spec.first		= 0;
862e5c31af7Sopenharmony_ci
863e5c31af7Sopenharmony_ci	for (int arrayCountNdx = 0; arrayCountNdx < DE_LENGTH_OF_ARRAY(arrayCounts); arrayCountNdx++)
864e5c31af7Sopenharmony_ci		addStorageCases(spec, arrayCounts[arrayCountNdx]);
865e5c31af7Sopenharmony_ci}
866e5c31af7Sopenharmony_ci
867e5c31af7Sopenharmony_ciclass MultiVertexArrayStrideTests : public TestCaseGroup
868e5c31af7Sopenharmony_ci{
869e5c31af7Sopenharmony_cipublic:
870e5c31af7Sopenharmony_ci									MultiVertexArrayStrideTests		(Context& context);
871e5c31af7Sopenharmony_ci	virtual							~MultiVertexArrayStrideTests	(void);
872e5c31af7Sopenharmony_ci
873e5c31af7Sopenharmony_ci	virtual void					init							(void);
874e5c31af7Sopenharmony_ci
875e5c31af7Sopenharmony_ciprivate:
876e5c31af7Sopenharmony_ci									MultiVertexArrayStrideTests		(const MultiVertexArrayStrideTests& other);
877e5c31af7Sopenharmony_ci	MultiVertexArrayStrideTests&	operator=						(const MultiVertexArrayStrideTests& other);
878e5c31af7Sopenharmony_ci
879e5c31af7Sopenharmony_ci	void							addStrideCases					(MultiVertexArrayTest::Spec spec, int depth);
880e5c31af7Sopenharmony_ci	std::string						getTestName						(const MultiVertexArrayTest::Spec& spec);
881e5c31af7Sopenharmony_ci};
882e5c31af7Sopenharmony_ci
883e5c31af7Sopenharmony_ciMultiVertexArrayStrideTests::MultiVertexArrayStrideTests (Context& context)
884e5c31af7Sopenharmony_ci	: TestCaseGroup(context, "stride", "Strides")
885e5c31af7Sopenharmony_ci{
886e5c31af7Sopenharmony_ci}
887e5c31af7Sopenharmony_ci
888e5c31af7Sopenharmony_ciMultiVertexArrayStrideTests::~MultiVertexArrayStrideTests (void)
889e5c31af7Sopenharmony_ci{
890e5c31af7Sopenharmony_ci}
891e5c31af7Sopenharmony_ci
892e5c31af7Sopenharmony_cistd::string MultiVertexArrayStrideTests::getTestName (const MultiVertexArrayTest::Spec& spec)
893e5c31af7Sopenharmony_ci{
894e5c31af7Sopenharmony_ci	std::stringstream name;
895e5c31af7Sopenharmony_ci
896e5c31af7Sopenharmony_ci	name
897e5c31af7Sopenharmony_ci		<< spec.arrays.size();
898e5c31af7Sopenharmony_ci
899e5c31af7Sopenharmony_ci	for (int arrayNdx = 0; arrayNdx < (int)spec.arrays.size(); arrayNdx++)
900e5c31af7Sopenharmony_ci	{
901e5c31af7Sopenharmony_ci		name
902e5c31af7Sopenharmony_ci			<< "_"
903e5c31af7Sopenharmony_ci			<< Array::inputTypeToString(spec.arrays[arrayNdx].inputType)
904e5c31af7Sopenharmony_ci			<< spec.arrays[arrayNdx].componentCount << "_"
905e5c31af7Sopenharmony_ci			<< spec.arrays[arrayNdx].stride;
906e5c31af7Sopenharmony_ci	}
907e5c31af7Sopenharmony_ci
908e5c31af7Sopenharmony_ci	return name.str();
909e5c31af7Sopenharmony_ci}
910e5c31af7Sopenharmony_ci
911e5c31af7Sopenharmony_civoid MultiVertexArrayStrideTests::init (void)
912e5c31af7Sopenharmony_ci{
913e5c31af7Sopenharmony_ci	// Test different strides, with multiple arrays, input types??
914e5c31af7Sopenharmony_ci	int arrayCounts[] = {3};
915e5c31af7Sopenharmony_ci
916e5c31af7Sopenharmony_ci	MultiVertexArrayTest::Spec spec;
917e5c31af7Sopenharmony_ci
918e5c31af7Sopenharmony_ci	spec.primitive	= Array::PRIMITIVE_TRIANGLES;
919e5c31af7Sopenharmony_ci	spec.drawCount	= 256;
920e5c31af7Sopenharmony_ci	spec.first		= 0;
921e5c31af7Sopenharmony_ci
922e5c31af7Sopenharmony_ci	for (int arrayCountNdx = 0; arrayCountNdx < DE_LENGTH_OF_ARRAY(arrayCounts); arrayCountNdx++)
923e5c31af7Sopenharmony_ci		addStrideCases(spec, arrayCounts[arrayCountNdx]);
924e5c31af7Sopenharmony_ci}
925e5c31af7Sopenharmony_ci
926e5c31af7Sopenharmony_civoid MultiVertexArrayStrideTests::addStrideCases (MultiVertexArrayTest::Spec spec, int depth)
927e5c31af7Sopenharmony_ci{
928e5c31af7Sopenharmony_ci	if (depth == 0)
929e5c31af7Sopenharmony_ci	{
930e5c31af7Sopenharmony_ci		std::string name = getTestName(spec);
931e5c31af7Sopenharmony_ci		std::string desc = getTestName(spec);
932e5c31af7Sopenharmony_ci		addChild(new MultiVertexArrayTest(m_testCtx, m_context.getRenderContext(), spec, name.c_str(), desc.c_str()));
933e5c31af7Sopenharmony_ci		return;
934e5c31af7Sopenharmony_ci	}
935e5c31af7Sopenharmony_ci
936e5c31af7Sopenharmony_ci	int strides[]	= {0, -1, 17, 32};
937e5c31af7Sopenharmony_ci
938e5c31af7Sopenharmony_ci	for (int strideNdx = 0; strideNdx < DE_LENGTH_OF_ARRAY(strides); strideNdx++)
939e5c31af7Sopenharmony_ci	{
940e5c31af7Sopenharmony_ci		const int componentCount = 2;
941e5c31af7Sopenharmony_ci		MultiVertexArrayTest::Spec::ArraySpec arraySpec(Array::INPUTTYPE_FLOAT,
942e5c31af7Sopenharmony_ci														Array::OUTPUTTYPE_VEC2,
943e5c31af7Sopenharmony_ci														Array::STORAGE_USER,
944e5c31af7Sopenharmony_ci														Array::USAGE_DYNAMIC_DRAW,
945e5c31af7Sopenharmony_ci														componentCount,
946e5c31af7Sopenharmony_ci														0,
947e5c31af7Sopenharmony_ci														(strides[strideNdx] >= 0 ? strides[strideNdx] : componentCount * Array::inputTypeSize(Array::INPUTTYPE_FLOAT)),
948e5c31af7Sopenharmony_ci														false,
949e5c31af7Sopenharmony_ci														GLValue::getMinValue(Array::INPUTTYPE_FLOAT),
950e5c31af7Sopenharmony_ci														GLValue::getMaxValue(Array::INPUTTYPE_FLOAT));
951e5c31af7Sopenharmony_ci
952e5c31af7Sopenharmony_ci		MultiVertexArrayTest::Spec _spec = spec;
953e5c31af7Sopenharmony_ci		_spec.arrays.push_back(arraySpec);
954e5c31af7Sopenharmony_ci		addStrideCases(_spec, depth-1);
955e5c31af7Sopenharmony_ci	}
956e5c31af7Sopenharmony_ci}
957e5c31af7Sopenharmony_ci
958e5c31af7Sopenharmony_ciclass MultiVertexArrayOutputTests : public TestCaseGroup
959e5c31af7Sopenharmony_ci{
960e5c31af7Sopenharmony_cipublic:
961e5c31af7Sopenharmony_ci										MultiVertexArrayOutputTests		(Context& context);
962e5c31af7Sopenharmony_ci	virtual								~MultiVertexArrayOutputTests	(void);
963e5c31af7Sopenharmony_ci
964e5c31af7Sopenharmony_ci	virtual void						init								(void);
965e5c31af7Sopenharmony_ci
966e5c31af7Sopenharmony_ciprivate:
967e5c31af7Sopenharmony_ci										MultiVertexArrayOutputTests		(const MultiVertexArrayOutputTests& other);
968e5c31af7Sopenharmony_ci	MultiVertexArrayOutputTests&	operator=							(const MultiVertexArrayOutputTests& other);
969e5c31af7Sopenharmony_ci
970e5c31af7Sopenharmony_ci	void								addInputTypeCases					(MultiVertexArrayTest::Spec spec, int depth);
971e5c31af7Sopenharmony_ci	std::string							getTestName							(const MultiVertexArrayTest::Spec& spec);
972e5c31af7Sopenharmony_ci};
973e5c31af7Sopenharmony_ci
974e5c31af7Sopenharmony_ciMultiVertexArrayOutputTests::MultiVertexArrayOutputTests (Context& context)
975e5c31af7Sopenharmony_ci	: TestCaseGroup(context, "input_types", "input types")
976e5c31af7Sopenharmony_ci{
977e5c31af7Sopenharmony_ci}
978e5c31af7Sopenharmony_ci
979e5c31af7Sopenharmony_ciMultiVertexArrayOutputTests::~MultiVertexArrayOutputTests (void)
980e5c31af7Sopenharmony_ci{
981e5c31af7Sopenharmony_ci}
982e5c31af7Sopenharmony_ci
983e5c31af7Sopenharmony_cistd::string MultiVertexArrayOutputTests::getTestName (const MultiVertexArrayTest::Spec& spec)
984e5c31af7Sopenharmony_ci{
985e5c31af7Sopenharmony_ci	std::stringstream name;
986e5c31af7Sopenharmony_ci
987e5c31af7Sopenharmony_ci	name
988e5c31af7Sopenharmony_ci		<< spec.arrays.size();
989e5c31af7Sopenharmony_ci
990e5c31af7Sopenharmony_ci	for (int arrayNdx = 0; arrayNdx < (int)spec.arrays.size(); arrayNdx++)
991e5c31af7Sopenharmony_ci	{
992e5c31af7Sopenharmony_ci		name
993e5c31af7Sopenharmony_ci			<< "_"
994e5c31af7Sopenharmony_ci			<< Array::inputTypeToString(spec.arrays[arrayNdx].inputType)
995e5c31af7Sopenharmony_ci			<< spec.arrays[arrayNdx].componentCount << "_"
996e5c31af7Sopenharmony_ci			<< Array::outputTypeToString(spec.arrays[arrayNdx].outputType);
997e5c31af7Sopenharmony_ci	}
998e5c31af7Sopenharmony_ci
999e5c31af7Sopenharmony_ci	return name.str();
1000e5c31af7Sopenharmony_ci}
1001e5c31af7Sopenharmony_ci
1002e5c31af7Sopenharmony_civoid MultiVertexArrayOutputTests::init (void)
1003e5c31af7Sopenharmony_ci{
1004e5c31af7Sopenharmony_ci	// Test different input types, with multiple arrays
1005e5c31af7Sopenharmony_ci	int arrayCounts[] = {3};
1006e5c31af7Sopenharmony_ci
1007e5c31af7Sopenharmony_ci	MultiVertexArrayTest::Spec spec;
1008e5c31af7Sopenharmony_ci
1009e5c31af7Sopenharmony_ci	spec.primitive	= Array::PRIMITIVE_TRIANGLES;
1010e5c31af7Sopenharmony_ci	spec.drawCount	= 256;
1011e5c31af7Sopenharmony_ci	spec.first		= 0;
1012e5c31af7Sopenharmony_ci
1013e5c31af7Sopenharmony_ci	for (int arrayCountNdx = 0; arrayCountNdx < DE_LENGTH_OF_ARRAY(arrayCounts); arrayCountNdx++)
1014e5c31af7Sopenharmony_ci		addInputTypeCases(spec, arrayCounts[arrayCountNdx]);
1015e5c31af7Sopenharmony_ci}
1016e5c31af7Sopenharmony_ci
1017e5c31af7Sopenharmony_civoid MultiVertexArrayOutputTests::addInputTypeCases (MultiVertexArrayTest::Spec spec, int depth)
1018e5c31af7Sopenharmony_ci{
1019e5c31af7Sopenharmony_ci	if (depth == 0)
1020e5c31af7Sopenharmony_ci	{
1021e5c31af7Sopenharmony_ci		std::string name = getTestName(spec);
1022e5c31af7Sopenharmony_ci		std::string desc = getTestName(spec);
1023e5c31af7Sopenharmony_ci		addChild(new MultiVertexArrayTest(m_testCtx, m_context.getRenderContext(), spec, name.c_str(), desc.c_str()));
1024e5c31af7Sopenharmony_ci		return;
1025e5c31af7Sopenharmony_ci	}
1026e5c31af7Sopenharmony_ci
1027e5c31af7Sopenharmony_ci	Array::InputType inputTypes[] = {Array::INPUTTYPE_FIXED, Array::INPUTTYPE_BYTE, Array::INPUTTYPE_SHORT, Array::INPUTTYPE_UNSIGNED_BYTE, Array::INPUTTYPE_UNSIGNED_SHORT};
1028e5c31af7Sopenharmony_ci	for (int inputTypeNdx = 0; inputTypeNdx < DE_LENGTH_OF_ARRAY(inputTypes); inputTypeNdx++)
1029e5c31af7Sopenharmony_ci	{
1030e5c31af7Sopenharmony_ci		MultiVertexArrayTest::Spec::ArraySpec arraySpec(inputTypes[inputTypeNdx],
1031e5c31af7Sopenharmony_ci														Array::OUTPUTTYPE_VEC2,
1032e5c31af7Sopenharmony_ci														Array::STORAGE_USER,
1033e5c31af7Sopenharmony_ci														Array::USAGE_DYNAMIC_DRAW,
1034e5c31af7Sopenharmony_ci														2,
1035e5c31af7Sopenharmony_ci														0,
1036e5c31af7Sopenharmony_ci														0,
1037e5c31af7Sopenharmony_ci														false,
1038e5c31af7Sopenharmony_ci														GLValue::getMinValue(inputTypes[inputTypeNdx]),
1039e5c31af7Sopenharmony_ci														GLValue::getMaxValue(inputTypes[inputTypeNdx]));
1040e5c31af7Sopenharmony_ci
1041e5c31af7Sopenharmony_ci		MultiVertexArrayTest::Spec _spec = spec;
1042e5c31af7Sopenharmony_ci		_spec.arrays.push_back(arraySpec);
1043e5c31af7Sopenharmony_ci		addInputTypeCases(_spec, depth-1);
1044e5c31af7Sopenharmony_ci	}
1045e5c31af7Sopenharmony_ci}
1046e5c31af7Sopenharmony_ci
1047e5c31af7Sopenharmony_ciclass MultiVertexArrayTestGroup : public TestCaseGroup
1048e5c31af7Sopenharmony_ci{
1049e5c31af7Sopenharmony_cipublic:
1050e5c31af7Sopenharmony_ci									MultiVertexArrayTestGroup	(Context& context);
1051e5c31af7Sopenharmony_ci	virtual							~MultiVertexArrayTestGroup	(void);
1052e5c31af7Sopenharmony_ci
1053e5c31af7Sopenharmony_ci	virtual void					init						(void);
1054e5c31af7Sopenharmony_ci
1055e5c31af7Sopenharmony_ciprivate:
1056e5c31af7Sopenharmony_ci									MultiVertexArrayTestGroup	(const MultiVertexArrayTestGroup& other);
1057e5c31af7Sopenharmony_ci	MultiVertexArrayTestGroup&		operator=					(const MultiVertexArrayTestGroup& other);
1058e5c31af7Sopenharmony_ci};
1059e5c31af7Sopenharmony_ci
1060e5c31af7Sopenharmony_ciMultiVertexArrayTestGroup::MultiVertexArrayTestGroup (Context& context)
1061e5c31af7Sopenharmony_ci	: TestCaseGroup(context, "multiple_attributes", "Multiple vertex atributes")
1062e5c31af7Sopenharmony_ci{
1063e5c31af7Sopenharmony_ci}
1064e5c31af7Sopenharmony_ci
1065e5c31af7Sopenharmony_ciMultiVertexArrayTestGroup::~MultiVertexArrayTestGroup (void)
1066e5c31af7Sopenharmony_ci{
1067e5c31af7Sopenharmony_ci}
1068e5c31af7Sopenharmony_ci
1069e5c31af7Sopenharmony_civoid MultiVertexArrayTestGroup::init (void)
1070e5c31af7Sopenharmony_ci{
1071e5c31af7Sopenharmony_ci	addChild(new MultiVertexArrayCountTests(m_context));
1072e5c31af7Sopenharmony_ci	addChild(new MultiVertexArrayStorageTests(m_context));
1073e5c31af7Sopenharmony_ci	addChild(new MultiVertexArrayStrideTests(m_context));
1074e5c31af7Sopenharmony_ci	addChild(new MultiVertexArrayOutputTests(m_context));
1075e5c31af7Sopenharmony_ci}
1076e5c31af7Sopenharmony_ci
1077e5c31af7Sopenharmony_ciVertexArrayTestGroup::VertexArrayTestGroup (Context& context)
1078e5c31af7Sopenharmony_ci	: TestCaseGroup(context, "vertex_arrays", "Vertex array and array tests")
1079e5c31af7Sopenharmony_ci{
1080e5c31af7Sopenharmony_ci}
1081e5c31af7Sopenharmony_ci
1082e5c31af7Sopenharmony_ciVertexArrayTestGroup::~VertexArrayTestGroup (void)
1083e5c31af7Sopenharmony_ci{
1084e5c31af7Sopenharmony_ci}
1085e5c31af7Sopenharmony_ci
1086e5c31af7Sopenharmony_civoid VertexArrayTestGroup::init (void)
1087e5c31af7Sopenharmony_ci{
1088e5c31af7Sopenharmony_ci	addChild(new SingleVertexArrayTestGroup(m_context));
1089e5c31af7Sopenharmony_ci	addChild(new MultiVertexArrayTestGroup(m_context));
1090e5c31af7Sopenharmony_ci}
1091e5c31af7Sopenharmony_ci
1092e5c31af7Sopenharmony_ci} // Functional
1093e5c31af7Sopenharmony_ci} // gles3
1094e5c31af7Sopenharmony_ci} // deqp
1095