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 Negative Vertex Array API tests.
22e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ci#include "es3fNegativeVertexArrayApiTests.hpp"
25e5c31af7Sopenharmony_ci#include "es3fApiCase.hpp"
26e5c31af7Sopenharmony_ci#include "gluShaderProgram.hpp"
27e5c31af7Sopenharmony_ci#include "gluContextInfo.hpp"
28e5c31af7Sopenharmony_ci#include "deString.h"
29e5c31af7Sopenharmony_ci
30e5c31af7Sopenharmony_ci#include "glwDefs.hpp"
31e5c31af7Sopenharmony_ci#include "glwEnums.hpp"
32e5c31af7Sopenharmony_ci
33e5c31af7Sopenharmony_ciusing namespace glw; // GL types
34e5c31af7Sopenharmony_ci
35e5c31af7Sopenharmony_cinamespace deqp
36e5c31af7Sopenharmony_ci{
37e5c31af7Sopenharmony_cinamespace gles3
38e5c31af7Sopenharmony_ci{
39e5c31af7Sopenharmony_cinamespace Functional
40e5c31af7Sopenharmony_ci{
41e5c31af7Sopenharmony_ci
42e5c31af7Sopenharmony_cistatic const char* vertexShaderSource		=	"#version 300 es\n"
43e5c31af7Sopenharmony_ci												"void main (void)\n"
44e5c31af7Sopenharmony_ci												"{\n"
45e5c31af7Sopenharmony_ci												"	gl_Position = vec4(0.0);\n"
46e5c31af7Sopenharmony_ci												"}\n\0";
47e5c31af7Sopenharmony_ci
48e5c31af7Sopenharmony_cistatic const char* fragmentShaderSource		=	"#version 300 es\n"
49e5c31af7Sopenharmony_ci												"layout(location = 0) out mediump vec4 fragColor;"
50e5c31af7Sopenharmony_ci												"void main (void)\n"
51e5c31af7Sopenharmony_ci												"{\n"
52e5c31af7Sopenharmony_ci												"	fragColor = vec4(0.0);\n"
53e5c31af7Sopenharmony_ci												"}\n\0";
54e5c31af7Sopenharmony_ci
55e5c31af7Sopenharmony_ciusing tcu::TestLog;
56e5c31af7Sopenharmony_ci
57e5c31af7Sopenharmony_ci// Helper class that enables tests to be executed on GL4.5 context
58e5c31af7Sopenharmony_ci// and removes code redundancy in each test that requires it.
59e5c31af7Sopenharmony_ciclass VAOHelper: protected glu::CallLogWrapper
60e5c31af7Sopenharmony_ci{
61e5c31af7Sopenharmony_cipublic:
62e5c31af7Sopenharmony_ci	VAOHelper(Context& ctx)
63e5c31af7Sopenharmony_ci		: CallLogWrapper(ctx.getRenderContext().getFunctions(), ctx.getTestContext().getLog())
64e5c31af7Sopenharmony_ci		, m_vao(0)
65e5c31af7Sopenharmony_ci	{
66e5c31af7Sopenharmony_ci		// tests need vao only for GL4.5 context
67e5c31af7Sopenharmony_ci		if (glu::isContextTypeES(ctx.getRenderContext().getType()))
68e5c31af7Sopenharmony_ci			return;
69e5c31af7Sopenharmony_ci
70e5c31af7Sopenharmony_ci		glGenVertexArrays(1, &m_vao);
71e5c31af7Sopenharmony_ci		glBindVertexArray(m_vao);
72e5c31af7Sopenharmony_ci		glVertexAttribPointer(0, 1, GL_BYTE, GL_TRUE, 0, NULL);
73e5c31af7Sopenharmony_ci		glEnableVertexAttribArray(0);
74e5c31af7Sopenharmony_ci	}
75e5c31af7Sopenharmony_ci
76e5c31af7Sopenharmony_ci	~VAOHelper()
77e5c31af7Sopenharmony_ci	{
78e5c31af7Sopenharmony_ci		if (m_vao)
79e5c31af7Sopenharmony_ci			glDeleteVertexArrays(1, &m_vao);
80e5c31af7Sopenharmony_ci	}
81e5c31af7Sopenharmony_ci
82e5c31af7Sopenharmony_ciprivate:
83e5c31af7Sopenharmony_ci	GLuint		m_vao;
84e5c31af7Sopenharmony_ci};
85e5c31af7Sopenharmony_ci
86e5c31af7Sopenharmony_ciNegativeVertexArrayApiTests::NegativeVertexArrayApiTests (Context& context)
87e5c31af7Sopenharmony_ci	: TestCaseGroup(context, "vertex_array", "Negative Vertex Array API Cases")
88e5c31af7Sopenharmony_ci{
89e5c31af7Sopenharmony_ci}
90e5c31af7Sopenharmony_ci
91e5c31af7Sopenharmony_ciNegativeVertexArrayApiTests::~NegativeVertexArrayApiTests (void)
92e5c31af7Sopenharmony_ci{
93e5c31af7Sopenharmony_ci}
94e5c31af7Sopenharmony_ci
95e5c31af7Sopenharmony_civoid NegativeVertexArrayApiTests::init (void)
96e5c31af7Sopenharmony_ci{
97e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(vertex_attribf, "Invalid glVertexAttrib{1234}f() usage",
98e5c31af7Sopenharmony_ci		{
99e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
100e5c31af7Sopenharmony_ci			int maxVertexAttribs = m_context.getContextInfo().getInt(GL_MAX_VERTEX_ATTRIBS);
101e5c31af7Sopenharmony_ci			glVertexAttrib1f(maxVertexAttribs, 0.0f);
102e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
103e5c31af7Sopenharmony_ci			glVertexAttrib2f(maxVertexAttribs, 0.0f, 0.0f);
104e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
105e5c31af7Sopenharmony_ci			glVertexAttrib3f(maxVertexAttribs, 0.0f, 0.0f, 0.0f);
106e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
107e5c31af7Sopenharmony_ci			glVertexAttrib4f(maxVertexAttribs, 0.0f, 0.0f, 0.0f, 0.0f);
108e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
109e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
110e5c31af7Sopenharmony_ci		});
111e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(vertex_attribfv, "Invalid glVertexAttrib{1234}fv() usage",
112e5c31af7Sopenharmony_ci		{
113e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
114e5c31af7Sopenharmony_ci			int maxVertexAttribs = m_context.getContextInfo().getInt(GL_MAX_VERTEX_ATTRIBS);
115e5c31af7Sopenharmony_ci			float v[4] = {0.0f};
116e5c31af7Sopenharmony_ci			glVertexAttrib1fv(maxVertexAttribs, &v[0]);
117e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
118e5c31af7Sopenharmony_ci			glVertexAttrib2fv(maxVertexAttribs, &v[0]);
119e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
120e5c31af7Sopenharmony_ci			glVertexAttrib3fv(maxVertexAttribs, &v[0]);
121e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
122e5c31af7Sopenharmony_ci			glVertexAttrib4fv(maxVertexAttribs, &v[0]);
123e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
124e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
125e5c31af7Sopenharmony_ci		});
126e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(vertex_attribi4, "Invalid glVertexAttribI4{i|ui}f() usage",
127e5c31af7Sopenharmony_ci		{
128e5c31af7Sopenharmony_ci			int maxVertexAttribs	= m_context.getContextInfo().getInt(GL_MAX_VERTEX_ATTRIBS);
129e5c31af7Sopenharmony_ci			GLint valInt			= 0;
130e5c31af7Sopenharmony_ci			GLuint valUint			= 0;
131e5c31af7Sopenharmony_ci
132e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
133e5c31af7Sopenharmony_ci			glVertexAttribI4i(maxVertexAttribs, valInt, valInt, valInt, valInt);
134e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
135e5c31af7Sopenharmony_ci			glVertexAttribI4ui(maxVertexAttribs, valUint, valUint, valUint, valUint);
136e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
137e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
138e5c31af7Sopenharmony_ci		});
139e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(vertex_attribi4v, "Invalid glVertexAttribI4{i|ui}fv() usage",
140e5c31af7Sopenharmony_ci		{
141e5c31af7Sopenharmony_ci			int maxVertexAttribs	= m_context.getContextInfo().getInt(GL_MAX_VERTEX_ATTRIBS);
142e5c31af7Sopenharmony_ci			GLint valInt[4]			= { 0 };
143e5c31af7Sopenharmony_ci			GLuint valUint[4]		= { 0 };
144e5c31af7Sopenharmony_ci
145e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
146e5c31af7Sopenharmony_ci			glVertexAttribI4iv(maxVertexAttribs, &valInt[0]);
147e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
148e5c31af7Sopenharmony_ci			glVertexAttribI4uiv(maxVertexAttribs, &valUint[0]);
149e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
150e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
151e5c31af7Sopenharmony_ci		});
152e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(vertex_attrib_pointer, "Invalid glVertexAttribPointer() usage",
153e5c31af7Sopenharmony_ci		{
154e5c31af7Sopenharmony_ci			GLuint vao = 0;
155e5c31af7Sopenharmony_ci			glGenVertexArrays(1, &vao);
156e5c31af7Sopenharmony_ci			if (glu::isContextTypeES(m_context.getRenderContext().getType()))
157e5c31af7Sopenharmony_ci				glBindVertexArray(0);
158e5c31af7Sopenharmony_ci			else
159e5c31af7Sopenharmony_ci				glBindVertexArray(vao);
160e5c31af7Sopenharmony_ci
161e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if type is not an accepted value.");
162e5c31af7Sopenharmony_ci			glVertexAttribPointer(0, 1, 0, GL_TRUE, 0, 0);
163e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
164e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
165e5c31af7Sopenharmony_ci
166e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
167e5c31af7Sopenharmony_ci			int maxVertexAttribs = m_context.getContextInfo().getInt(GL_MAX_VERTEX_ATTRIBS);
168e5c31af7Sopenharmony_ci			glVertexAttribPointer(maxVertexAttribs, 1, GL_BYTE, GL_TRUE, 0, 0);
169e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
170e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
171e5c31af7Sopenharmony_ci
172e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if size is not 1, 2, 3, or 4.");
173e5c31af7Sopenharmony_ci			glVertexAttribPointer(0, 0, GL_BYTE, GL_TRUE, 0, 0);
174e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
175e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
176e5c31af7Sopenharmony_ci
177e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if stride is negative.");
178e5c31af7Sopenharmony_ci			glVertexAttribPointer(0, 1, GL_BYTE, GL_TRUE, -1, 0);
179e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
180e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
181e5c31af7Sopenharmony_ci
182e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if type is GL_INT_2_10_10_10_REV or GL_UNSIGNED_INT_2_10_10_10_REV and size is not 4.");
183e5c31af7Sopenharmony_ci			glVertexAttribPointer(0, 2, GL_INT_2_10_10_10_REV, GL_TRUE, 0, 0);
184e5c31af7Sopenharmony_ci			expectError(GL_INVALID_OPERATION);
185e5c31af7Sopenharmony_ci			glVertexAttribPointer(0, 2, GL_UNSIGNED_INT_2_10_10_10_REV, GL_TRUE, 0, 0);
186e5c31af7Sopenharmony_ci			expectError(GL_INVALID_OPERATION);
187e5c31af7Sopenharmony_ci			glVertexAttribPointer(0, 4, GL_INT_2_10_10_10_REV, GL_TRUE, 0, 0);
188e5c31af7Sopenharmony_ci			expectError(GL_NO_ERROR);
189e5c31af7Sopenharmony_ci			glVertexAttribPointer(0, 4, GL_UNSIGNED_INT_2_10_10_10_REV, GL_TRUE, 0, 0);
190e5c31af7Sopenharmony_ci			expectError(GL_NO_ERROR);
191e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
192e5c31af7Sopenharmony_ci
193e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated a non-zero vertex array object is bound, zero is bound to the GL_ARRAY_BUFFER buffer object binding point and the pointer argument is not NULL.");
194e5c31af7Sopenharmony_ci			GLbyte offset = 1;
195e5c31af7Sopenharmony_ci			glBindVertexArray(vao);
196e5c31af7Sopenharmony_ci			glBindBuffer(GL_ARRAY_BUFFER, 0);
197e5c31af7Sopenharmony_ci			expectError(GL_NO_ERROR);
198e5c31af7Sopenharmony_ci
199e5c31af7Sopenharmony_ci			glVertexAttribPointer(0, 1, GL_BYTE, GL_TRUE, 0, &offset);
200e5c31af7Sopenharmony_ci			expectError(GL_INVALID_OPERATION);
201e5c31af7Sopenharmony_ci
202e5c31af7Sopenharmony_ci			glBindVertexArray(0);
203e5c31af7Sopenharmony_ci			glDeleteVertexArrays(1, &vao);
204e5c31af7Sopenharmony_ci			expectError(GL_NO_ERROR);
205e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
206e5c31af7Sopenharmony_ci		});
207e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(vertex_attrib_i_pointer, "Invalid glVertexAttribPointer() usage",
208e5c31af7Sopenharmony_ci		{
209e5c31af7Sopenharmony_ci			GLuint vao = 0;
210e5c31af7Sopenharmony_ci			glGenVertexArrays(1, &vao);
211e5c31af7Sopenharmony_ci			if (glu::isContextTypeES(m_context.getRenderContext().getType()))
212e5c31af7Sopenharmony_ci				glBindVertexArray(0);
213e5c31af7Sopenharmony_ci			else
214e5c31af7Sopenharmony_ci				glBindVertexArray(vao);
215e5c31af7Sopenharmony_ci
216e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if type is not an accepted value.");
217e5c31af7Sopenharmony_ci			glVertexAttribIPointer(0, 1, 0, 0, 0);
218e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
219e5c31af7Sopenharmony_ci			glVertexAttribIPointer(0, 4, GL_INT_2_10_10_10_REV, 0, 0);
220e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
221e5c31af7Sopenharmony_ci			glVertexAttribIPointer(0, 4, GL_UNSIGNED_INT_2_10_10_10_REV, 0, 0);
222e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
223e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
224e5c31af7Sopenharmony_ci
225e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
226e5c31af7Sopenharmony_ci			int maxVertexAttribs = m_context.getContextInfo().getInt(GL_MAX_VERTEX_ATTRIBS);
227e5c31af7Sopenharmony_ci			glVertexAttribIPointer(maxVertexAttribs, 1, GL_BYTE, 0, 0);
228e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
229e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
230e5c31af7Sopenharmony_ci
231e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if size is not 1, 2, 3, or 4.");
232e5c31af7Sopenharmony_ci			glVertexAttribIPointer(0, 0, GL_BYTE, 0, 0);
233e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
234e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
235e5c31af7Sopenharmony_ci
236e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if stride is negative.");
237e5c31af7Sopenharmony_ci			glVertexAttribIPointer(0, 1, GL_BYTE, -1, 0);
238e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
239e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
240e5c31af7Sopenharmony_ci
241e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated a non-zero vertex array object is bound, zero is bound to the GL_ARRAY_BUFFER buffer object binding point and the pointer argument is not NULL.");
242e5c31af7Sopenharmony_ci			GLbyte offset = 1;
243e5c31af7Sopenharmony_ci			glBindVertexArray(vao);
244e5c31af7Sopenharmony_ci			glBindBuffer(GL_ARRAY_BUFFER, 0);
245e5c31af7Sopenharmony_ci			expectError(GL_NO_ERROR);
246e5c31af7Sopenharmony_ci
247e5c31af7Sopenharmony_ci			glVertexAttribIPointer(0, 1, GL_BYTE, 0, &offset);
248e5c31af7Sopenharmony_ci			expectError(GL_INVALID_OPERATION);
249e5c31af7Sopenharmony_ci
250e5c31af7Sopenharmony_ci			glBindVertexArray(0);
251e5c31af7Sopenharmony_ci			glDeleteVertexArrays(1, &vao);
252e5c31af7Sopenharmony_ci			expectError(GL_NO_ERROR);
253e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
254e5c31af7Sopenharmony_ci		});
255e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(enable_vertex_attrib_array, "Invalid glEnableVertexAttribArray() usage",
256e5c31af7Sopenharmony_ci		{
257e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
258e5c31af7Sopenharmony_ci			int maxVertexAttribs = m_context.getContextInfo().getInt(GL_MAX_VERTEX_ATTRIBS);
259e5c31af7Sopenharmony_ci			glEnableVertexAttribArray(maxVertexAttribs);
260e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
261e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
262e5c31af7Sopenharmony_ci		});
263e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(disable_vertex_attrib_array, "Invalid glDisableVertexAttribArray() usage",
264e5c31af7Sopenharmony_ci		{
265e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
266e5c31af7Sopenharmony_ci			int maxVertexAttribs = m_context.getContextInfo().getInt(GL_MAX_VERTEX_ATTRIBS);
267e5c31af7Sopenharmony_ci			glDisableVertexAttribArray(maxVertexAttribs);
268e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
269e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
270e5c31af7Sopenharmony_ci		});
271e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(gen_vertex_arrays, "Invalid glGenVertexArrays() usage",
272e5c31af7Sopenharmony_ci		{
273e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if n is negative.");
274e5c31af7Sopenharmony_ci			GLuint arrays;
275e5c31af7Sopenharmony_ci			glGenVertexArrays(-1, &arrays);
276e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
277e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
278e5c31af7Sopenharmony_ci		});
279e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(bind_vertex_array, "Invalid glBindVertexArray() usage",
280e5c31af7Sopenharmony_ci		{
281e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if array is not zero or the name of an existing vertex array object.");
282e5c31af7Sopenharmony_ci			glBindVertexArray(-1);
283e5c31af7Sopenharmony_ci			expectError(GL_INVALID_OPERATION);
284e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
285e5c31af7Sopenharmony_ci		});
286e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(delete_vertex_arrays, "Invalid glDeleteVertexArrays() usage",
287e5c31af7Sopenharmony_ci		{
288e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if n is negative.");
289e5c31af7Sopenharmony_ci			glDeleteVertexArrays(-1, 0);
290e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
291e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
292e5c31af7Sopenharmony_ci		});
293e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(vertex_attrib_divisor, "Invalid glVertexAttribDivisor() usage",
294e5c31af7Sopenharmony_ci		{
295e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
296e5c31af7Sopenharmony_ci			int maxVertexAttribs = m_context.getContextInfo().getInt(GL_MAX_VERTEX_ATTRIBS);
297e5c31af7Sopenharmony_ci			glVertexAttribDivisor(maxVertexAttribs, 0);
298e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
299e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
300e5c31af7Sopenharmony_ci		});
301e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(draw_arrays, "Invalid glDrawArrays() usage",
302e5c31af7Sopenharmony_ci		{
303e5c31af7Sopenharmony_ci			glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
304e5c31af7Sopenharmony_ci			glUseProgram(program.getProgram());
305e5c31af7Sopenharmony_ci			GLuint fbo;
306e5c31af7Sopenharmony_ci			VAOHelper vao(m_context);
307e5c31af7Sopenharmony_ci
308e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
309e5c31af7Sopenharmony_ci			glDrawArrays(-1, 0, 1);
310e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
311e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
312e5c31af7Sopenharmony_ci
313e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if count is negative.");
314e5c31af7Sopenharmony_ci			glDrawArrays(GL_POINTS, 0, -1);
315e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
316e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
317e5c31af7Sopenharmony_ci
318e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
319e5c31af7Sopenharmony_ci			glGenFramebuffers(1, &fbo);
320e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, fbo);
321e5c31af7Sopenharmony_ci			glCheckFramebufferStatus(GL_FRAMEBUFFER);
322e5c31af7Sopenharmony_ci			glDrawArrays(GL_POINTS, 0, 1);
323e5c31af7Sopenharmony_ci			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
324e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, 0);
325e5c31af7Sopenharmony_ci			glDeleteFramebuffers(1, &fbo);
326e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
327e5c31af7Sopenharmony_ci
328e5c31af7Sopenharmony_ci			glUseProgram(0);
329e5c31af7Sopenharmony_ci		});
330e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(draw_arrays_invalid_program, "Invalid glDrawArrays() usage",
331e5c31af7Sopenharmony_ci		{
332e5c31af7Sopenharmony_ci			glUseProgram(0);
333e5c31af7Sopenharmony_ci			GLuint fbo;
334e5c31af7Sopenharmony_ci			VAOHelper vao(m_context);
335e5c31af7Sopenharmony_ci
336e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
337e5c31af7Sopenharmony_ci			glDrawArrays(-1, 0, 1);
338e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
339e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
340e5c31af7Sopenharmony_ci
341e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if count is negative.");
342e5c31af7Sopenharmony_ci			glDrawArrays(GL_POINTS, 0, -1);
343e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
344e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
345e5c31af7Sopenharmony_ci
346e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
347e5c31af7Sopenharmony_ci			glGenFramebuffers(1, &fbo);
348e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, fbo);
349e5c31af7Sopenharmony_ci			glCheckFramebufferStatus(GL_FRAMEBUFFER);
350e5c31af7Sopenharmony_ci			glDrawArrays(GL_POINTS, 0, 1);
351e5c31af7Sopenharmony_ci			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
352e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, 0);
353e5c31af7Sopenharmony_ci			glDeleteFramebuffers(1, &fbo);
354e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
355e5c31af7Sopenharmony_ci		});
356e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(draw_arrays_incomplete_primitive, "Invalid glDrawArrays() usage",
357e5c31af7Sopenharmony_ci		{
358e5c31af7Sopenharmony_ci			glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
359e5c31af7Sopenharmony_ci			glUseProgram(program.getProgram());
360e5c31af7Sopenharmony_ci			GLuint fbo;
361e5c31af7Sopenharmony_ci			VAOHelper vao(m_context);
362e5c31af7Sopenharmony_ci
363e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
364e5c31af7Sopenharmony_ci			glDrawArrays(-1, 0, 1);
365e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
366e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
367e5c31af7Sopenharmony_ci
368e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if count is negative.");
369e5c31af7Sopenharmony_ci			glDrawArrays(GL_TRIANGLES, 0, -1);
370e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
371e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
372e5c31af7Sopenharmony_ci
373e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
374e5c31af7Sopenharmony_ci			glGenFramebuffers(1, &fbo);
375e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, fbo);
376e5c31af7Sopenharmony_ci			glCheckFramebufferStatus(GL_FRAMEBUFFER);
377e5c31af7Sopenharmony_ci			glDrawArrays(GL_TRIANGLES, 0, 1);
378e5c31af7Sopenharmony_ci			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
379e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, 0);
380e5c31af7Sopenharmony_ci			glDeleteFramebuffers(1, &fbo);
381e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
382e5c31af7Sopenharmony_ci
383e5c31af7Sopenharmony_ci			glUseProgram(0);
384e5c31af7Sopenharmony_ci		});
385e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(draw_elements, "Invalid glDrawElements() usage",
386e5c31af7Sopenharmony_ci		{
387e5c31af7Sopenharmony_ci			const bool isES	= glu::isContextTypeES(m_context.getRenderContext().getType());
388e5c31af7Sopenharmony_ci			glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
389e5c31af7Sopenharmony_ci			glUseProgram(program.getProgram());
390e5c31af7Sopenharmony_ci			GLuint fbo;
391e5c31af7Sopenharmony_ci			GLuint buf;
392e5c31af7Sopenharmony_ci			GLuint tfID;
393e5c31af7Sopenharmony_ci			GLfloat vertices[1] = { 0 };
394e5c31af7Sopenharmony_ci			VAOHelper vao(m_context);
395e5c31af7Sopenharmony_ci
396e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
397e5c31af7Sopenharmony_ci			glDrawElements(-1, 1, GL_UNSIGNED_BYTE, vertices);
398e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
399e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
400e5c31af7Sopenharmony_ci
401e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if type is not one of the accepted values.");
402e5c31af7Sopenharmony_ci			glDrawElements(GL_POINTS, 1, -1, vertices);
403e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
404e5c31af7Sopenharmony_ci			glDrawElements(GL_POINTS, 1, GL_FLOAT, vertices);
405e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
406e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
407e5c31af7Sopenharmony_ci
408e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if count is negative.");
409e5c31af7Sopenharmony_ci			glDrawElements(GL_POINTS, -1, GL_UNSIGNED_BYTE, vertices);
410e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
411e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
412e5c31af7Sopenharmony_ci
413e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
414e5c31af7Sopenharmony_ci			glGenFramebuffers(1, &fbo);
415e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, fbo);
416e5c31af7Sopenharmony_ci			glCheckFramebufferStatus(GL_FRAMEBUFFER);
417e5c31af7Sopenharmony_ci			glDrawElements(GL_POINTS, 1, GL_UNSIGNED_BYTE, vertices);
418e5c31af7Sopenharmony_ci			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
419e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, 0);
420e5c31af7Sopenharmony_ci			glDeleteFramebuffers(1, &fbo);
421e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
422e5c31af7Sopenharmony_ci
423e5c31af7Sopenharmony_ci			if (isES && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error
424e5c31af7Sopenharmony_ci			{
425e5c31af7Sopenharmony_ci				m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if transform feedback is active and not paused.");
426e5c31af7Sopenharmony_ci				const char* tfVarying		= "gl_Position";
427e5c31af7Sopenharmony_ci
428e5c31af7Sopenharmony_ci				glGenBuffers				(1, &buf);
429e5c31af7Sopenharmony_ci				glGenTransformFeedbacks		(1, &tfID);
430e5c31af7Sopenharmony_ci
431e5c31af7Sopenharmony_ci				glUseProgram				(program.getProgram());
432e5c31af7Sopenharmony_ci				glTransformFeedbackVaryings	(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
433e5c31af7Sopenharmony_ci				glLinkProgram				(program.getProgram());
434e5c31af7Sopenharmony_ci				glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID);
435e5c31af7Sopenharmony_ci				glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
436e5c31af7Sopenharmony_ci				glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
437e5c31af7Sopenharmony_ci				glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
438e5c31af7Sopenharmony_ci				glBeginTransformFeedback	(GL_POINTS);
439e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
440e5c31af7Sopenharmony_ci
441e5c31af7Sopenharmony_ci				glDrawElements				(GL_POINTS, 1, GL_UNSIGNED_BYTE, vertices);
442e5c31af7Sopenharmony_ci				expectError					(GL_INVALID_OPERATION);
443e5c31af7Sopenharmony_ci
444e5c31af7Sopenharmony_ci				glPauseTransformFeedback();
445e5c31af7Sopenharmony_ci				glDrawElements				(GL_POINTS, 1, GL_UNSIGNED_BYTE, vertices);
446e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
447e5c31af7Sopenharmony_ci
448e5c31af7Sopenharmony_ci				glEndTransformFeedback		();
449e5c31af7Sopenharmony_ci				glDeleteBuffers				(1, &buf);
450e5c31af7Sopenharmony_ci				glDeleteTransformFeedbacks	(1, &tfID);
451e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
452e5c31af7Sopenharmony_ci				m_log << tcu::TestLog::EndSection;
453e5c31af7Sopenharmony_ci			}
454e5c31af7Sopenharmony_ci
455e5c31af7Sopenharmony_ci			glUseProgram(0);
456e5c31af7Sopenharmony_ci		});
457e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(draw_elements_invalid_program, "Invalid glDrawElements() usage",
458e5c31af7Sopenharmony_ci		{
459e5c31af7Sopenharmony_ci			glUseProgram(0);
460e5c31af7Sopenharmony_ci			GLuint fbo;
461e5c31af7Sopenharmony_ci			GLfloat vertices[1] = { 0 };
462e5c31af7Sopenharmony_ci			VAOHelper vao(m_context);
463e5c31af7Sopenharmony_ci
464e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
465e5c31af7Sopenharmony_ci			glDrawElements(-1, 1, GL_UNSIGNED_BYTE, vertices);
466e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
467e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
468e5c31af7Sopenharmony_ci
469e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if type is not one of the accepted values.");
470e5c31af7Sopenharmony_ci			glDrawElements(GL_POINTS, 1, -1, vertices);
471e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
472e5c31af7Sopenharmony_ci			glDrawElements(GL_POINTS, 1, GL_FLOAT, vertices);
473e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
474e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
475e5c31af7Sopenharmony_ci
476e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if count is negative.");
477e5c31af7Sopenharmony_ci			glDrawElements(GL_POINTS, -1, GL_UNSIGNED_BYTE, vertices);
478e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
479e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
480e5c31af7Sopenharmony_ci
481e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
482e5c31af7Sopenharmony_ci			glGenFramebuffers(1, &fbo);
483e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, fbo);
484e5c31af7Sopenharmony_ci			glCheckFramebufferStatus(GL_FRAMEBUFFER);
485e5c31af7Sopenharmony_ci			glDrawElements(GL_POINTS, 1, GL_UNSIGNED_BYTE, vertices);
486e5c31af7Sopenharmony_ci			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
487e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, 0);
488e5c31af7Sopenharmony_ci			glDeleteFramebuffers(1, &fbo);
489e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
490e5c31af7Sopenharmony_ci		});
491e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(draw_elements_incomplete_primitive, "Invalid glDrawElements() usage",
492e5c31af7Sopenharmony_ci		{
493e5c31af7Sopenharmony_ci			const bool isES	= glu::isContextTypeES(m_context.getRenderContext().getType());
494e5c31af7Sopenharmony_ci			glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
495e5c31af7Sopenharmony_ci			glUseProgram(program.getProgram());
496e5c31af7Sopenharmony_ci			GLuint fbo;
497e5c31af7Sopenharmony_ci			GLuint buf;
498e5c31af7Sopenharmony_ci			GLuint tfID;
499e5c31af7Sopenharmony_ci			GLfloat vertices[1] = { 0 };
500e5c31af7Sopenharmony_ci			VAOHelper vao(m_context);
501e5c31af7Sopenharmony_ci
502e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
503e5c31af7Sopenharmony_ci			glDrawElements(-1, 1, GL_UNSIGNED_BYTE, vertices);
504e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
505e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
506e5c31af7Sopenharmony_ci
507e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if type is not one of the accepted values.");
508e5c31af7Sopenharmony_ci			glDrawElements(GL_TRIANGLES, 1, -1, vertices);
509e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
510e5c31af7Sopenharmony_ci			glDrawElements(GL_TRIANGLES, 1, GL_FLOAT, vertices);
511e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
512e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
513e5c31af7Sopenharmony_ci
514e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if count is negative.");
515e5c31af7Sopenharmony_ci			glDrawElements(GL_TRIANGLES, -1, GL_UNSIGNED_BYTE, vertices);
516e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
517e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
518e5c31af7Sopenharmony_ci
519e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
520e5c31af7Sopenharmony_ci			glGenFramebuffers(1, &fbo);
521e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, fbo);
522e5c31af7Sopenharmony_ci			glCheckFramebufferStatus(GL_FRAMEBUFFER);
523e5c31af7Sopenharmony_ci			glDrawElements(GL_TRIANGLES, 1, GL_UNSIGNED_BYTE, vertices);
524e5c31af7Sopenharmony_ci			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
525e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, 0);
526e5c31af7Sopenharmony_ci			glDeleteFramebuffers(1, &fbo);
527e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
528e5c31af7Sopenharmony_ci
529e5c31af7Sopenharmony_ci			if (isES && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error
530e5c31af7Sopenharmony_ci			{
531e5c31af7Sopenharmony_ci				m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if transform feedback is active and not paused.");
532e5c31af7Sopenharmony_ci				const char* tfVarying		= "gl_Position";
533e5c31af7Sopenharmony_ci
534e5c31af7Sopenharmony_ci				glGenBuffers				(1, &buf);
535e5c31af7Sopenharmony_ci				glGenTransformFeedbacks		(1, &tfID);
536e5c31af7Sopenharmony_ci
537e5c31af7Sopenharmony_ci				glUseProgram				(program.getProgram());
538e5c31af7Sopenharmony_ci				glTransformFeedbackVaryings	(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
539e5c31af7Sopenharmony_ci				glLinkProgram				(program.getProgram());
540e5c31af7Sopenharmony_ci				glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID);
541e5c31af7Sopenharmony_ci				glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
542e5c31af7Sopenharmony_ci				glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
543e5c31af7Sopenharmony_ci				glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
544e5c31af7Sopenharmony_ci				glBeginTransformFeedback	(GL_TRIANGLES);
545e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
546e5c31af7Sopenharmony_ci
547e5c31af7Sopenharmony_ci				glDrawElements				(GL_TRIANGLES, 1, GL_UNSIGNED_BYTE, vertices);
548e5c31af7Sopenharmony_ci				expectError					(GL_INVALID_OPERATION);
549e5c31af7Sopenharmony_ci
550e5c31af7Sopenharmony_ci				glPauseTransformFeedback();
551e5c31af7Sopenharmony_ci				glDrawElements				(GL_TRIANGLES, 1, GL_UNSIGNED_BYTE, vertices);
552e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
553e5c31af7Sopenharmony_ci
554e5c31af7Sopenharmony_ci				glEndTransformFeedback		();
555e5c31af7Sopenharmony_ci				glDeleteBuffers				(1, &buf);
556e5c31af7Sopenharmony_ci				glDeleteTransformFeedbacks	(1, &tfID);
557e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
558e5c31af7Sopenharmony_ci				m_log << tcu::TestLog::EndSection;
559e5c31af7Sopenharmony_ci			}
560e5c31af7Sopenharmony_ci
561e5c31af7Sopenharmony_ci			glUseProgram(0);
562e5c31af7Sopenharmony_ci		});
563e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(draw_arrays_instanced, "Invalid glDrawArraysInstanced() usage",
564e5c31af7Sopenharmony_ci		{
565e5c31af7Sopenharmony_ci			glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
566e5c31af7Sopenharmony_ci			glUseProgram(program.getProgram());
567e5c31af7Sopenharmony_ci			GLuint fbo;
568e5c31af7Sopenharmony_ci			VAOHelper vao(m_context);
569e5c31af7Sopenharmony_ci			glVertexAttribDivisor(0, 1);
570e5c31af7Sopenharmony_ci			expectError(GL_NO_ERROR);
571e5c31af7Sopenharmony_ci
572e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
573e5c31af7Sopenharmony_ci			glDrawArraysInstanced(-1, 0, 1, 1);
574e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
575e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
576e5c31af7Sopenharmony_ci
577e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if count or primcount are negative.");
578e5c31af7Sopenharmony_ci			glDrawArraysInstanced(GL_POINTS, 0, -1, 1);
579e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
580e5c31af7Sopenharmony_ci			glDrawArraysInstanced(GL_POINTS, 0, 1, -1);
581e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
582e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
583e5c31af7Sopenharmony_ci
584e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
585e5c31af7Sopenharmony_ci			glGenFramebuffers(1, &fbo);
586e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, fbo);
587e5c31af7Sopenharmony_ci			glCheckFramebufferStatus(GL_FRAMEBUFFER);
588e5c31af7Sopenharmony_ci			glDrawArraysInstanced(GL_POINTS, 0, 1, 1);
589e5c31af7Sopenharmony_ci			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
590e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, 0);
591e5c31af7Sopenharmony_ci			glDeleteFramebuffers(1, &fbo);
592e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
593e5c31af7Sopenharmony_ci
594e5c31af7Sopenharmony_ci			glUseProgram(0);
595e5c31af7Sopenharmony_ci		});
596e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(draw_arrays_instanced_invalid_program, "Invalid glDrawArraysInstanced() usage",
597e5c31af7Sopenharmony_ci		{
598e5c31af7Sopenharmony_ci			glUseProgram(0);
599e5c31af7Sopenharmony_ci			GLuint fbo;
600e5c31af7Sopenharmony_ci			VAOHelper vao(m_context);
601e5c31af7Sopenharmony_ci			glVertexAttribDivisor(0, 1);
602e5c31af7Sopenharmony_ci			expectError(GL_NO_ERROR);
603e5c31af7Sopenharmony_ci
604e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
605e5c31af7Sopenharmony_ci			glDrawArraysInstanced(-1, 0, 1, 1);
606e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
607e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
608e5c31af7Sopenharmony_ci
609e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if count or primcount are negative.");
610e5c31af7Sopenharmony_ci			glDrawArraysInstanced(GL_POINTS, 0, -1, 1);
611e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
612e5c31af7Sopenharmony_ci			glDrawArraysInstanced(GL_POINTS, 0, 1, -1);
613e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
614e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
615e5c31af7Sopenharmony_ci
616e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
617e5c31af7Sopenharmony_ci			glGenFramebuffers(1, &fbo);
618e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, fbo);
619e5c31af7Sopenharmony_ci			glCheckFramebufferStatus(GL_FRAMEBUFFER);
620e5c31af7Sopenharmony_ci			glDrawArraysInstanced(GL_POINTS, 0, 1, 1);
621e5c31af7Sopenharmony_ci			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
622e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, 0);
623e5c31af7Sopenharmony_ci			glDeleteFramebuffers(1, &fbo);
624e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
625e5c31af7Sopenharmony_ci		});
626e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(draw_arrays_instanced_incomplete_primitive, "Invalid glDrawArraysInstanced() usage",
627e5c31af7Sopenharmony_ci		{
628e5c31af7Sopenharmony_ci			glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
629e5c31af7Sopenharmony_ci			glUseProgram(program.getProgram());
630e5c31af7Sopenharmony_ci			GLuint fbo;
631e5c31af7Sopenharmony_ci			VAOHelper vao(m_context);
632e5c31af7Sopenharmony_ci			glVertexAttribDivisor(0, 1);
633e5c31af7Sopenharmony_ci			expectError(GL_NO_ERROR);
634e5c31af7Sopenharmony_ci
635e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
636e5c31af7Sopenharmony_ci			glDrawArraysInstanced(-1, 0, 1, 1);
637e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
638e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
639e5c31af7Sopenharmony_ci
640e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if count or primcount are negative.");
641e5c31af7Sopenharmony_ci			glDrawArraysInstanced(GL_TRIANGLES, 0, -1, 1);
642e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
643e5c31af7Sopenharmony_ci			glDrawArraysInstanced(GL_TRIANGLES, 0, 1, -1);
644e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
645e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
646e5c31af7Sopenharmony_ci
647e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
648e5c31af7Sopenharmony_ci			glGenFramebuffers(1, &fbo);
649e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, fbo);
650e5c31af7Sopenharmony_ci			glCheckFramebufferStatus(GL_FRAMEBUFFER);
651e5c31af7Sopenharmony_ci			glDrawArraysInstanced(GL_TRIANGLES, 0, 1, 1);
652e5c31af7Sopenharmony_ci			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
653e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, 0);
654e5c31af7Sopenharmony_ci			glDeleteFramebuffers(1, &fbo);
655e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
656e5c31af7Sopenharmony_ci
657e5c31af7Sopenharmony_ci			glUseProgram(0);
658e5c31af7Sopenharmony_ci		});
659e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(draw_elements_instanced, "Invalid glDrawElementsInstanced() usage",
660e5c31af7Sopenharmony_ci		{
661e5c31af7Sopenharmony_ci			const bool isES	= glu::isContextTypeES(m_context.getRenderContext().getType());
662e5c31af7Sopenharmony_ci			glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
663e5c31af7Sopenharmony_ci			glUseProgram(program.getProgram());
664e5c31af7Sopenharmony_ci			GLuint fbo;
665e5c31af7Sopenharmony_ci			GLuint buf;
666e5c31af7Sopenharmony_ci			GLuint tfID;
667e5c31af7Sopenharmony_ci			GLfloat vertices[1] = { 0 };
668e5c31af7Sopenharmony_ci			VAOHelper vao(m_context);
669e5c31af7Sopenharmony_ci
670e5c31af7Sopenharmony_ci			glVertexAttribDivisor(0, 1);
671e5c31af7Sopenharmony_ci			expectError(GL_NO_ERROR);
672e5c31af7Sopenharmony_ci
673e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
674e5c31af7Sopenharmony_ci			glDrawElementsInstanced(-1, 1, GL_UNSIGNED_BYTE, vertices, 1);
675e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
676e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
677e5c31af7Sopenharmony_ci
678e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if type is not one of the accepted values.");
679e5c31af7Sopenharmony_ci			glDrawElementsInstanced(GL_POINTS, 1, -1, vertices, 1);
680e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
681e5c31af7Sopenharmony_ci			glDrawElementsInstanced(GL_POINTS, 1, GL_FLOAT, vertices, 1);
682e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
683e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
684e5c31af7Sopenharmony_ci
685e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if count or primcount are negative.");
686e5c31af7Sopenharmony_ci			glDrawElementsInstanced(GL_POINTS, -1, GL_UNSIGNED_BYTE, vertices, 1);
687e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
688e5c31af7Sopenharmony_ci			glDrawElementsInstanced(GL_POINTS, 11, GL_UNSIGNED_BYTE, vertices, -1);
689e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
690e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
691e5c31af7Sopenharmony_ci
692e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
693e5c31af7Sopenharmony_ci			glGenFramebuffers(1, &fbo);
694e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, fbo);
695e5c31af7Sopenharmony_ci			glCheckFramebufferStatus(GL_FRAMEBUFFER);
696e5c31af7Sopenharmony_ci			glDrawElementsInstanced(GL_POINTS, 1, GL_UNSIGNED_BYTE, vertices, 1);
697e5c31af7Sopenharmony_ci			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
698e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, 0);
699e5c31af7Sopenharmony_ci			glDeleteFramebuffers(1, &fbo);
700e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
701e5c31af7Sopenharmony_ci
702e5c31af7Sopenharmony_ci			if (isES && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error
703e5c31af7Sopenharmony_ci			{
704e5c31af7Sopenharmony_ci				m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if transform feedback is active and not paused.");
705e5c31af7Sopenharmony_ci				const char* tfVarying		= "gl_Position";
706e5c31af7Sopenharmony_ci
707e5c31af7Sopenharmony_ci				glGenBuffers				(1, &buf);
708e5c31af7Sopenharmony_ci				glGenTransformFeedbacks		(1, &tfID);
709e5c31af7Sopenharmony_ci
710e5c31af7Sopenharmony_ci				glUseProgram				(program.getProgram());
711e5c31af7Sopenharmony_ci				glTransformFeedbackVaryings	(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
712e5c31af7Sopenharmony_ci				glLinkProgram				(program.getProgram());
713e5c31af7Sopenharmony_ci				glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID);
714e5c31af7Sopenharmony_ci				glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
715e5c31af7Sopenharmony_ci				glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
716e5c31af7Sopenharmony_ci				glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
717e5c31af7Sopenharmony_ci				glBeginTransformFeedback	(GL_POINTS);
718e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
719e5c31af7Sopenharmony_ci
720e5c31af7Sopenharmony_ci				glDrawElementsInstanced		(GL_POINTS, 1, GL_UNSIGNED_BYTE, vertices, 1);
721e5c31af7Sopenharmony_ci				expectError					(GL_INVALID_OPERATION);
722e5c31af7Sopenharmony_ci
723e5c31af7Sopenharmony_ci				glPauseTransformFeedback();
724e5c31af7Sopenharmony_ci				glDrawElementsInstanced		(GL_POINTS, 1, GL_UNSIGNED_BYTE, vertices, 1);
725e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
726e5c31af7Sopenharmony_ci
727e5c31af7Sopenharmony_ci				glEndTransformFeedback		();
728e5c31af7Sopenharmony_ci				glDeleteBuffers				(1, &buf);
729e5c31af7Sopenharmony_ci				glDeleteTransformFeedbacks	(1, &tfID);
730e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
731e5c31af7Sopenharmony_ci				m_log << tcu::TestLog::EndSection;
732e5c31af7Sopenharmony_ci			}
733e5c31af7Sopenharmony_ci
734e5c31af7Sopenharmony_ci			glUseProgram(0);
735e5c31af7Sopenharmony_ci		});
736e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(draw_elements_instanced_invalid_program, "Invalid glDrawElementsInstanced() usage",
737e5c31af7Sopenharmony_ci		{
738e5c31af7Sopenharmony_ci			glUseProgram(0);
739e5c31af7Sopenharmony_ci			GLuint fbo;
740e5c31af7Sopenharmony_ci			GLfloat vertices[1] = { 0 };
741e5c31af7Sopenharmony_ci			VAOHelper vao(m_context);
742e5c31af7Sopenharmony_ci			glVertexAttribDivisor(0, 1);
743e5c31af7Sopenharmony_ci			expectError(GL_NO_ERROR);
744e5c31af7Sopenharmony_ci
745e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
746e5c31af7Sopenharmony_ci			glDrawElementsInstanced(-1, 1, GL_UNSIGNED_BYTE, vertices, 1);
747e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
748e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
749e5c31af7Sopenharmony_ci
750e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if type is not one of the accepted values.");
751e5c31af7Sopenharmony_ci			glDrawElementsInstanced(GL_POINTS, 1, -1, vertices, 1);
752e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
753e5c31af7Sopenharmony_ci			glDrawElementsInstanced(GL_POINTS, 1, GL_FLOAT, vertices, 1);
754e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
755e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
756e5c31af7Sopenharmony_ci
757e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if count or primcount are negative.");
758e5c31af7Sopenharmony_ci			glDrawElementsInstanced(GL_POINTS, -1, GL_UNSIGNED_BYTE, vertices, 1);
759e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
760e5c31af7Sopenharmony_ci			glDrawElementsInstanced(GL_POINTS, 11, GL_UNSIGNED_BYTE, vertices, -1);
761e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
762e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
763e5c31af7Sopenharmony_ci
764e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
765e5c31af7Sopenharmony_ci			glGenFramebuffers(1, &fbo);
766e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, fbo);
767e5c31af7Sopenharmony_ci			glCheckFramebufferStatus(GL_FRAMEBUFFER);
768e5c31af7Sopenharmony_ci			glDrawElementsInstanced(GL_POINTS, 1, GL_UNSIGNED_BYTE, vertices, 1);
769e5c31af7Sopenharmony_ci			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
770e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, 0);
771e5c31af7Sopenharmony_ci			glDeleteFramebuffers(1, &fbo);
772e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
773e5c31af7Sopenharmony_ci		});
774e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(draw_elements_instanced_incomplete_primitive, "Invalid glDrawElementsInstanced() usage",
775e5c31af7Sopenharmony_ci		{
776e5c31af7Sopenharmony_ci			const bool isES	= glu::isContextTypeES(m_context.getRenderContext().getType());
777e5c31af7Sopenharmony_ci			glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
778e5c31af7Sopenharmony_ci			glUseProgram(program.getProgram());
779e5c31af7Sopenharmony_ci			GLuint fbo;
780e5c31af7Sopenharmony_ci			GLuint buf;
781e5c31af7Sopenharmony_ci			GLuint tfID;
782e5c31af7Sopenharmony_ci			GLfloat vertices[1] = { 0 };
783e5c31af7Sopenharmony_ci			VAOHelper vao(m_context);
784e5c31af7Sopenharmony_ci			glVertexAttribDivisor(0, 1);
785e5c31af7Sopenharmony_ci			expectError(GL_NO_ERROR);
786e5c31af7Sopenharmony_ci
787e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
788e5c31af7Sopenharmony_ci			glDrawElementsInstanced(-1, 1, GL_UNSIGNED_BYTE, vertices, 1);
789e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
790e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
791e5c31af7Sopenharmony_ci
792e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if type is not one of the accepted values.");
793e5c31af7Sopenharmony_ci			glDrawElementsInstanced(GL_TRIANGLES, 1, -1, vertices, 1);
794e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
795e5c31af7Sopenharmony_ci			glDrawElementsInstanced(GL_TRIANGLES, 1, GL_FLOAT, vertices, 1);
796e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
797e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
798e5c31af7Sopenharmony_ci
799e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if count or primcount are negative.");
800e5c31af7Sopenharmony_ci			glDrawElementsInstanced(GL_TRIANGLES, -1, GL_UNSIGNED_BYTE, vertices, 1);
801e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
802e5c31af7Sopenharmony_ci			glDrawElementsInstanced(GL_TRIANGLES, 11, GL_UNSIGNED_BYTE, vertices, -1);
803e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
804e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
805e5c31af7Sopenharmony_ci
806e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
807e5c31af7Sopenharmony_ci			glGenFramebuffers(1, &fbo);
808e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, fbo);
809e5c31af7Sopenharmony_ci			glCheckFramebufferStatus(GL_FRAMEBUFFER);
810e5c31af7Sopenharmony_ci			glDrawElementsInstanced(GL_TRIANGLES, 1, GL_UNSIGNED_BYTE, vertices, 1);
811e5c31af7Sopenharmony_ci			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
812e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, 0);
813e5c31af7Sopenharmony_ci			glDeleteFramebuffers(1, &fbo);
814e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
815e5c31af7Sopenharmony_ci
816e5c31af7Sopenharmony_ci			if (isES && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error
817e5c31af7Sopenharmony_ci			{
818e5c31af7Sopenharmony_ci				m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if transform feedback is active and not paused.");
819e5c31af7Sopenharmony_ci				const char* tfVarying		= "gl_Position";
820e5c31af7Sopenharmony_ci
821e5c31af7Sopenharmony_ci				glGenBuffers				(1, &buf);
822e5c31af7Sopenharmony_ci				glGenTransformFeedbacks		(1, &tfID);
823e5c31af7Sopenharmony_ci
824e5c31af7Sopenharmony_ci				glUseProgram				(program.getProgram());
825e5c31af7Sopenharmony_ci				glTransformFeedbackVaryings	(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
826e5c31af7Sopenharmony_ci				glLinkProgram				(program.getProgram());
827e5c31af7Sopenharmony_ci				glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID);
828e5c31af7Sopenharmony_ci				glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
829e5c31af7Sopenharmony_ci				glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
830e5c31af7Sopenharmony_ci				glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
831e5c31af7Sopenharmony_ci				glBeginTransformFeedback	(GL_TRIANGLES);
832e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
833e5c31af7Sopenharmony_ci
834e5c31af7Sopenharmony_ci				glDrawElementsInstanced		(GL_TRIANGLES, 1, GL_UNSIGNED_BYTE, vertices, 1);
835e5c31af7Sopenharmony_ci				expectError					(GL_INVALID_OPERATION);
836e5c31af7Sopenharmony_ci
837e5c31af7Sopenharmony_ci				glPauseTransformFeedback();
838e5c31af7Sopenharmony_ci				glDrawElementsInstanced		(GL_TRIANGLES, 1, GL_UNSIGNED_BYTE, vertices, 1);
839e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
840e5c31af7Sopenharmony_ci
841e5c31af7Sopenharmony_ci				glEndTransformFeedback		();
842e5c31af7Sopenharmony_ci				glDeleteBuffers				(1, &buf);
843e5c31af7Sopenharmony_ci				glDeleteTransformFeedbacks	(1, &tfID);
844e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
845e5c31af7Sopenharmony_ci				m_log << tcu::TestLog::EndSection;
846e5c31af7Sopenharmony_ci			}
847e5c31af7Sopenharmony_ci
848e5c31af7Sopenharmony_ci			glUseProgram(0);
849e5c31af7Sopenharmony_ci		});
850e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(draw_range_elements, "Invalid glDrawRangeElements() usage",
851e5c31af7Sopenharmony_ci		{
852e5c31af7Sopenharmony_ci			const bool isES	= glu::isContextTypeES(m_context.getRenderContext().getType());
853e5c31af7Sopenharmony_ci			glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
854e5c31af7Sopenharmony_ci			glUseProgram(program.getProgram());
855e5c31af7Sopenharmony_ci			GLuint fbo;
856e5c31af7Sopenharmony_ci			GLuint buf;
857e5c31af7Sopenharmony_ci			GLuint tfID;
858e5c31af7Sopenharmony_ci			deUint32 vertices[1];
859e5c31af7Sopenharmony_ci			vertices[0] = 0xffffffffu;
860e5c31af7Sopenharmony_ci			VAOHelper vao(m_context);
861e5c31af7Sopenharmony_ci
862e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
863e5c31af7Sopenharmony_ci			glDrawRangeElements(-1, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
864e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
865e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
866e5c31af7Sopenharmony_ci
867e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if type is not one of the accepted values.");
868e5c31af7Sopenharmony_ci			glDrawRangeElements(GL_POINTS, 0, 1, 1, -1, vertices);
869e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
870e5c31af7Sopenharmony_ci			glDrawRangeElements(GL_POINTS, 0, 1, 1, GL_FLOAT, vertices);
871e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
872e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
873e5c31af7Sopenharmony_ci
874e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if count is negative.");
875e5c31af7Sopenharmony_ci			glDrawRangeElements(GL_POINTS, 0, 1, -1, GL_UNSIGNED_BYTE, vertices);
876e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
877e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
878e5c31af7Sopenharmony_ci
879e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if end < start.");
880e5c31af7Sopenharmony_ci			glDrawRangeElements(GL_POINTS, 1, 0, 1, GL_UNSIGNED_BYTE, vertices);
881e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
882e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
883e5c31af7Sopenharmony_ci
884e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
885e5c31af7Sopenharmony_ci			glGenFramebuffers(1, &fbo);
886e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, fbo);
887e5c31af7Sopenharmony_ci			glCheckFramebufferStatus(GL_FRAMEBUFFER);
888e5c31af7Sopenharmony_ci			glDrawRangeElements(GL_POINTS, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
889e5c31af7Sopenharmony_ci			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
890e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, 0);
891e5c31af7Sopenharmony_ci			glDeleteFramebuffers(1, &fbo);
892e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
893e5c31af7Sopenharmony_ci
894e5c31af7Sopenharmony_ci			if (isES && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error
895e5c31af7Sopenharmony_ci			{
896e5c31af7Sopenharmony_ci				m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if transform feedback is active and not paused.");
897e5c31af7Sopenharmony_ci				const char* tfVarying		= "gl_Position";
898e5c31af7Sopenharmony_ci				deUint32 verticesInRange[1];
899e5c31af7Sopenharmony_ci				verticesInRange[0]			= 0;
900e5c31af7Sopenharmony_ci
901e5c31af7Sopenharmony_ci				glGenBuffers				(1, &buf);
902e5c31af7Sopenharmony_ci				glGenTransformFeedbacks		(1, &tfID);
903e5c31af7Sopenharmony_ci
904e5c31af7Sopenharmony_ci				glUseProgram				(program.getProgram());
905e5c31af7Sopenharmony_ci				glTransformFeedbackVaryings	(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
906e5c31af7Sopenharmony_ci				glLinkProgram				(program.getProgram());
907e5c31af7Sopenharmony_ci				glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID);
908e5c31af7Sopenharmony_ci				glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
909e5c31af7Sopenharmony_ci				glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
910e5c31af7Sopenharmony_ci				glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
911e5c31af7Sopenharmony_ci				glBeginTransformFeedback	(GL_POINTS);
912e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
913e5c31af7Sopenharmony_ci
914e5c31af7Sopenharmony_ci				glDrawRangeElements			(GL_POINTS, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
915e5c31af7Sopenharmony_ci				expectError					(GL_INVALID_OPERATION);
916e5c31af7Sopenharmony_ci
917e5c31af7Sopenharmony_ci				glPauseTransformFeedback();
918e5c31af7Sopenharmony_ci				glDrawRangeElements			(GL_POINTS, 0, 1, 1, GL_UNSIGNED_BYTE, verticesInRange);
919e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
920e5c31af7Sopenharmony_ci
921e5c31af7Sopenharmony_ci				glEndTransformFeedback		();
922e5c31af7Sopenharmony_ci				glDeleteBuffers				(1, &buf);
923e5c31af7Sopenharmony_ci				glDeleteTransformFeedbacks	(1, &tfID);
924e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
925e5c31af7Sopenharmony_ci				m_log << tcu::TestLog::EndSection;
926e5c31af7Sopenharmony_ci			}
927e5c31af7Sopenharmony_ci
928e5c31af7Sopenharmony_ci			glUseProgram(0);
929e5c31af7Sopenharmony_ci		});
930e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(draw_range_elements_invalid_program, "Invalid glDrawRangeElements() usage",
931e5c31af7Sopenharmony_ci		{
932e5c31af7Sopenharmony_ci			glUseProgram(0);
933e5c31af7Sopenharmony_ci			GLuint fbo;
934e5c31af7Sopenharmony_ci			deUint32 vertices[1];
935e5c31af7Sopenharmony_ci			VAOHelper vao(m_context);
936e5c31af7Sopenharmony_ci			vertices[0] = 0xffffffffu;
937e5c31af7Sopenharmony_ci
938e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
939e5c31af7Sopenharmony_ci			glDrawRangeElements(-1, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
940e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
941e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
942e5c31af7Sopenharmony_ci
943e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if type is not one of the accepted values.");
944e5c31af7Sopenharmony_ci			glDrawRangeElements(GL_POINTS, 0, 1, 1, -1, vertices);
945e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
946e5c31af7Sopenharmony_ci			glDrawRangeElements(GL_POINTS, 0, 1, 1, GL_FLOAT, vertices);
947e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
948e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
949e5c31af7Sopenharmony_ci
950e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if count is negative.");
951e5c31af7Sopenharmony_ci			glDrawRangeElements(GL_POINTS, 0, 1, -1, GL_UNSIGNED_BYTE, vertices);
952e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
953e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
954e5c31af7Sopenharmony_ci
955e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if end < start.");
956e5c31af7Sopenharmony_ci			glDrawRangeElements(GL_POINTS, 1, 0, 1, GL_UNSIGNED_BYTE, vertices);
957e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
958e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
959e5c31af7Sopenharmony_ci
960e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
961e5c31af7Sopenharmony_ci			glGenFramebuffers(1, &fbo);
962e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, fbo);
963e5c31af7Sopenharmony_ci			glCheckFramebufferStatus(GL_FRAMEBUFFER);
964e5c31af7Sopenharmony_ci			glDrawRangeElements(GL_POINTS, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
965e5c31af7Sopenharmony_ci			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
966e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, 0);
967e5c31af7Sopenharmony_ci			glDeleteFramebuffers(1, &fbo);
968e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
969e5c31af7Sopenharmony_ci		});
970e5c31af7Sopenharmony_ci	ES3F_ADD_API_CASE(draw_range_elements_incomplete_primitive, "Invalid glDrawRangeElements() usage",
971e5c31af7Sopenharmony_ci		{
972e5c31af7Sopenharmony_ci			const bool isES	= glu::isContextTypeES(m_context.getRenderContext().getType());
973e5c31af7Sopenharmony_ci			glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
974e5c31af7Sopenharmony_ci			glUseProgram(program.getProgram());
975e5c31af7Sopenharmony_ci			GLuint fbo;
976e5c31af7Sopenharmony_ci			GLuint buf;
977e5c31af7Sopenharmony_ci			GLuint tfID;
978e5c31af7Sopenharmony_ci			deUint32 vertices[1];
979e5c31af7Sopenharmony_ci			VAOHelper vao(m_context);
980e5c31af7Sopenharmony_ci			vertices[0] = 0xffffffffu;
981e5c31af7Sopenharmony_ci
982e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
983e5c31af7Sopenharmony_ci			glDrawRangeElements(-1, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
984e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
985e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
986e5c31af7Sopenharmony_ci
987e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_ENUM is generated if type is not one of the accepted values.");
988e5c31af7Sopenharmony_ci			glDrawRangeElements(GL_TRIANGLES, 0, 1, 1, -1, vertices);
989e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
990e5c31af7Sopenharmony_ci			glDrawRangeElements(GL_TRIANGLES, 0, 1, 1, GL_FLOAT, vertices);
991e5c31af7Sopenharmony_ci			expectError(GL_INVALID_ENUM);
992e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
993e5c31af7Sopenharmony_ci
994e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if count is negative.");
995e5c31af7Sopenharmony_ci			glDrawRangeElements(GL_TRIANGLES, 0, 1, -1, GL_UNSIGNED_BYTE, vertices);
996e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
997e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
998e5c31af7Sopenharmony_ci
999e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_VALUE is generated if end < start.");
1000e5c31af7Sopenharmony_ci			glDrawRangeElements(GL_TRIANGLES, 1, 0, 1, GL_UNSIGNED_BYTE, vertices);
1001e5c31af7Sopenharmony_ci			expectError(GL_INVALID_VALUE);
1002e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
1003e5c31af7Sopenharmony_ci
1004e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::Section("", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
1005e5c31af7Sopenharmony_ci			glGenFramebuffers(1, &fbo);
1006e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1007e5c31af7Sopenharmony_ci			glCheckFramebufferStatus(GL_FRAMEBUFFER);
1008e5c31af7Sopenharmony_ci			glDrawRangeElements(GL_TRIANGLES, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
1009e5c31af7Sopenharmony_ci			expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1010e5c31af7Sopenharmony_ci			glBindFramebuffer(GL_FRAMEBUFFER, 0);
1011e5c31af7Sopenharmony_ci			glDeleteFramebuffers(1, &fbo);
1012e5c31af7Sopenharmony_ci			m_log << tcu::TestLog::EndSection;
1013e5c31af7Sopenharmony_ci
1014e5c31af7Sopenharmony_ci			if (isES && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error
1015e5c31af7Sopenharmony_ci			{
1016e5c31af7Sopenharmony_ci				m_log << tcu::TestLog::Section("", "GL_INVALID_OPERATION is generated if transform feedback is active and not paused.");
1017e5c31af7Sopenharmony_ci				const char* tfVarying		= "gl_Position";
1018e5c31af7Sopenharmony_ci				deUint32 verticesInRange[1];
1019e5c31af7Sopenharmony_ci				verticesInRange[0]			= 0;
1020e5c31af7Sopenharmony_ci
1021e5c31af7Sopenharmony_ci				glGenBuffers				(1, &buf);
1022e5c31af7Sopenharmony_ci				glGenTransformFeedbacks		(1, &tfID);
1023e5c31af7Sopenharmony_ci
1024e5c31af7Sopenharmony_ci				glUseProgram				(program.getProgram());
1025e5c31af7Sopenharmony_ci				glTransformFeedbackVaryings	(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
1026e5c31af7Sopenharmony_ci				glLinkProgram				(program.getProgram());
1027e5c31af7Sopenharmony_ci				glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID);
1028e5c31af7Sopenharmony_ci				glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
1029e5c31af7Sopenharmony_ci				glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
1030e5c31af7Sopenharmony_ci				glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
1031e5c31af7Sopenharmony_ci				glBeginTransformFeedback	(GL_TRIANGLES);
1032e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
1033e5c31af7Sopenharmony_ci
1034e5c31af7Sopenharmony_ci				glDrawRangeElements			(GL_TRIANGLES, 0, 1, 1, GL_UNSIGNED_BYTE, vertices);
1035e5c31af7Sopenharmony_ci				expectError					(GL_INVALID_OPERATION);
1036e5c31af7Sopenharmony_ci
1037e5c31af7Sopenharmony_ci				glPauseTransformFeedback();
1038e5c31af7Sopenharmony_ci				glDrawRangeElements			(GL_TRIANGLES, 0, 1, 1, GL_UNSIGNED_BYTE, verticesInRange);
1039e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
1040e5c31af7Sopenharmony_ci
1041e5c31af7Sopenharmony_ci				glEndTransformFeedback		();
1042e5c31af7Sopenharmony_ci				glDeleteBuffers				(1, &buf);
1043e5c31af7Sopenharmony_ci				glDeleteTransformFeedbacks	(1, &tfID);
1044e5c31af7Sopenharmony_ci				expectError					(GL_NO_ERROR);
1045e5c31af7Sopenharmony_ci				m_log << tcu::TestLog::EndSection;
1046e5c31af7Sopenharmony_ci			}
1047e5c31af7Sopenharmony_ci
1048e5c31af7Sopenharmony_ci			glUseProgram(0);
1049e5c31af7Sopenharmony_ci		});
1050e5c31af7Sopenharmony_ci}
1051e5c31af7Sopenharmony_ci
1052e5c31af7Sopenharmony_ci} // Functional
1053e5c31af7Sopenharmony_ci} // gles3
1054e5c31af7Sopenharmony_ci} // deqp
1055