1e5c31af7Sopenharmony_ci/*-------------------------------------------------------------------------
2e5c31af7Sopenharmony_ci * OpenGL Conformance Test Suite
3e5c31af7Sopenharmony_ci * -----------------------------
4e5c31af7Sopenharmony_ci *
5e5c31af7Sopenharmony_ci * Copyright (c) 2014-2016 The Khronos Group Inc.
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
22e5c31af7Sopenharmony_ci */ /*-------------------------------------------------------------------*/
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ci#include "esextcGeometryShaderConstantVariables.hpp"
25e5c31af7Sopenharmony_ci#include "gluContextInfo.hpp"
26e5c31af7Sopenharmony_ci#include "gluDefs.hpp"
27e5c31af7Sopenharmony_ci#include "glwEnums.hpp"
28e5c31af7Sopenharmony_ci#include "glwFunctions.hpp"
29e5c31af7Sopenharmony_ci#include "tcuTestLog.hpp"
30e5c31af7Sopenharmony_ci
31e5c31af7Sopenharmony_cinamespace glcts
32e5c31af7Sopenharmony_ci{
33e5c31af7Sopenharmony_ci
34e5c31af7Sopenharmony_ci/* Fragment shader code */
35e5c31af7Sopenharmony_ciconst char* GeometryShaderConstantVariables::m_fragment_shader_code = "${VERSION}\n"
36e5c31af7Sopenharmony_ci																	  "\n"
37e5c31af7Sopenharmony_ci																	  "precision highp float;\n"
38e5c31af7Sopenharmony_ci																	  "\n"
39e5c31af7Sopenharmony_ci																	  "out vec4 color;\n"
40e5c31af7Sopenharmony_ci																	  "\n"
41e5c31af7Sopenharmony_ci																	  "void main()\n"
42e5c31af7Sopenharmony_ci																	  "{\n"
43e5c31af7Sopenharmony_ci																	  "   color = vec4(1, 1, 1, 1);\n"
44e5c31af7Sopenharmony_ci																	  "}\n";
45e5c31af7Sopenharmony_ci
46e5c31af7Sopenharmony_ci/* Geometry shader code */
47e5c31af7Sopenharmony_ciconst char* GeometryShaderConstantVariables::m_geometry_shader_code =
48e5c31af7Sopenharmony_ci	"${VERSION}\n"
49e5c31af7Sopenharmony_ci	"\n"
50e5c31af7Sopenharmony_ci	"${GEOMETRY_SHADER_REQUIRE}\n"
51e5c31af7Sopenharmony_ci	"\n"
52e5c31af7Sopenharmony_ci	"precision highp float;\n"
53e5c31af7Sopenharmony_ci	"\n"
54e5c31af7Sopenharmony_ci	"layout(points)                 in;\n"
55e5c31af7Sopenharmony_ci	"layout(points, max_vertices=1) out;\n"
56e5c31af7Sopenharmony_ci	"\n"
57e5c31af7Sopenharmony_ci	"flat out int test_MaxGeometryInputComponents;\n"
58e5c31af7Sopenharmony_ci	"flat out int test_MaxGeometryOutputComponents;\n"
59e5c31af7Sopenharmony_ci	"flat out int test_MaxGeometryTextureImageUnits;\n"
60e5c31af7Sopenharmony_ci	"flat out int test_MaxGeometryOutputVertices;\n"
61e5c31af7Sopenharmony_ci	"flat out int test_MaxGeometryTotalOutputComponents;\n"
62e5c31af7Sopenharmony_ci	"flat out int test_MaxGeometryUniformComponents;\n"
63e5c31af7Sopenharmony_ci	"flat out int test_MaxGeometryAtomicCounters;\n"
64e5c31af7Sopenharmony_ci	"flat out int test_MaxGeometryAtomicCounterBuffers;\n"
65e5c31af7Sopenharmony_ci	"flat out int test_MaxGeometryImageUniforms;\n"
66e5c31af7Sopenharmony_ci	"\n"
67e5c31af7Sopenharmony_ci	"void main()\n"
68e5c31af7Sopenharmony_ci	"{\n"
69e5c31af7Sopenharmony_ci	"   test_MaxGeometryInputComponents       = gl_MaxGeometryInputComponents;\n"
70e5c31af7Sopenharmony_ci	"   test_MaxGeometryOutputComponents      = gl_MaxGeometryOutputComponents;\n"
71e5c31af7Sopenharmony_ci	"   test_MaxGeometryTextureImageUnits     = gl_MaxGeometryTextureImageUnits;\n"
72e5c31af7Sopenharmony_ci	"   test_MaxGeometryOutputVertices        = gl_MaxGeometryOutputVertices;\n"
73e5c31af7Sopenharmony_ci	"   test_MaxGeometryTotalOutputComponents = gl_MaxGeometryTotalOutputComponents;\n"
74e5c31af7Sopenharmony_ci	"   test_MaxGeometryUniformComponents     = gl_MaxGeometryUniformComponents;\n"
75e5c31af7Sopenharmony_ci	"   test_MaxGeometryAtomicCounters        = gl_MaxGeometryAtomicCounters;\n"
76e5c31af7Sopenharmony_ci	"   test_MaxGeometryAtomicCounterBuffers  = gl_MaxGeometryAtomicCounterBuffers;\n"
77e5c31af7Sopenharmony_ci	"   test_MaxGeometryImageUniforms         = gl_MaxGeometryImageUniforms;\n"
78e5c31af7Sopenharmony_ci	"\n"
79e5c31af7Sopenharmony_ci	"   EmitVertex();\n"
80e5c31af7Sopenharmony_ci	"   EndPrimitive();\n"
81e5c31af7Sopenharmony_ci	"}\n";
82e5c31af7Sopenharmony_ci
83e5c31af7Sopenharmony_ci/* Vertex shader code */
84e5c31af7Sopenharmony_ciconst char* GeometryShaderConstantVariables::m_vertex_shader_code = "${VERSION}\n"
85e5c31af7Sopenharmony_ci																	"\n"
86e5c31af7Sopenharmony_ci																	"precision highp float;\n"
87e5c31af7Sopenharmony_ci																	"\n"
88e5c31af7Sopenharmony_ci																	"void main()\n"
89e5c31af7Sopenharmony_ci																	"{\n"
90e5c31af7Sopenharmony_ci																	"}\n";
91e5c31af7Sopenharmony_ci
92e5c31af7Sopenharmony_ci/* Specify transform feedback varyings */
93e5c31af7Sopenharmony_ciconst char* GeometryShaderConstantVariables::m_feedbackVaryings[] = {
94e5c31af7Sopenharmony_ci	"test_MaxGeometryInputComponents", "test_MaxGeometryOutputComponents",		"test_MaxGeometryTextureImageUnits",
95e5c31af7Sopenharmony_ci	"test_MaxGeometryOutputVertices",  "test_MaxGeometryTotalOutputComponents", "test_MaxGeometryUniformComponents",
96e5c31af7Sopenharmony_ci	"test_MaxGeometryAtomicCounters",  "test_MaxGeometryAtomicCounterBuffers",  "test_MaxGeometryImageUniforms"
97e5c31af7Sopenharmony_ci};
98e5c31af7Sopenharmony_ci
99e5c31af7Sopenharmony_ci/** Constructor
100e5c31af7Sopenharmony_ci *
101e5c31af7Sopenharmony_ci * @param context     Test context
102e5c31af7Sopenharmony_ci * @param name        Test case's name
103e5c31af7Sopenharmony_ci * @param description Test case's desricption
104e5c31af7Sopenharmony_ci **/
105e5c31af7Sopenharmony_ciGeometryShaderConstantVariables::GeometryShaderConstantVariables(Context& context, const ExtParameters& extParams,
106e5c31af7Sopenharmony_ci																 const char* name, const char* description)
107e5c31af7Sopenharmony_ci	: TestCaseBase(context, extParams, name, description)
108e5c31af7Sopenharmony_ci	, m_fragment_shader_id(0)
109e5c31af7Sopenharmony_ci	, m_geometry_shader_id(0)
110e5c31af7Sopenharmony_ci	, m_vertex_shader_id(0)
111e5c31af7Sopenharmony_ci	, m_program_id(0)
112e5c31af7Sopenharmony_ci	, m_bo_id(0)
113e5c31af7Sopenharmony_ci	, m_vao_id(0)
114e5c31af7Sopenharmony_ci	, m_min_MaxGeometryImagesUniforms(0)
115e5c31af7Sopenharmony_ci	, m_min_MaxGeometryTextureImagesUnits(16)
116e5c31af7Sopenharmony_ci	, m_min_MaxGeometryShaderStorageBlocks(0)
117e5c31af7Sopenharmony_ci	, m_min_MaxGeometryAtomicCounterBuffers(0)
118e5c31af7Sopenharmony_ci	, m_min_MaxGeometryAtomicCounters(0)
119e5c31af7Sopenharmony_ci	, m_min_MaxFramebufferLayers(256)
120e5c31af7Sopenharmony_ci	, m_min_MaxGeometryInputComponents(64)
121e5c31af7Sopenharmony_ci	, m_min_MaxGeometryOutputComponents(64)
122e5c31af7Sopenharmony_ci	, m_min_MaxGeometryOutputVertices(256)
123e5c31af7Sopenharmony_ci	, m_min_MaxGeometryShaderInvocations(32)
124e5c31af7Sopenharmony_ci	, m_min_MaxGeometryTotalOutputComponents(1024)
125e5c31af7Sopenharmony_ci	, m_min_MaxGeometryUniformBlocks(12)
126e5c31af7Sopenharmony_ci	, m_min_MaxGeometryUniformComponents(1024)
127e5c31af7Sopenharmony_ci{
128e5c31af7Sopenharmony_ci	/* Left blank intentionally */
129e5c31af7Sopenharmony_ci}
130e5c31af7Sopenharmony_ci
131e5c31af7Sopenharmony_ci/** Initializes GLES objects used during the test.
132e5c31af7Sopenharmony_ci *
133e5c31af7Sopenharmony_ci **/
134e5c31af7Sopenharmony_civoid GeometryShaderConstantVariables::initTest(void)
135e5c31af7Sopenharmony_ci{
136e5c31af7Sopenharmony_ci	/* This test should only run if EXT_geometry_shader is supported */
137e5c31af7Sopenharmony_ci	if (!m_is_geometry_shader_extension_supported)
138e5c31af7Sopenharmony_ci	{
139e5c31af7Sopenharmony_ci		throw tcu::NotSupportedError(GEOMETRY_SHADER_EXTENSION_NOT_SUPPORTED, "", __FILE__, __LINE__);
140e5c31af7Sopenharmony_ci	}
141e5c31af7Sopenharmony_ci
142e5c31af7Sopenharmony_ci	const glw::Functions& gl = m_context.getRenderContext().getFunctions();
143e5c31af7Sopenharmony_ci
144e5c31af7Sopenharmony_ci	/* Create VAO */
145e5c31af7Sopenharmony_ci	gl.genVertexArrays(1, &m_vao_id);
146e5c31af7Sopenharmony_ci
147e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "Could not create VAO!");
148e5c31af7Sopenharmony_ci
149e5c31af7Sopenharmony_ci	/* Create a program object and set it up for TF */
150e5c31af7Sopenharmony_ci	const unsigned int n_varyings = sizeof(m_feedbackVaryings) / sizeof(m_feedbackVaryings[0]);
151e5c31af7Sopenharmony_ci
152e5c31af7Sopenharmony_ci	m_program_id = gl.createProgram();
153e5c31af7Sopenharmony_ci
154e5c31af7Sopenharmony_ci	gl.transformFeedbackVaryings(m_program_id, n_varyings, m_feedbackVaryings, GL_INTERLEAVED_ATTRIBS);
155e5c31af7Sopenharmony_ci
156e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "Could not set program object for transform feedback");
157e5c31af7Sopenharmony_ci
158e5c31af7Sopenharmony_ci	/* Create shaders */
159e5c31af7Sopenharmony_ci	m_vertex_shader_id   = gl.createShader(GL_VERTEX_SHADER);
160e5c31af7Sopenharmony_ci	m_geometry_shader_id = gl.createShader(m_glExtTokens.GEOMETRY_SHADER);
161e5c31af7Sopenharmony_ci	m_fragment_shader_id = gl.createShader(GL_FRAGMENT_SHADER);
162e5c31af7Sopenharmony_ci
163e5c31af7Sopenharmony_ci	/* Build the test program */
164e5c31af7Sopenharmony_ci	if (!buildProgram(m_program_id, m_fragment_shader_id, 1, &m_fragment_shader_code, m_geometry_shader_id, 1,
165e5c31af7Sopenharmony_ci					  &m_geometry_shader_code, m_vertex_shader_id, 1, &m_vertex_shader_code))
166e5c31af7Sopenharmony_ci	{
167e5c31af7Sopenharmony_ci		TCU_FAIL("Program could not have been created from a valid vertex/geometry/fragment shader!");
168e5c31af7Sopenharmony_ci	}
169e5c31af7Sopenharmony_ci
170e5c31af7Sopenharmony_ci	/* Create and set up a buffer object we will use for the test */
171e5c31af7Sopenharmony_ci	gl.genBuffers(1, &m_bo_id);
172e5c31af7Sopenharmony_ci	gl.bindBuffer(GL_ARRAY_BUFFER, m_bo_id);
173e5c31af7Sopenharmony_ci	gl.bufferData(GL_ARRAY_BUFFER, sizeof(glw::GLint) * n_varyings, DE_NULL, GL_STATIC_COPY);
174e5c31af7Sopenharmony_ci	gl.bindBuffer(GL_ARRAY_BUFFER, 0);
175e5c31af7Sopenharmony_ci
176e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "Could not set a buffer object up");
177e5c31af7Sopenharmony_ci}
178e5c31af7Sopenharmony_ci
179e5c31af7Sopenharmony_ci/** Executes the test.
180e5c31af7Sopenharmony_ci *  Sets the test result to QP_TEST_RESULT_FAIL if the test failed, QP_TEST_RESULT_PASS otherwise.
181e5c31af7Sopenharmony_ci *  @return STOP if the test has finished, CONTINUE to indicate iterate should be called once again.
182e5c31af7Sopenharmony_ci *  Note the function throws exception should an error occur!
183e5c31af7Sopenharmony_ci **/
184e5c31af7Sopenharmony_citcu::TestNode::IterateResult GeometryShaderConstantVariables::iterate(void)
185e5c31af7Sopenharmony_ci{
186e5c31af7Sopenharmony_ci	initTest();
187e5c31af7Sopenharmony_ci
188e5c31af7Sopenharmony_ci	const glw::Functions& gl = m_context.getRenderContext().getFunctions();
189e5c31af7Sopenharmony_ci
190e5c31af7Sopenharmony_ci	/* Set up relevant bindings */
191e5c31af7Sopenharmony_ci	gl.bindVertexArray(m_vao_id);
192e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "Could not bind a vertex array object");
193e5c31af7Sopenharmony_ci
194e5c31af7Sopenharmony_ci	gl.bindBuffer(GL_ARRAY_BUFFER, m_bo_id);
195e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "Could not bind a buffer object!");
196e5c31af7Sopenharmony_ci
197e5c31af7Sopenharmony_ci	gl.bindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, m_bo_id);
198e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "Could not bind buffer object to transform feedback binding point.");
199e5c31af7Sopenharmony_ci
200e5c31af7Sopenharmony_ci	/* Prepare for rendering. */
201e5c31af7Sopenharmony_ci	gl.useProgram(m_program_id);
202e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "Could not use program");
203e5c31af7Sopenharmony_ci
204e5c31af7Sopenharmony_ci	gl.enable(GL_RASTERIZER_DISCARD);
205e5c31af7Sopenharmony_ci
206e5c31af7Sopenharmony_ci	gl.beginTransformFeedback(GL_POINTS);
207e5c31af7Sopenharmony_ci	{
208e5c31af7Sopenharmony_ci		/* Render */
209e5c31af7Sopenharmony_ci		gl.drawArrays(GL_POINTS, 0 /* first */, 1 /* count */);
210e5c31af7Sopenharmony_ci	}
211e5c31af7Sopenharmony_ci	gl.endTransformFeedback();
212e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "Rendering failed.");
213e5c31af7Sopenharmony_ci
214e5c31af7Sopenharmony_ci	gl.disable(GL_RASTERIZER_DISCARD);
215e5c31af7Sopenharmony_ci
216e5c31af7Sopenharmony_ci	/* First, retrieve the ES constant values using the API. */
217e5c31af7Sopenharmony_ci	const unsigned int n_varyings				   = sizeof(m_feedbackVaryings) / sizeof(m_feedbackVaryings[0]);
218e5c31af7Sopenharmony_ci	glw::GLint		   constant_values[n_varyings] = { 0 };
219e5c31af7Sopenharmony_ci	unsigned int	   index					   = 0;
220e5c31af7Sopenharmony_ci
221e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_INPUT_COMPONENTS, &constant_values[index]);
222e5c31af7Sopenharmony_ci	index++;
223e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() for GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT failed.");
224e5c31af7Sopenharmony_ci
225e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_OUTPUT_COMPONENTS, &constant_values[index]);
226e5c31af7Sopenharmony_ci	index++;
227e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() for GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT failed.");
228e5c31af7Sopenharmony_ci
229e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_TEXTURE_IMAGE_UNITS, &constant_values[index]);
230e5c31af7Sopenharmony_ci	index++;
231e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() for GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT failed.");
232e5c31af7Sopenharmony_ci
233e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_OUTPUT_VERTICES, &constant_values[index]);
234e5c31af7Sopenharmony_ci	index++;
235e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() for GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT failed.");
236e5c31af7Sopenharmony_ci
237e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS, &constant_values[index]);
238e5c31af7Sopenharmony_ci	index++;
239e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() for GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT failed.");
240e5c31af7Sopenharmony_ci
241e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_UNIFORM_COMPONENTS, &constant_values[index]);
242e5c31af7Sopenharmony_ci	index++;
243e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() for GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT failed.");
244e5c31af7Sopenharmony_ci
245e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_ATOMIC_COUNTERS, &constant_values[index]);
246e5c31af7Sopenharmony_ci	index++;
247e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() for GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT failed.");
248e5c31af7Sopenharmony_ci
249e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS, &constant_values[index]);
250e5c31af7Sopenharmony_ci	index++;
251e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() for GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT failed.");
252e5c31af7Sopenharmony_ci
253e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_IMAGE_UNIFORMS, &constant_values[index]);
254e5c31af7Sopenharmony_ci	index++;
255e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() for GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT failed.");
256e5c31af7Sopenharmony_ci
257e5c31af7Sopenharmony_ci	const glw::GLint* stored_data_ptr = (const glw::GLint*)gl.mapBufferRange(
258e5c31af7Sopenharmony_ci		GL_TRANSFORM_FEEDBACK_BUFFER, 0, sizeof(glw::GLint) * n_varyings, GL_MAP_READ_BIT);
259e5c31af7Sopenharmony_ci
260e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "Could not map buffer object storage");
261e5c31af7Sopenharmony_ci
262e5c31af7Sopenharmony_ci	/* Compare the values that were stored by the draw call with values
263e5c31af7Sopenharmony_ci	 * returned by the getter call.
264e5c31af7Sopenharmony_ci	 */
265e5c31af7Sopenharmony_ci	bool has_failed = false;
266e5c31af7Sopenharmony_ci	for (unsigned int id = 0; id < n_varyings; ++id)
267e5c31af7Sopenharmony_ci	{
268e5c31af7Sopenharmony_ci		if (constant_values[id] != stored_data_ptr[id])
269e5c31af7Sopenharmony_ci		{
270e5c31af7Sopenharmony_ci			m_testCtx.getLog() << tcu::TestLog::Message << "Values reported for ES constant " << m_feedbackVaryings[id]
271e5c31af7Sopenharmony_ci							   << " in a shader: " << stored_data_ptr[id]
272e5c31af7Sopenharmony_ci							   << " and via a glGetIntegerv() call: " << constant_values[id] << " do not match."
273e5c31af7Sopenharmony_ci							   << tcu::TestLog::EndMessage;
274e5c31af7Sopenharmony_ci			has_failed = true;
275e5c31af7Sopenharmony_ci		}
276e5c31af7Sopenharmony_ci	}
277e5c31af7Sopenharmony_ci
278e5c31af7Sopenharmony_ci	gl.unmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER);
279e5c31af7Sopenharmony_ci
280e5c31af7Sopenharmony_ci	/* Check whether the reported values are at least of the minimum value described in relevant
281e5c31af7Sopenharmony_ci	 * extension specifications */
282e5c31af7Sopenharmony_ci
283e5c31af7Sopenharmony_ci	glw::GLint int_value = 0;
284e5c31af7Sopenharmony_ci
285e5c31af7Sopenharmony_ci	/* Check values of ES constants specific to shader atomic counters */
286e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS, &int_value);
287e5c31af7Sopenharmony_ci
288e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT");
289e5c31af7Sopenharmony_ci
290e5c31af7Sopenharmony_ci	if (int_value < m_min_MaxGeometryAtomicCounterBuffers)
291e5c31af7Sopenharmony_ci	{
292e5c31af7Sopenharmony_ci		m_testCtx.getLog() << tcu::TestLog::Message
293e5c31af7Sopenharmony_ci						   << "Reported GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT constant value " << int_value
294e5c31af7Sopenharmony_ci						   << " is smaller than required minimum value of " << m_min_MaxGeometryAtomicCounterBuffers
295e5c31af7Sopenharmony_ci						   << tcu::TestLog::EndMessage;
296e5c31af7Sopenharmony_ci
297e5c31af7Sopenharmony_ci		has_failed = true;
298e5c31af7Sopenharmony_ci	}
299e5c31af7Sopenharmony_ci
300e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_ATOMIC_COUNTERS, &int_value);
301e5c31af7Sopenharmony_ci
302e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT");
303e5c31af7Sopenharmony_ci
304e5c31af7Sopenharmony_ci	if (int_value < m_min_MaxGeometryAtomicCounters)
305e5c31af7Sopenharmony_ci	{
306e5c31af7Sopenharmony_ci		m_testCtx.getLog() << tcu::TestLog::Message << "Reported GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT constant value "
307e5c31af7Sopenharmony_ci						   << int_value << " is smaller than required minimum value of "
308e5c31af7Sopenharmony_ci						   << m_min_MaxGeometryAtomicCounters << tcu::TestLog::EndMessage;
309e5c31af7Sopenharmony_ci
310e5c31af7Sopenharmony_ci		has_failed = true;
311e5c31af7Sopenharmony_ci	}
312e5c31af7Sopenharmony_ci
313e5c31af7Sopenharmony_ci	/* Check values of ES constants specific to image load store */
314e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_IMAGE_UNIFORMS, &int_value);
315e5c31af7Sopenharmony_ci
316e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT");
317e5c31af7Sopenharmony_ci
318e5c31af7Sopenharmony_ci	if (int_value < m_min_MaxGeometryImagesUniforms)
319e5c31af7Sopenharmony_ci	{
320e5c31af7Sopenharmony_ci		m_testCtx.getLog() << tcu::TestLog::Message << "Reported GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT constant value "
321e5c31af7Sopenharmony_ci						   << int_value << " is smaller than required minimum value of "
322e5c31af7Sopenharmony_ci						   << m_min_MaxGeometryImagesUniforms << tcu::TestLog::EndMessage;
323e5c31af7Sopenharmony_ci
324e5c31af7Sopenharmony_ci		has_failed = true;
325e5c31af7Sopenharmony_ci	}
326e5c31af7Sopenharmony_ci
327e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_TEXTURE_IMAGE_UNITS, &int_value);
328e5c31af7Sopenharmony_ci
329e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT");
330e5c31af7Sopenharmony_ci
331e5c31af7Sopenharmony_ci	if (int_value < m_min_MaxGeometryTextureImagesUnits)
332e5c31af7Sopenharmony_ci	{
333e5c31af7Sopenharmony_ci		m_testCtx.getLog() << tcu::TestLog::Message
334e5c31af7Sopenharmony_ci						   << "Reported GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT constant value " << int_value
335e5c31af7Sopenharmony_ci						   << " is smaller than required minimum value of " << m_min_MaxGeometryTextureImagesUnits
336e5c31af7Sopenharmony_ci						   << tcu::TestLog::EndMessage;
337e5c31af7Sopenharmony_ci
338e5c31af7Sopenharmony_ci		has_failed = true;
339e5c31af7Sopenharmony_ci	}
340e5c31af7Sopenharmony_ci
341e5c31af7Sopenharmony_ci	/* Check values of ES constants specific to shader storage buffer objects */
342e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_SHADER_STORAGE_BLOCKS, &int_value);
343e5c31af7Sopenharmony_ci
344e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT");
345e5c31af7Sopenharmony_ci
346e5c31af7Sopenharmony_ci	if (int_value < m_min_MaxGeometryShaderStorageBlocks)
347e5c31af7Sopenharmony_ci	{
348e5c31af7Sopenharmony_ci		m_testCtx.getLog() << tcu::TestLog::Message
349e5c31af7Sopenharmony_ci						   << "Reported GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT constant value " << int_value
350e5c31af7Sopenharmony_ci						   << " is smaller than required minimum value of " << m_min_MaxGeometryShaderStorageBlocks
351e5c31af7Sopenharmony_ci						   << tcu::TestLog::EndMessage;
352e5c31af7Sopenharmony_ci
353e5c31af7Sopenharmony_ci		has_failed = true;
354e5c31af7Sopenharmony_ci	}
355e5c31af7Sopenharmony_ci
356e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_UNIFORM_COMPONENTS, &int_value);
357e5c31af7Sopenharmony_ci
358e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT");
359e5c31af7Sopenharmony_ci
360e5c31af7Sopenharmony_ci	if (int_value < m_min_MaxGeometryUniformComponents)
361e5c31af7Sopenharmony_ci	{
362e5c31af7Sopenharmony_ci		m_testCtx.getLog() << tcu::TestLog::Message << "Reported GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT constant value "
363e5c31af7Sopenharmony_ci						   << int_value << " is smaller than required minimum value of "
364e5c31af7Sopenharmony_ci						   << m_min_MaxGeometryUniformComponents << tcu::TestLog::EndMessage;
365e5c31af7Sopenharmony_ci
366e5c31af7Sopenharmony_ci		has_failed = true;
367e5c31af7Sopenharmony_ci	}
368e5c31af7Sopenharmony_ci
369e5c31af7Sopenharmony_ci	/* Check EXT_geometry_shader specific constant values */
370e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_UNIFORM_BLOCKS, &int_value);
371e5c31af7Sopenharmony_ci
372e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT");
373e5c31af7Sopenharmony_ci
374e5c31af7Sopenharmony_ci	if (int_value < m_min_MaxGeometryUniformBlocks)
375e5c31af7Sopenharmony_ci	{
376e5c31af7Sopenharmony_ci		m_testCtx.getLog() << tcu::TestLog::Message << "Reported GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT constant value "
377e5c31af7Sopenharmony_ci						   << int_value << " is smaller than required minimum value of "
378e5c31af7Sopenharmony_ci						   << m_min_MaxGeometryUniformBlocks << tcu::TestLog::EndMessage;
379e5c31af7Sopenharmony_ci
380e5c31af7Sopenharmony_ci		has_failed = true;
381e5c31af7Sopenharmony_ci	}
382e5c31af7Sopenharmony_ci
383e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_INPUT_COMPONENTS, &int_value);
384e5c31af7Sopenharmony_ci
385e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT");
386e5c31af7Sopenharmony_ci
387e5c31af7Sopenharmony_ci	if (int_value < m_min_MaxGeometryInputComponents)
388e5c31af7Sopenharmony_ci	{
389e5c31af7Sopenharmony_ci		m_testCtx.getLog() << tcu::TestLog::Message << "Reported GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT constant value "
390e5c31af7Sopenharmony_ci						   << int_value << " is smaller than required minimum value of "
391e5c31af7Sopenharmony_ci						   << m_min_MaxGeometryInputComponents << tcu::TestLog::EndMessage;
392e5c31af7Sopenharmony_ci
393e5c31af7Sopenharmony_ci		has_failed = true;
394e5c31af7Sopenharmony_ci	}
395e5c31af7Sopenharmony_ci
396e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_OUTPUT_COMPONENTS, &int_value);
397e5c31af7Sopenharmony_ci
398e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT");
399e5c31af7Sopenharmony_ci
400e5c31af7Sopenharmony_ci	if (int_value < m_min_MaxGeometryOutputComponents)
401e5c31af7Sopenharmony_ci	{
402e5c31af7Sopenharmony_ci		m_testCtx.getLog() << tcu::TestLog::Message << "Reported GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT constant value "
403e5c31af7Sopenharmony_ci						   << int_value << " is smaller than required minimum value of "
404e5c31af7Sopenharmony_ci						   << m_min_MaxGeometryOutputComponents << tcu::TestLog::EndMessage;
405e5c31af7Sopenharmony_ci
406e5c31af7Sopenharmony_ci		has_failed = true;
407e5c31af7Sopenharmony_ci	}
408e5c31af7Sopenharmony_ci
409e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_OUTPUT_VERTICES, &int_value);
410e5c31af7Sopenharmony_ci
411e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT");
412e5c31af7Sopenharmony_ci
413e5c31af7Sopenharmony_ci	if (int_value < m_min_MaxGeometryOutputVertices)
414e5c31af7Sopenharmony_ci	{
415e5c31af7Sopenharmony_ci		m_testCtx.getLog() << tcu::TestLog::Message << "Reported GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT constant value "
416e5c31af7Sopenharmony_ci						   << int_value << " is smaller than required minimum value of "
417e5c31af7Sopenharmony_ci						   << m_min_MaxGeometryOutputVertices << tcu::TestLog::EndMessage;
418e5c31af7Sopenharmony_ci
419e5c31af7Sopenharmony_ci		has_failed = true;
420e5c31af7Sopenharmony_ci	}
421e5c31af7Sopenharmony_ci
422e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS, &int_value);
423e5c31af7Sopenharmony_ci
424e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT");
425e5c31af7Sopenharmony_ci
426e5c31af7Sopenharmony_ci	if (int_value < m_min_MaxGeometryTotalOutputComponents)
427e5c31af7Sopenharmony_ci	{
428e5c31af7Sopenharmony_ci		m_testCtx.getLog() << tcu::TestLog::Message
429e5c31af7Sopenharmony_ci						   << "Reported GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT constant value " << int_value
430e5c31af7Sopenharmony_ci						   << " is smaller than required minimum value of " << m_min_MaxGeometryTotalOutputComponents
431e5c31af7Sopenharmony_ci						   << tcu::TestLog::EndMessage;
432e5c31af7Sopenharmony_ci
433e5c31af7Sopenharmony_ci		has_failed = true;
434e5c31af7Sopenharmony_ci	}
435e5c31af7Sopenharmony_ci
436e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_SHADER_INVOCATIONS, &int_value);
437e5c31af7Sopenharmony_ci
438e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT");
439e5c31af7Sopenharmony_ci
440e5c31af7Sopenharmony_ci	if (int_value < m_min_MaxGeometryShaderInvocations)
441e5c31af7Sopenharmony_ci	{
442e5c31af7Sopenharmony_ci		m_testCtx.getLog() << tcu::TestLog::Message << "Reported GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT constant value "
443e5c31af7Sopenharmony_ci						   << int_value << " is smaller than required minimum value of "
444e5c31af7Sopenharmony_ci						   << m_min_MaxGeometryShaderInvocations << tcu::TestLog::EndMessage;
445e5c31af7Sopenharmony_ci
446e5c31af7Sopenharmony_ci		has_failed = true;
447e5c31af7Sopenharmony_ci	}
448e5c31af7Sopenharmony_ci
449e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_FRAMEBUFFER_LAYERS, &int_value);
450e5c31af7Sopenharmony_ci
451e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_FRAMEBUFFER_LAYERS_EXT");
452e5c31af7Sopenharmony_ci
453e5c31af7Sopenharmony_ci	if (int_value < m_min_MaxFramebufferLayers)
454e5c31af7Sopenharmony_ci	{
455e5c31af7Sopenharmony_ci		m_testCtx.getLog() << tcu::TestLog::Message << "Reported GL_MAX_FRAMEBUFFER_LAYERS_EXT constant value "
456e5c31af7Sopenharmony_ci						   << int_value << " is smaller than required minimum value of " << m_min_MaxFramebufferLayers
457e5c31af7Sopenharmony_ci						   << tcu::TestLog::EndMessage;
458e5c31af7Sopenharmony_ci
459e5c31af7Sopenharmony_ci		has_failed = true;
460e5c31af7Sopenharmony_ci	}
461e5c31af7Sopenharmony_ci
462e5c31af7Sopenharmony_ci	/* Compute minimum value that is acceptable for gl_MaxCombinedGeometryUniformComponents */
463e5c31af7Sopenharmony_ci	glw::GLint n_max_geometry_uniform_blocks	 = 0;
464e5c31af7Sopenharmony_ci	glw::GLint n_max_geometry_uniform_block_size = 0;
465e5c31af7Sopenharmony_ci	glw::GLint n_max_geometry_uniform_components = 0;
466e5c31af7Sopenharmony_ci
467e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_UNIFORM_BLOCKS, &n_max_geometry_uniform_blocks);
468e5c31af7Sopenharmony_ci
469e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT.");
470e5c31af7Sopenharmony_ci
471e5c31af7Sopenharmony_ci	gl.getIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &n_max_geometry_uniform_block_size);
472e5c31af7Sopenharmony_ci
473e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_UNIFORM_BLOCK_SIZE.");
474e5c31af7Sopenharmony_ci
475e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_GEOMETRY_UNIFORM_COMPONENTS, &n_max_geometry_uniform_components);
476e5c31af7Sopenharmony_ci
477e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT.");
478e5c31af7Sopenharmony_ci
479e5c31af7Sopenharmony_ci	glw::GLint n_max_combined_geometry_uniform_components =
480e5c31af7Sopenharmony_ci		n_max_geometry_uniform_blocks * n_max_geometry_uniform_block_size / 4 + n_max_geometry_uniform_components;
481e5c31af7Sopenharmony_ci
482e5c31af7Sopenharmony_ci	/* Compare against actual constant value */
483e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS, &int_value);
484e5c31af7Sopenharmony_ci
485e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT.");
486e5c31af7Sopenharmony_ci
487e5c31af7Sopenharmony_ci	if (int_value < n_max_combined_geometry_uniform_components)
488e5c31af7Sopenharmony_ci	{
489e5c31af7Sopenharmony_ci		m_testCtx.getLog() << tcu::TestLog::Message
490e5c31af7Sopenharmony_ci						   << "Reported GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT constant value " << int_value
491e5c31af7Sopenharmony_ci						   << " is smaller than required minimum value of "
492e5c31af7Sopenharmony_ci						   << n_max_combined_geometry_uniform_components << tcu::TestLog::EndMessage;
493e5c31af7Sopenharmony_ci
494e5c31af7Sopenharmony_ci		has_failed = true;
495e5c31af7Sopenharmony_ci	}
496e5c31af7Sopenharmony_ci
497e5c31af7Sopenharmony_ci	/* Make sure value reported for GL_LAYER_PROVOKING_VERTEX_EXT is valid */
498e5c31af7Sopenharmony_ci	gl.getIntegerv(m_glExtTokens.LAYER_PROVOKING_VERTEX, &int_value);
499e5c31af7Sopenharmony_ci
500e5c31af7Sopenharmony_ci	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv() failed for GL_LAYER_PROVOKING_VERTEX_EXT.");
501e5c31af7Sopenharmony_ci
502e5c31af7Sopenharmony_ci	if (
503e5c31af7Sopenharmony_ci		/* This value is allowed in Desktop OpenGL, but not in the ES 3.1 extension. */
504e5c31af7Sopenharmony_ci		(!glu::isContextTypeES(m_context.getRenderContext().getType()) &&
505e5c31af7Sopenharmony_ci		 (glw::GLenum)int_value != GL_PROVOKING_VERTEX) &&
506e5c31af7Sopenharmony_ci		(glw::GLenum)int_value != m_glExtTokens.FIRST_VERTEX_CONVENTION &&
507e5c31af7Sopenharmony_ci		(glw::GLenum)int_value != m_glExtTokens.LAST_VERTEX_CONVENTION &&
508e5c31af7Sopenharmony_ci		(glw::GLenum)int_value != m_glExtTokens.UNDEFINED_VERTEX)
509e5c31af7Sopenharmony_ci	{
510e5c31af7Sopenharmony_ci		m_testCtx.getLog() << tcu::TestLog::Message << "Reported GL_LAYER_PROVOKING_VERTEX_EXT constant value "
511e5c31af7Sopenharmony_ci						   << int_value << " is not among permissible values" << tcu::TestLog::EndMessage;
512e5c31af7Sopenharmony_ci
513e5c31af7Sopenharmony_ci		has_failed = true;
514e5c31af7Sopenharmony_ci	}
515e5c31af7Sopenharmony_ci
516e5c31af7Sopenharmony_ci	if (has_failed)
517e5c31af7Sopenharmony_ci	{
518e5c31af7Sopenharmony_ci		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
519e5c31af7Sopenharmony_ci
520e5c31af7Sopenharmony_ci		return STOP;
521e5c31af7Sopenharmony_ci	}
522e5c31af7Sopenharmony_ci
523e5c31af7Sopenharmony_ci	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
524e5c31af7Sopenharmony_ci
525e5c31af7Sopenharmony_ci	return STOP;
526e5c31af7Sopenharmony_ci}
527e5c31af7Sopenharmony_ci
528e5c31af7Sopenharmony_ci/** Deinitializes GLES objects created during the test.
529e5c31af7Sopenharmony_ci *
530e5c31af7Sopenharmony_ci */
531e5c31af7Sopenharmony_civoid GeometryShaderConstantVariables::deinit(void)
532e5c31af7Sopenharmony_ci{
533e5c31af7Sopenharmony_ci	const glw::Functions& gl = m_context.getRenderContext().getFunctions();
534e5c31af7Sopenharmony_ci
535e5c31af7Sopenharmony_ci	/* Reset OpenGL ES state */
536e5c31af7Sopenharmony_ci	gl.useProgram(0);
537e5c31af7Sopenharmony_ci	gl.bindBuffer(GL_ARRAY_BUFFER, 0);
538e5c31af7Sopenharmony_ci	gl.bindVertexArray(0);
539e5c31af7Sopenharmony_ci
540e5c31af7Sopenharmony_ci	/* Delete program object and shaders */
541e5c31af7Sopenharmony_ci	if (m_program_id != 0)
542e5c31af7Sopenharmony_ci	{
543e5c31af7Sopenharmony_ci		gl.deleteProgram(m_program_id);
544e5c31af7Sopenharmony_ci
545e5c31af7Sopenharmony_ci		m_program_id = 0;
546e5c31af7Sopenharmony_ci	}
547e5c31af7Sopenharmony_ci
548e5c31af7Sopenharmony_ci	if (m_vertex_shader_id != 0)
549e5c31af7Sopenharmony_ci	{
550e5c31af7Sopenharmony_ci		gl.deleteShader(m_vertex_shader_id);
551e5c31af7Sopenharmony_ci
552e5c31af7Sopenharmony_ci		m_vertex_shader_id = 0;
553e5c31af7Sopenharmony_ci	}
554e5c31af7Sopenharmony_ci
555e5c31af7Sopenharmony_ci	if (m_geometry_shader_id != 0)
556e5c31af7Sopenharmony_ci	{
557e5c31af7Sopenharmony_ci		gl.deleteShader(m_geometry_shader_id);
558e5c31af7Sopenharmony_ci
559e5c31af7Sopenharmony_ci		m_geometry_shader_id = 0;
560e5c31af7Sopenharmony_ci	}
561e5c31af7Sopenharmony_ci
562e5c31af7Sopenharmony_ci	if (m_fragment_shader_id != 0)
563e5c31af7Sopenharmony_ci	{
564e5c31af7Sopenharmony_ci		gl.deleteShader(m_fragment_shader_id);
565e5c31af7Sopenharmony_ci
566e5c31af7Sopenharmony_ci		m_fragment_shader_id = 0;
567e5c31af7Sopenharmony_ci	}
568e5c31af7Sopenharmony_ci
569e5c31af7Sopenharmony_ci	if (m_bo_id != 0)
570e5c31af7Sopenharmony_ci	{
571e5c31af7Sopenharmony_ci		gl.deleteBuffers(1, &m_bo_id);
572e5c31af7Sopenharmony_ci
573e5c31af7Sopenharmony_ci		m_bo_id = 0;
574e5c31af7Sopenharmony_ci	}
575e5c31af7Sopenharmony_ci
576e5c31af7Sopenharmony_ci	if (m_vao_id != 0)
577e5c31af7Sopenharmony_ci	{
578e5c31af7Sopenharmony_ci		gl.deleteVertexArrays(1, &m_vao_id);
579e5c31af7Sopenharmony_ci
580e5c31af7Sopenharmony_ci		m_vao_id = 0;
581e5c31af7Sopenharmony_ci	}
582e5c31af7Sopenharmony_ci
583e5c31af7Sopenharmony_ci	/* Release base class */
584e5c31af7Sopenharmony_ci	TestCaseBase::deinit();
585e5c31af7Sopenharmony_ci}
586e5c31af7Sopenharmony_ci
587e5c31af7Sopenharmony_ci} // namespace glcts
588