1e5c31af7Sopenharmony_ci/*-------------------------------------------------------------------------
2e5c31af7Sopenharmony_ci * drawElements Quality Program OpenGL ES 3.1 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 Shader API tests.
22e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ci#include "es31fNegativeShaderApiTests.hpp"
25e5c31af7Sopenharmony_ci
26e5c31af7Sopenharmony_ci#include "deUniquePtr.hpp"
27e5c31af7Sopenharmony_ci
28e5c31af7Sopenharmony_ci#include "glwDefs.hpp"
29e5c31af7Sopenharmony_ci#include "glwEnums.hpp"
30e5c31af7Sopenharmony_ci
31e5c31af7Sopenharmony_ci#include "gluShaderProgram.hpp"
32e5c31af7Sopenharmony_ci#include "gluCallLogWrapper.hpp"
33e5c31af7Sopenharmony_ci
34e5c31af7Sopenharmony_ci#include "gluContextInfo.hpp"
35e5c31af7Sopenharmony_ci#include "gluRenderContext.hpp"
36e5c31af7Sopenharmony_ci
37e5c31af7Sopenharmony_ci
38e5c31af7Sopenharmony_cinamespace deqp
39e5c31af7Sopenharmony_ci{
40e5c31af7Sopenharmony_cinamespace gles31
41e5c31af7Sopenharmony_ci{
42e5c31af7Sopenharmony_cinamespace Functional
43e5c31af7Sopenharmony_ci{
44e5c31af7Sopenharmony_cinamespace NegativeTestShared
45e5c31af7Sopenharmony_ci{
46e5c31af7Sopenharmony_ciusing tcu::TestLog;
47e5c31af7Sopenharmony_ciusing glu::CallLogWrapper;
48e5c31af7Sopenharmony_ciusing namespace glw;
49e5c31af7Sopenharmony_ci
50e5c31af7Sopenharmony_cistatic const char* vertexShaderSource		=	"#version 300 es\n"
51e5c31af7Sopenharmony_ci												"void main (void)\n"
52e5c31af7Sopenharmony_ci												"{\n"
53e5c31af7Sopenharmony_ci												"	gl_Position = vec4(0.0);\n"
54e5c31af7Sopenharmony_ci												"}\n\0";
55e5c31af7Sopenharmony_ci
56e5c31af7Sopenharmony_cistatic const char* fragmentShaderSource		=	"#version 300 es\n"
57e5c31af7Sopenharmony_ci												"layout(location = 0) out mediump vec4 fragColor;"
58e5c31af7Sopenharmony_ci												"void main (void)\n"
59e5c31af7Sopenharmony_ci												"{\n"
60e5c31af7Sopenharmony_ci												"	fragColor = vec4(0.0);\n"
61e5c31af7Sopenharmony_ci												"}\n\0";
62e5c31af7Sopenharmony_ci
63e5c31af7Sopenharmony_cistatic const char* uniformTestVertSource	=	"#version 300 es\n"
64e5c31af7Sopenharmony_ci												"uniform mediump vec4 vec4_v;\n"
65e5c31af7Sopenharmony_ci												"uniform mediump mat4 mat4_v;\n"
66e5c31af7Sopenharmony_ci												"void main (void)\n"
67e5c31af7Sopenharmony_ci												"{\n"
68e5c31af7Sopenharmony_ci												"	gl_Position = mat4_v * vec4_v;\n"
69e5c31af7Sopenharmony_ci												"}\n\0";
70e5c31af7Sopenharmony_ci
71e5c31af7Sopenharmony_cistatic const char* uniformTestFragSource	=	"#version 300 es\n"
72e5c31af7Sopenharmony_ci												"uniform mediump ivec4 ivec4_f;\n"
73e5c31af7Sopenharmony_ci												"uniform mediump uvec4 uvec4_f;\n"
74e5c31af7Sopenharmony_ci												"uniform sampler2D sampler_f;\n"
75e5c31af7Sopenharmony_ci												"layout(location = 0) out mediump vec4 fragColor;"
76e5c31af7Sopenharmony_ci												"void main (void)\n"
77e5c31af7Sopenharmony_ci												"{\n"
78e5c31af7Sopenharmony_ci												"	fragColor.xy = (vec4(uvec4_f) + vec4(ivec4_f)).xy;\n"
79e5c31af7Sopenharmony_ci												"	fragColor.zw = texture(sampler_f, vec2(0.0, 0.0)).zw;\n"
80e5c31af7Sopenharmony_ci												"}\n\0";
81e5c31af7Sopenharmony_ci
82e5c31af7Sopenharmony_cistatic const char* uniformBlockVertSource	=	"#version 300 es\n"
83e5c31af7Sopenharmony_ci												"layout(shared) uniform Block { lowp float var; };\n"
84e5c31af7Sopenharmony_ci												"void main (void)\n"
85e5c31af7Sopenharmony_ci												"{\n"
86e5c31af7Sopenharmony_ci												"	gl_Position = vec4(var);\n"
87e5c31af7Sopenharmony_ci												"}\n\0";
88e5c31af7Sopenharmony_ci
89e5c31af7Sopenharmony_cistatic bool supportsES32orGL45(NegativeTestContext& ctx)
90e5c31af7Sopenharmony_ci{
91e5c31af7Sopenharmony_ci	return contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) ||
92e5c31af7Sopenharmony_ci		   contextSupports(ctx.getRenderContext().getType(), glu::ApiType::core(4, 5));
93e5c31af7Sopenharmony_ci}
94e5c31af7Sopenharmony_ci
95e5c31af7Sopenharmony_ci// Shader control commands
96e5c31af7Sopenharmony_civoid create_shader (NegativeTestContext& ctx)
97e5c31af7Sopenharmony_ci{
98e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if shaderType is not an accepted value.");
99e5c31af7Sopenharmony_ci	ctx.glCreateShader(-1);
100e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_ENUM);
101e5c31af7Sopenharmony_ci	ctx.endSection();
102e5c31af7Sopenharmony_ci}
103e5c31af7Sopenharmony_ci
104e5c31af7Sopenharmony_civoid shader_source (NegativeTestContext& ctx)
105e5c31af7Sopenharmony_ci{
106e5c31af7Sopenharmony_ci	// make notAShader not a shader id
107e5c31af7Sopenharmony_ci	const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
108e5c31af7Sopenharmony_ci	ctx.glDeleteShader(notAShader);
109e5c31af7Sopenharmony_ci
110e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
111e5c31af7Sopenharmony_ci	ctx.glShaderSource(notAShader, 0, 0, 0);
112e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
113e5c31af7Sopenharmony_ci	ctx.endSection();
114e5c31af7Sopenharmony_ci
115e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if count is less than 0.");
116e5c31af7Sopenharmony_ci	GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
117e5c31af7Sopenharmony_ci	ctx.glShaderSource(shader, -1, 0, 0);
118e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
119e5c31af7Sopenharmony_ci	ctx.endSection();
120e5c31af7Sopenharmony_ci
121e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not a shader object.");
122e5c31af7Sopenharmony_ci	GLuint program = ctx.glCreateProgram();
123e5c31af7Sopenharmony_ci	ctx.glShaderSource(program, 0, 0, 0);
124e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
125e5c31af7Sopenharmony_ci	ctx.endSection();
126e5c31af7Sopenharmony_ci
127e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(program);
128e5c31af7Sopenharmony_ci	ctx.glDeleteShader(shader);
129e5c31af7Sopenharmony_ci}
130e5c31af7Sopenharmony_ci
131e5c31af7Sopenharmony_civoid compile_shader (NegativeTestContext& ctx)
132e5c31af7Sopenharmony_ci{
133e5c31af7Sopenharmony_ci	const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
134e5c31af7Sopenharmony_ci	ctx.glDeleteShader(notAShader);
135e5c31af7Sopenharmony_ci
136e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
137e5c31af7Sopenharmony_ci	ctx.glCompileShader(notAShader);
138e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
139e5c31af7Sopenharmony_ci	ctx.endSection();
140e5c31af7Sopenharmony_ci
141e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not a shader object.");
142e5c31af7Sopenharmony_ci	GLuint program = ctx.glCreateProgram();
143e5c31af7Sopenharmony_ci	ctx.glCompileShader(program);
144e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
145e5c31af7Sopenharmony_ci	ctx.endSection();
146e5c31af7Sopenharmony_ci
147e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(program);
148e5c31af7Sopenharmony_ci}
149e5c31af7Sopenharmony_ci
150e5c31af7Sopenharmony_civoid delete_shader (NegativeTestContext& ctx)
151e5c31af7Sopenharmony_ci{
152e5c31af7Sopenharmony_ci	const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
153e5c31af7Sopenharmony_ci	ctx.glDeleteShader(notAShader);
154e5c31af7Sopenharmony_ci
155e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
156e5c31af7Sopenharmony_ci	ctx.glDeleteShader(notAShader);
157e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
158e5c31af7Sopenharmony_ci	ctx.endSection();
159e5c31af7Sopenharmony_ci}
160e5c31af7Sopenharmony_ci
161e5c31af7Sopenharmony_civoid shader_binary (NegativeTestContext& ctx)
162e5c31af7Sopenharmony_ci{
163e5c31af7Sopenharmony_ci	std::vector<deInt32> binaryFormats;
164e5c31af7Sopenharmony_ci	deBool shaderBinarySupported = !binaryFormats.empty();
165e5c31af7Sopenharmony_ci	GLuint shaders[2];
166e5c31af7Sopenharmony_ci	GLuint shaderPair[2];
167e5c31af7Sopenharmony_ci	GLuint nonProgram[2];
168e5c31af7Sopenharmony_ci	GLuint shaderProgram[2];
169e5c31af7Sopenharmony_ci
170e5c31af7Sopenharmony_ci	{
171e5c31af7Sopenharmony_ci		deInt32 numFormats = 0x1234;
172e5c31af7Sopenharmony_ci		ctx.glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &numFormats);
173e5c31af7Sopenharmony_ci
174e5c31af7Sopenharmony_ci		if (numFormats == 0)
175e5c31af7Sopenharmony_ci			ctx.getLog() << TestLog::Message << "// No supported extensions available." << TestLog::EndMessage;
176e5c31af7Sopenharmony_ci		else
177e5c31af7Sopenharmony_ci		{
178e5c31af7Sopenharmony_ci			binaryFormats.resize(numFormats);
179e5c31af7Sopenharmony_ci			ctx.glGetIntegerv(GL_SHADER_BINARY_FORMATS, &binaryFormats[0]);
180e5c31af7Sopenharmony_ci		}
181e5c31af7Sopenharmony_ci	}
182e5c31af7Sopenharmony_ci
183e5c31af7Sopenharmony_ci	if (!shaderBinarySupported)
184e5c31af7Sopenharmony_ci		ctx.getLog() << TestLog::Message << "// Shader binaries not supported." << TestLog::EndMessage;
185e5c31af7Sopenharmony_ci	else
186e5c31af7Sopenharmony_ci		ctx.getLog() << TestLog::Message << "// Shader binaries supported" << TestLog::EndMessage;
187e5c31af7Sopenharmony_ci
188e5c31af7Sopenharmony_ci	shaders[0]			= ctx.glCreateShader(GL_VERTEX_SHADER);
189e5c31af7Sopenharmony_ci	shaders[1]			= ctx.glCreateShader(GL_VERTEX_SHADER);
190e5c31af7Sopenharmony_ci	shaderPair[0]		= ctx.glCreateShader(GL_VERTEX_SHADER);
191e5c31af7Sopenharmony_ci	shaderPair[1]		= ctx.glCreateShader(GL_FRAGMENT_SHADER);
192e5c31af7Sopenharmony_ci	nonProgram[0]		= -1;
193e5c31af7Sopenharmony_ci	nonProgram[1]		= -1;
194e5c31af7Sopenharmony_ci	shaderProgram[0]	= ctx.glCreateShader(GL_VERTEX_SHADER);
195e5c31af7Sopenharmony_ci	shaderProgram[1]	= ctx.glCreateProgram();
196e5c31af7Sopenharmony_ci
197e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if binaryFormat is not an accepted value.");
198e5c31af7Sopenharmony_ci	ctx.glShaderBinary(1, &shaders[0], -1, 0, 0);
199e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_ENUM);
200e5c31af7Sopenharmony_ci	ctx.endSection();
201e5c31af7Sopenharmony_ci
202e5c31af7Sopenharmony_ci	if (shaderBinarySupported)
203e5c31af7Sopenharmony_ci	{
204e5c31af7Sopenharmony_ci		ctx.beginSection("GL_INVALID_VALUE is generated if the data pointed to by binary does not match the format specified by binaryFormat.");
205e5c31af7Sopenharmony_ci		const GLbyte data = 0x005F;
206e5c31af7Sopenharmony_ci		ctx.glShaderBinary(1, &shaders[0], binaryFormats[0], &data, 1);
207e5c31af7Sopenharmony_ci		ctx.expectError(GL_INVALID_VALUE);
208e5c31af7Sopenharmony_ci		ctx.endSection();
209e5c31af7Sopenharmony_ci
210e5c31af7Sopenharmony_ci		ctx.beginSection("GL_INVALID_OPERATION is generated if more than one of the handles in shaders refers to the same type of shader, or GL_INVALID_VALUE due to invalid data pointer.");
211e5c31af7Sopenharmony_ci		ctx.glShaderBinary(2, &shaders[0], binaryFormats[0], 0, 0);
212e5c31af7Sopenharmony_ci		ctx.expectError(GL_INVALID_OPERATION, GL_INVALID_VALUE);
213e5c31af7Sopenharmony_ci		ctx.endSection();
214e5c31af7Sopenharmony_ci
215e5c31af7Sopenharmony_ci		ctx.beginSection("GL_INVALID_VALUE is generated if count or length is negative.");
216e5c31af7Sopenharmony_ci		ctx.glShaderBinary(2, &shaderPair[0], binaryFormats[0], 0, -1);
217e5c31af7Sopenharmony_ci		ctx.expectError(GL_INVALID_VALUE);
218e5c31af7Sopenharmony_ci		ctx.glShaderBinary(-1, &shaderPair[0], binaryFormats[0], 0, 0);
219e5c31af7Sopenharmony_ci		ctx.expectError(GL_INVALID_VALUE);
220e5c31af7Sopenharmony_ci		ctx.endSection();
221e5c31af7Sopenharmony_ci
222e5c31af7Sopenharmony_ci		ctx.beginSection("GL_INVALID_VALUE is generated if shaders contains anything other than shader or program objects.");
223e5c31af7Sopenharmony_ci		ctx.glShaderBinary(2, &nonProgram[0], binaryFormats[0], 0, 0);
224e5c31af7Sopenharmony_ci		ctx.expectError(GL_INVALID_VALUE);
225e5c31af7Sopenharmony_ci		ctx.endSection();
226e5c31af7Sopenharmony_ci
227e5c31af7Sopenharmony_ci		ctx.beginSection("GL_INVALID_OPERATION is generated if shaders refers to a program object.");
228e5c31af7Sopenharmony_ci		ctx.glShaderBinary(2, &shaderProgram[0], binaryFormats[0], 0, 0);
229e5c31af7Sopenharmony_ci		ctx.expectError(GL_INVALID_OPERATION);
230e5c31af7Sopenharmony_ci		ctx.endSection();
231e5c31af7Sopenharmony_ci	}
232e5c31af7Sopenharmony_ci
233e5c31af7Sopenharmony_ci	ctx.glDeleteShader(shaders[0]);
234e5c31af7Sopenharmony_ci	ctx.glDeleteShader(shaders[1]);
235e5c31af7Sopenharmony_ci}
236e5c31af7Sopenharmony_ci
237e5c31af7Sopenharmony_civoid attach_shader (NegativeTestContext& ctx)
238e5c31af7Sopenharmony_ci{
239e5c31af7Sopenharmony_ci	GLuint shader1 = ctx.glCreateShader(GL_VERTEX_SHADER);
240e5c31af7Sopenharmony_ci	GLuint shader2 = ctx.glCreateShader(GL_VERTEX_SHADER);
241e5c31af7Sopenharmony_ci	GLuint program = ctx.glCreateProgram();
242e5c31af7Sopenharmony_ci
243e5c31af7Sopenharmony_ci	const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
244e5c31af7Sopenharmony_ci	const GLuint notAProgram = ctx.glCreateProgram();
245e5c31af7Sopenharmony_ci
246e5c31af7Sopenharmony_ci	ctx.glDeleteShader(notAShader);
247e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(notAProgram);
248e5c31af7Sopenharmony_ci
249e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
250e5c31af7Sopenharmony_ci	ctx.glAttachShader(shader1, shader1);
251e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
252e5c31af7Sopenharmony_ci	ctx.endSection();
253e5c31af7Sopenharmony_ci
254e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not a shader object.");
255e5c31af7Sopenharmony_ci	ctx.glAttachShader(program, program);
256e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
257e5c31af7Sopenharmony_ci	ctx.glAttachShader(shader1, program);
258e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
259e5c31af7Sopenharmony_ci	ctx.endSection();
260e5c31af7Sopenharmony_ci
261e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if either program or shader is not a value generated by OpenGL.");
262e5c31af7Sopenharmony_ci	ctx.glAttachShader(program, notAShader);
263e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
264e5c31af7Sopenharmony_ci	ctx.glAttachShader(notAProgram, shader1);
265e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
266e5c31af7Sopenharmony_ci	ctx.glAttachShader(notAProgram, notAShader);
267e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
268e5c31af7Sopenharmony_ci	ctx.endSection();
269e5c31af7Sopenharmony_ci
270e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if shader is already attached to program.");
271e5c31af7Sopenharmony_ci	ctx.glAttachShader(program, shader1);
272e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
273e5c31af7Sopenharmony_ci	ctx.glAttachShader(program, shader1);
274e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
275e5c31af7Sopenharmony_ci	ctx.endSection();
276e5c31af7Sopenharmony_ci
277e5c31af7Sopenharmony_ci	if (glu::isContextTypeES(ctx.getRenderContext().getType()))
278e5c31af7Sopenharmony_ci	{
279e5c31af7Sopenharmony_ci		ctx.beginSection("GL_INVALID_OPERATION is generated if a shader of the same type as shader is already attached to program.");
280e5c31af7Sopenharmony_ci		ctx.glAttachShader(program, shader2);
281e5c31af7Sopenharmony_ci		ctx.expectError(GL_INVALID_OPERATION);
282e5c31af7Sopenharmony_ci		ctx.endSection();
283e5c31af7Sopenharmony_ci	}
284e5c31af7Sopenharmony_ci
285e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(program);
286e5c31af7Sopenharmony_ci	ctx.glDeleteShader(shader1);
287e5c31af7Sopenharmony_ci	ctx.glDeleteShader(shader2);
288e5c31af7Sopenharmony_ci}
289e5c31af7Sopenharmony_ci
290e5c31af7Sopenharmony_civoid detach_shader (NegativeTestContext& ctx)
291e5c31af7Sopenharmony_ci{
292e5c31af7Sopenharmony_ci	GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
293e5c31af7Sopenharmony_ci	GLuint program = ctx.glCreateProgram();
294e5c31af7Sopenharmony_ci
295e5c31af7Sopenharmony_ci	const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
296e5c31af7Sopenharmony_ci	const GLuint notAProgram = ctx.glCreateProgram();
297e5c31af7Sopenharmony_ci
298e5c31af7Sopenharmony_ci	ctx.glDeleteShader(notAShader);
299e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(notAProgram);
300e5c31af7Sopenharmony_ci
301e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if either program or shader is not a value generated by OpenGL.");
302e5c31af7Sopenharmony_ci	ctx.glDetachShader(notAProgram, shader);
303e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
304e5c31af7Sopenharmony_ci	ctx.glDetachShader(program, notAShader);
305e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
306e5c31af7Sopenharmony_ci	ctx.glDetachShader(notAProgram, notAShader);
307e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
308e5c31af7Sopenharmony_ci	ctx.endSection();
309e5c31af7Sopenharmony_ci
310e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
311e5c31af7Sopenharmony_ci	ctx.glDetachShader(shader, shader);
312e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
313e5c31af7Sopenharmony_ci	ctx.endSection();
314e5c31af7Sopenharmony_ci
315e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not a shader object.");
316e5c31af7Sopenharmony_ci	ctx.glDetachShader(program, program);
317e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
318e5c31af7Sopenharmony_ci	ctx.glDetachShader(shader, program);
319e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
320e5c31af7Sopenharmony_ci	ctx.endSection();
321e5c31af7Sopenharmony_ci
322e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not attached to program.");
323e5c31af7Sopenharmony_ci	ctx.glDetachShader(program, shader);
324e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
325e5c31af7Sopenharmony_ci	ctx.endSection();
326e5c31af7Sopenharmony_ci
327e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(program);
328e5c31af7Sopenharmony_ci	ctx.glDeleteShader(shader);
329e5c31af7Sopenharmony_ci}
330e5c31af7Sopenharmony_ci
331e5c31af7Sopenharmony_civoid link_program (NegativeTestContext& ctx)
332e5c31af7Sopenharmony_ci{
333e5c31af7Sopenharmony_ci	GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
334e5c31af7Sopenharmony_ci
335e5c31af7Sopenharmony_ci	const GLuint notAProgram = ctx.glCreateProgram();
336e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(notAProgram);
337e5c31af7Sopenharmony_ci
338e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
339e5c31af7Sopenharmony_ci	ctx.glLinkProgram(notAProgram);
340e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
341e5c31af7Sopenharmony_ci	ctx.endSection();
342e5c31af7Sopenharmony_ci
343e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
344e5c31af7Sopenharmony_ci	ctx.glLinkProgram(shader);
345e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
346e5c31af7Sopenharmony_ci	ctx.endSection();
347e5c31af7Sopenharmony_ci
348e5c31af7Sopenharmony_ci	ctx.glDeleteShader(shader);
349e5c31af7Sopenharmony_ci
350e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if program is the currently active program object and transform feedback mode is active.");
351e5c31af7Sopenharmony_ci	glu::ShaderProgram			program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
352e5c31af7Sopenharmony_ci	deUint32					buf = 0x1234;
353e5c31af7Sopenharmony_ci	deUint32					tfID = 0x1234;
354e5c31af7Sopenharmony_ci	const char* tfVarying		= "gl_Position";
355e5c31af7Sopenharmony_ci
356e5c31af7Sopenharmony_ci	ctx.glGenTransformFeedbacks		(1, &tfID);
357e5c31af7Sopenharmony_ci	ctx.glGenBuffers				(1, &buf);
358e5c31af7Sopenharmony_ci
359e5c31af7Sopenharmony_ci	ctx.glUseProgram				(program.getProgram());
360e5c31af7Sopenharmony_ci	ctx.glTransformFeedbackVaryings	(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
361e5c31af7Sopenharmony_ci	ctx.glLinkProgram				(program.getProgram());
362e5c31af7Sopenharmony_ci	ctx.glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID);
363e5c31af7Sopenharmony_ci	ctx.glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
364e5c31af7Sopenharmony_ci	ctx.glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
365e5c31af7Sopenharmony_ci	ctx.glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
366e5c31af7Sopenharmony_ci	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
367e5c31af7Sopenharmony_ci	ctx.expectError					(GL_NO_ERROR);
368e5c31af7Sopenharmony_ci
369e5c31af7Sopenharmony_ci	ctx.glLinkProgram				(program.getProgram());
370e5c31af7Sopenharmony_ci	ctx.expectError				(GL_INVALID_OPERATION);
371e5c31af7Sopenharmony_ci
372e5c31af7Sopenharmony_ci	ctx.glEndTransformFeedback		();
373e5c31af7Sopenharmony_ci	ctx.glDeleteTransformFeedbacks	(1, &tfID);
374e5c31af7Sopenharmony_ci	ctx.glDeleteBuffers				(1, &buf);
375e5c31af7Sopenharmony_ci	ctx.expectError				(GL_NO_ERROR);
376e5c31af7Sopenharmony_ci	ctx.endSection();
377e5c31af7Sopenharmony_ci}
378e5c31af7Sopenharmony_ci
379e5c31af7Sopenharmony_civoid use_program (NegativeTestContext& ctx)
380e5c31af7Sopenharmony_ci{
381e5c31af7Sopenharmony_ci	GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
382e5c31af7Sopenharmony_ci
383e5c31af7Sopenharmony_ci	const GLuint notAProgram = ctx.glCreateProgram();
384e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(notAProgram);
385e5c31af7Sopenharmony_ci
386e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if program is neither 0 nor a value generated by OpenGL.");
387e5c31af7Sopenharmony_ci	ctx.glUseProgram(notAProgram);
388e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
389e5c31af7Sopenharmony_ci	ctx.endSection();
390e5c31af7Sopenharmony_ci
391e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
392e5c31af7Sopenharmony_ci	ctx.glUseProgram(shader);
393e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
394e5c31af7Sopenharmony_ci	ctx.endSection();
395e5c31af7Sopenharmony_ci
396e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback mode is active and not paused.");
397e5c31af7Sopenharmony_ci	glu::ShaderProgram			program1(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
398e5c31af7Sopenharmony_ci	glu::ShaderProgram			program2(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
399e5c31af7Sopenharmony_ci	deUint32					buf = 0x1234;
400e5c31af7Sopenharmony_ci	deUint32					tfID = 0x1234;
401e5c31af7Sopenharmony_ci	const char* tfVarying		= "gl_Position";
402e5c31af7Sopenharmony_ci
403e5c31af7Sopenharmony_ci	ctx.glGenTransformFeedbacks		(1, &tfID);
404e5c31af7Sopenharmony_ci	ctx.glGenBuffers				(1, &buf);
405e5c31af7Sopenharmony_ci
406e5c31af7Sopenharmony_ci	ctx.glUseProgram				(program1.getProgram());
407e5c31af7Sopenharmony_ci	ctx.glTransformFeedbackVaryings	(program1.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
408e5c31af7Sopenharmony_ci	ctx.glLinkProgram				(program1.getProgram());
409e5c31af7Sopenharmony_ci	ctx.glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID);
410e5c31af7Sopenharmony_ci	ctx.glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
411e5c31af7Sopenharmony_ci	ctx.glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
412e5c31af7Sopenharmony_ci	ctx.glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
413e5c31af7Sopenharmony_ci	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
414e5c31af7Sopenharmony_ci	ctx.expectError					(GL_NO_ERROR);
415e5c31af7Sopenharmony_ci
416e5c31af7Sopenharmony_ci	ctx.glUseProgram				(program2.getProgram());
417e5c31af7Sopenharmony_ci	ctx.expectError				(GL_INVALID_OPERATION);
418e5c31af7Sopenharmony_ci
419e5c31af7Sopenharmony_ci	ctx.glPauseTransformFeedback	();
420e5c31af7Sopenharmony_ci	ctx.glUseProgram				(program2.getProgram());
421e5c31af7Sopenharmony_ci	ctx.expectError				(GL_NO_ERROR);
422e5c31af7Sopenharmony_ci
423e5c31af7Sopenharmony_ci	ctx.glEndTransformFeedback		();
424e5c31af7Sopenharmony_ci	ctx.glDeleteTransformFeedbacks	(1, &tfID);
425e5c31af7Sopenharmony_ci	ctx.glDeleteBuffers				(1, &buf);
426e5c31af7Sopenharmony_ci	ctx.expectError				(GL_NO_ERROR);
427e5c31af7Sopenharmony_ci	ctx.endSection();
428e5c31af7Sopenharmony_ci
429e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
430e5c31af7Sopenharmony_ci	ctx.glDeleteShader(shader);
431e5c31af7Sopenharmony_ci}
432e5c31af7Sopenharmony_ci
433e5c31af7Sopenharmony_civoid delete_program (NegativeTestContext& ctx)
434e5c31af7Sopenharmony_ci{
435e5c31af7Sopenharmony_ci	GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
436e5c31af7Sopenharmony_ci
437e5c31af7Sopenharmony_ci	const GLuint notAProgram = ctx.glCreateProgram();
438e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(notAProgram);
439e5c31af7Sopenharmony_ci
440e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
441e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(notAProgram);
442e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
443e5c31af7Sopenharmony_ci	ctx.endSection();
444e5c31af7Sopenharmony_ci
445e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if program is not zero and is the name of a shader object.");
446e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(shader);
447e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
448e5c31af7Sopenharmony_ci	ctx.endSection();
449e5c31af7Sopenharmony_ci
450e5c31af7Sopenharmony_ci	ctx.glDeleteShader(shader);
451e5c31af7Sopenharmony_ci}
452e5c31af7Sopenharmony_ci
453e5c31af7Sopenharmony_civoid validate_program (NegativeTestContext& ctx)
454e5c31af7Sopenharmony_ci{
455e5c31af7Sopenharmony_ci	GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
456e5c31af7Sopenharmony_ci
457e5c31af7Sopenharmony_ci	const GLuint notAProgram = ctx.glCreateProgram();
458e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(notAProgram);
459e5c31af7Sopenharmony_ci
460e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
461e5c31af7Sopenharmony_ci	ctx.glValidateProgram(notAProgram);
462e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
463e5c31af7Sopenharmony_ci	ctx.endSection();
464e5c31af7Sopenharmony_ci
465e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
466e5c31af7Sopenharmony_ci	ctx.glValidateProgram(shader);
467e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
468e5c31af7Sopenharmony_ci	ctx.endSection();
469e5c31af7Sopenharmony_ci
470e5c31af7Sopenharmony_ci	ctx.glDeleteShader(shader);
471e5c31af7Sopenharmony_ci}
472e5c31af7Sopenharmony_ci
473e5c31af7Sopenharmony_civoid get_program_binary (NegativeTestContext& ctx)
474e5c31af7Sopenharmony_ci{
475e5c31af7Sopenharmony_ci	glu::ShaderProgram				program			(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
476e5c31af7Sopenharmony_ci	glu::ShaderProgram				programInvalid	(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, ""));
477e5c31af7Sopenharmony_ci	GLenum							binaryFormat	= -1;
478e5c31af7Sopenharmony_ci	GLsizei							binaryLength	= -1;
479e5c31af7Sopenharmony_ci	GLint							binaryPtr		= -1;
480e5c31af7Sopenharmony_ci	GLint							bufSize			= -1;
481e5c31af7Sopenharmony_ci	GLint							linkStatus		= -1;
482e5c31af7Sopenharmony_ci
483e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if bufSize is less than the size of GL_PROGRAM_BINARY_LENGTH for program.");
484e5c31af7Sopenharmony_ci	ctx.glGetProgramiv		(program.getProgram(), GL_PROGRAM_BINARY_LENGTH,	&bufSize);
485e5c31af7Sopenharmony_ci	ctx.expectError		(GL_NO_ERROR);
486e5c31af7Sopenharmony_ci	ctx.glGetProgramiv		(program.getProgram(), GL_LINK_STATUS,				&linkStatus);
487e5c31af7Sopenharmony_ci	ctx.getLog() << TestLog::Message << "// GL_PROGRAM_BINARY_LENGTH = " << bufSize << TestLog::EndMessage;
488e5c31af7Sopenharmony_ci	ctx.getLog() << TestLog::Message << "// GL_LINK_STATUS = " << linkStatus << TestLog::EndMessage;
489e5c31af7Sopenharmony_ci	ctx.expectError		(GL_NO_ERROR);
490e5c31af7Sopenharmony_ci
491e5c31af7Sopenharmony_ci	ctx.glGetProgramBinary	(program.getProgram(), 0, &binaryLength, &binaryFormat, &binaryPtr);
492e5c31af7Sopenharmony_ci	ctx.expectError		(GL_INVALID_OPERATION);
493e5c31af7Sopenharmony_ci	if (bufSize > 0)
494e5c31af7Sopenharmony_ci	{
495e5c31af7Sopenharmony_ci		ctx.glGetProgramBinary	(program.getProgram(), bufSize-1, &binaryLength, &binaryFormat, &binaryPtr);
496e5c31af7Sopenharmony_ci		ctx.expectError		(GL_INVALID_OPERATION);
497e5c31af7Sopenharmony_ci	}
498e5c31af7Sopenharmony_ci	ctx.endSection();
499e5c31af7Sopenharmony_ci
500e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if GL_LINK_STATUS for the program object is false.");
501e5c31af7Sopenharmony_ci	ctx.glGetProgramiv		(programInvalid.getProgram(), GL_PROGRAM_BINARY_LENGTH,	&bufSize);
502e5c31af7Sopenharmony_ci	ctx.expectError		(GL_NO_ERROR);
503e5c31af7Sopenharmony_ci	ctx.glGetProgramiv		(programInvalid.getProgram(), GL_LINK_STATUS,			&linkStatus);
504e5c31af7Sopenharmony_ci	ctx.getLog() << TestLog::Message << "// GL_PROGRAM_BINARY_LENGTH = " << bufSize << TestLog::EndMessage;
505e5c31af7Sopenharmony_ci	ctx.getLog() << TestLog::Message << "// GL_LINK_STATUS = " << linkStatus << TestLog::EndMessage;
506e5c31af7Sopenharmony_ci	ctx.expectError		(GL_NO_ERROR);
507e5c31af7Sopenharmony_ci
508e5c31af7Sopenharmony_ci	if (!linkStatus)
509e5c31af7Sopenharmony_ci	{
510e5c31af7Sopenharmony_ci		ctx.glGetProgramBinary	(programInvalid.getProgram(), bufSize, &binaryLength, &binaryFormat, &binaryPtr);
511e5c31af7Sopenharmony_ci		ctx.expectError		(GL_INVALID_OPERATION);
512e5c31af7Sopenharmony_ci		ctx.endSection();
513e5c31af7Sopenharmony_ci	}
514e5c31af7Sopenharmony_ci	else
515e5c31af7Sopenharmony_ci	{
516e5c31af7Sopenharmony_ci		if (isContextTypeES(ctx.getRenderContext().getType()))
517e5c31af7Sopenharmony_ci			ctx.fail("Program should not have linked");
518e5c31af7Sopenharmony_ci	}
519e5c31af7Sopenharmony_ci}
520e5c31af7Sopenharmony_ci
521e5c31af7Sopenharmony_civoid program_binary (NegativeTestContext& ctx)
522e5c31af7Sopenharmony_ci{
523e5c31af7Sopenharmony_ci	glu::ShaderProgram		srcProgram		(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
524e5c31af7Sopenharmony_ci	GLuint					dstProgram		= ctx.glCreateProgram();
525e5c31af7Sopenharmony_ci	GLuint					unusedShader		= ctx.glCreateShader(GL_VERTEX_SHADER);
526e5c31af7Sopenharmony_ci	GLenum					binaryFormat	= -1;
527e5c31af7Sopenharmony_ci	GLsizei					binaryLength	= -1;
528e5c31af7Sopenharmony_ci	std::vector<deUint8>	binaryBuf;
529e5c31af7Sopenharmony_ci	GLint					bufSize			= -1;
530e5c31af7Sopenharmony_ci	GLint					linkStatus		= -1;
531e5c31af7Sopenharmony_ci
532e5c31af7Sopenharmony_ci	ctx.glGetProgramiv		(srcProgram.getProgram(), GL_PROGRAM_BINARY_LENGTH,	&bufSize);
533e5c31af7Sopenharmony_ci	ctx.glGetProgramiv		(srcProgram.getProgram(), GL_LINK_STATUS,			&linkStatus);
534e5c31af7Sopenharmony_ci	ctx.getLog() << TestLog::Message << "// GL_PROGRAM_BINARY_LENGTH = " << bufSize << TestLog::EndMessage;
535e5c31af7Sopenharmony_ci	ctx.getLog() << TestLog::Message << "// GL_LINK_STATUS = " << linkStatus << TestLog::EndMessage;
536e5c31af7Sopenharmony_ci
537e5c31af7Sopenharmony_ci	TCU_CHECK(bufSize >= 0);
538e5c31af7Sopenharmony_ci	if (bufSize > 0)
539e5c31af7Sopenharmony_ci	{
540e5c31af7Sopenharmony_ci		binaryBuf.resize(bufSize);
541e5c31af7Sopenharmony_ci		ctx.glGetProgramBinary	(srcProgram.getProgram(), bufSize, &binaryLength, &binaryFormat, &binaryBuf[0]);
542e5c31af7Sopenharmony_ci		ctx.expectError			(GL_NO_ERROR);
543e5c31af7Sopenharmony_ci
544e5c31af7Sopenharmony_ci		ctx.beginSection("GL_INVALID_OPERATION is generated if program is not the name of an existing program object.");
545e5c31af7Sopenharmony_ci		ctx.glProgramBinary		(unusedShader, binaryFormat, &binaryBuf[0], binaryLength);
546e5c31af7Sopenharmony_ci		ctx.expectError			(GL_INVALID_OPERATION);
547e5c31af7Sopenharmony_ci		ctx.endSection();
548e5c31af7Sopenharmony_ci
549e5c31af7Sopenharmony_ci		ctx.beginSection("GL_INVALID_ENUM is generated if binaryFormat is not a value recognized by the implementation.");
550e5c31af7Sopenharmony_ci		ctx.glProgramBinary		(dstProgram, -1, &binaryBuf[0], binaryLength);
551e5c31af7Sopenharmony_ci		ctx.expectError			(GL_INVALID_ENUM);
552e5c31af7Sopenharmony_ci		ctx.endSection();
553e5c31af7Sopenharmony_ci	}
554e5c31af7Sopenharmony_ci
555e5c31af7Sopenharmony_ci	ctx.glDeleteShader(unusedShader);
556e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(dstProgram);
557e5c31af7Sopenharmony_ci}
558e5c31af7Sopenharmony_ci
559e5c31af7Sopenharmony_civoid program_parameteri (NegativeTestContext& ctx)
560e5c31af7Sopenharmony_ci{
561e5c31af7Sopenharmony_ci	GLuint program	= ctx.glCreateProgram();
562e5c31af7Sopenharmony_ci	GLuint shader	= ctx.glCreateShader(GL_VERTEX_SHADER);
563e5c31af7Sopenharmony_ci
564e5c31af7Sopenharmony_ci	const GLuint notAProgram = ctx.glCreateProgram();
565e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(notAProgram);
566e5c31af7Sopenharmony_ci
567e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of an existing program object.");
568e5c31af7Sopenharmony_ci	ctx.glProgramParameteri(notAProgram, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
569e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
570e5c31af7Sopenharmony_ci	ctx.endSection();
571e5c31af7Sopenharmony_ci
572e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object.");
573e5c31af7Sopenharmony_ci	ctx.glProgramParameteri(shader, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
574e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
575e5c31af7Sopenharmony_ci	ctx.endSection();
576e5c31af7Sopenharmony_ci
577e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if pname is not GL_PROGRAM_BINARY_RETRIEVABLE_HINT or PROGRAM_SEPARABLE.");
578e5c31af7Sopenharmony_ci	ctx.glProgramParameteri(program, -1, GL_TRUE);
579e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_ENUM);
580e5c31af7Sopenharmony_ci	ctx.endSection();
581e5c31af7Sopenharmony_ci
582e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if value is not GL_FALSE or GL_TRUE.");
583e5c31af7Sopenharmony_ci	ctx.glProgramParameteri(program, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, 2);
584e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
585e5c31af7Sopenharmony_ci	ctx.endSection();
586e5c31af7Sopenharmony_ci
587e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(program);
588e5c31af7Sopenharmony_ci	ctx.glDeleteShader(shader);
589e5c31af7Sopenharmony_ci}
590e5c31af7Sopenharmony_ci
591e5c31af7Sopenharmony_civoid gen_samplers (NegativeTestContext& ctx)
592e5c31af7Sopenharmony_ci{
593e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
594e5c31af7Sopenharmony_ci	GLuint sampler = 0;
595e5c31af7Sopenharmony_ci	ctx.glGenSamplers	(-1, &sampler);
596e5c31af7Sopenharmony_ci	ctx.expectError	(GL_INVALID_VALUE);
597e5c31af7Sopenharmony_ci	ctx.endSection();
598e5c31af7Sopenharmony_ci}
599e5c31af7Sopenharmony_ci
600e5c31af7Sopenharmony_civoid bind_sampler (NegativeTestContext& ctx)
601e5c31af7Sopenharmony_ci{
602e5c31af7Sopenharmony_ci	int				maxTexImageUnits = 0x1234;
603e5c31af7Sopenharmony_ci	GLuint			sampler = 0;
604e5c31af7Sopenharmony_ci	ctx.glGetIntegerv	(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTexImageUnits);
605e5c31af7Sopenharmony_ci	ctx.glGenSamplers	(1, &sampler);
606e5c31af7Sopenharmony_ci
607e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if unit is greater than or equal to the value of GL_MAX_COMBIED_TEXTURE_IMAGE_UNITS.");
608e5c31af7Sopenharmony_ci	ctx.glBindSampler	(maxTexImageUnits, sampler);
609e5c31af7Sopenharmony_ci	ctx.expectError	(GL_INVALID_VALUE);
610e5c31af7Sopenharmony_ci	ctx.endSection();
611e5c31af7Sopenharmony_ci
612e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not zero or a name previously returned from a call to ctx.glGenSamplers.");
613e5c31af7Sopenharmony_ci	ctx.glBindSampler	(1, -1);
614e5c31af7Sopenharmony_ci	ctx.expectError	(GL_INVALID_OPERATION);
615e5c31af7Sopenharmony_ci	ctx.endSection();
616e5c31af7Sopenharmony_ci
617e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if sampler has been deleted by a call to ctx.glDeleteSamplers.");
618e5c31af7Sopenharmony_ci	ctx.glDeleteSamplers(1, &sampler);
619e5c31af7Sopenharmony_ci	ctx.glBindSampler	(1, sampler);
620e5c31af7Sopenharmony_ci	ctx.expectError	(GL_INVALID_OPERATION);
621e5c31af7Sopenharmony_ci	ctx.endSection();
622e5c31af7Sopenharmony_ci}
623e5c31af7Sopenharmony_ci
624e5c31af7Sopenharmony_civoid delete_samplers (NegativeTestContext& ctx)
625e5c31af7Sopenharmony_ci{
626e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
627e5c31af7Sopenharmony_ci	ctx.glDeleteSamplers(-1, 0);
628e5c31af7Sopenharmony_ci	ctx.expectError	(GL_INVALID_VALUE);
629e5c31af7Sopenharmony_ci	ctx.endSection();
630e5c31af7Sopenharmony_ci}
631e5c31af7Sopenharmony_ci
632e5c31af7Sopenharmony_civoid get_sampler_parameteriv (NegativeTestContext& ctx)
633e5c31af7Sopenharmony_ci{
634e5c31af7Sopenharmony_ci	int				params = 0x1234;
635e5c31af7Sopenharmony_ci	GLuint			sampler = 0;
636e5c31af7Sopenharmony_ci	ctx.glGenSamplers	(1, &sampler);
637e5c31af7Sopenharmony_ci
638e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object returned from a previous call to ctx.glGenSamplers.");
639e5c31af7Sopenharmony_ci	ctx.glGetSamplerParameteriv	(-1, GL_TEXTURE_MAG_FILTER, &params);
640e5c31af7Sopenharmony_ci	ctx.expectError			(GL_INVALID_OPERATION);
641e5c31af7Sopenharmony_ci	ctx.endSection();
642e5c31af7Sopenharmony_ci
643e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
644e5c31af7Sopenharmony_ci	ctx.glGetSamplerParameteriv	(sampler, -1, &params);
645e5c31af7Sopenharmony_ci	ctx.expectError			(GL_INVALID_ENUM);
646e5c31af7Sopenharmony_ci	ctx.endSection();
647e5c31af7Sopenharmony_ci
648e5c31af7Sopenharmony_ci	ctx.glDeleteSamplers(1, &sampler);
649e5c31af7Sopenharmony_ci}
650e5c31af7Sopenharmony_ci
651e5c31af7Sopenharmony_civoid get_sampler_parameterfv (NegativeTestContext& ctx)
652e5c31af7Sopenharmony_ci{
653e5c31af7Sopenharmony_ci	float				params	= 0.0f;
654e5c31af7Sopenharmony_ci	GLuint				sampler = 0;
655e5c31af7Sopenharmony_ci	ctx.glGenSamplers	(1, &sampler);
656e5c31af7Sopenharmony_ci
657e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object returned from a previous call to ctx.glGenSamplers.");
658e5c31af7Sopenharmony_ci	ctx.glGetSamplerParameterfv	(-1, GL_TEXTURE_MAG_FILTER, &params);
659e5c31af7Sopenharmony_ci	ctx.expectError			(GL_INVALID_OPERATION);
660e5c31af7Sopenharmony_ci	ctx.endSection();
661e5c31af7Sopenharmony_ci
662e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
663e5c31af7Sopenharmony_ci	ctx.glGetSamplerParameterfv	(sampler, -1, &params);
664e5c31af7Sopenharmony_ci	ctx.expectError			(GL_INVALID_ENUM);
665e5c31af7Sopenharmony_ci	ctx.endSection();
666e5c31af7Sopenharmony_ci
667e5c31af7Sopenharmony_ci	ctx.glDeleteSamplers(1, &sampler);
668e5c31af7Sopenharmony_ci}
669e5c31af7Sopenharmony_ci
670e5c31af7Sopenharmony_civoid get_sampler_parameterIiv (NegativeTestContext& ctx)
671e5c31af7Sopenharmony_ci{
672e5c31af7Sopenharmony_ci	if (!supportsES32orGL45(ctx))
673e5c31af7Sopenharmony_ci		throw tcu::NotSupportedError("glGetSamplerParameterIiv is not supported.", DE_NULL, __FILE__, __LINE__);
674e5c31af7Sopenharmony_ci
675e5c31af7Sopenharmony_ci	GLuint	sampler			= 0x1234;
676e5c31af7Sopenharmony_ci	GLint	borderColor[]	= { 0x1234, 0x4123, 0x3412, 0x2341 };
677e5c31af7Sopenharmony_ci
678e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object returned from a previous call to ctx.glGenSamplers.");
679e5c31af7Sopenharmony_ci	ctx.glGetSamplerParameterIiv(sampler, GL_TEXTURE_BORDER_COLOR, &borderColor[0]);
680e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
681e5c31af7Sopenharmony_ci	ctx.endSection();
682e5c31af7Sopenharmony_ci
683e5c31af7Sopenharmony_ci	ctx.glGenSamplers(1, &sampler);
684e5c31af7Sopenharmony_ci
685e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
686e5c31af7Sopenharmony_ci	ctx.glGetSamplerParameterIiv(sampler, -1, &borderColor[0]);
687e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_ENUM);
688e5c31af7Sopenharmony_ci	ctx.endSection();
689e5c31af7Sopenharmony_ci
690e5c31af7Sopenharmony_ci	ctx.glDeleteSamplers(1, &sampler);
691e5c31af7Sopenharmony_ci}
692e5c31af7Sopenharmony_ci
693e5c31af7Sopenharmony_civoid get_sampler_parameterIuiv (NegativeTestContext& ctx)
694e5c31af7Sopenharmony_ci{
695e5c31af7Sopenharmony_ci	if (!supportsES32orGL45(ctx))
696e5c31af7Sopenharmony_ci		throw tcu::NotSupportedError("glGetSamplerParameterIuiv is not supported.", DE_NULL, __FILE__, __LINE__);
697e5c31af7Sopenharmony_ci
698e5c31af7Sopenharmony_ci	GLuint	sampler			= 0x1234;
699e5c31af7Sopenharmony_ci	GLuint	borderColor[]	= { 0x1234, 0x4123, 0x3412, 0x2341 };
700e5c31af7Sopenharmony_ci
701e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object returned from a previous call to ctx.glGenSamplers.");
702e5c31af7Sopenharmony_ci	ctx.glGetSamplerParameterIuiv(sampler, GL_TEXTURE_BORDER_COLOR, &borderColor[0]);
703e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
704e5c31af7Sopenharmony_ci	ctx.endSection();
705e5c31af7Sopenharmony_ci
706e5c31af7Sopenharmony_ci	ctx.glGenSamplers(1, &sampler);
707e5c31af7Sopenharmony_ci
708e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
709e5c31af7Sopenharmony_ci	ctx.glGetSamplerParameterIuiv(sampler, -1, &borderColor[0]);
710e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_ENUM);
711e5c31af7Sopenharmony_ci	ctx.endSection();
712e5c31af7Sopenharmony_ci
713e5c31af7Sopenharmony_ci	ctx.glDeleteSamplers(1, &sampler);
714e5c31af7Sopenharmony_ci}
715e5c31af7Sopenharmony_ci
716e5c31af7Sopenharmony_civoid sampler_parameteri (NegativeTestContext& ctx)
717e5c31af7Sopenharmony_ci{
718e5c31af7Sopenharmony_ci	GLuint sampler = 0;
719e5c31af7Sopenharmony_ci
720e5c31af7Sopenharmony_ci	ctx.glGenSamplers(1, &sampler);
721e5c31af7Sopenharmony_ci
722e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object previously returned from a call to ctx.glGenSamplers.");
723e5c31af7Sopenharmony_ci	ctx.glSamplerParameteri(-1, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
724e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
725e5c31af7Sopenharmony_ci	ctx.endSection();
726e5c31af7Sopenharmony_ci
727e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.");
728e5c31af7Sopenharmony_ci	ctx.glSamplerParameteri(sampler, GL_TEXTURE_WRAP_S, -1);
729e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_ENUM);
730e5c31af7Sopenharmony_ci	ctx.endSection();
731e5c31af7Sopenharmony_ci
732e5c31af7Sopenharmony_ci	if (supportsES32orGL45(ctx))
733e5c31af7Sopenharmony_ci	{
734e5c31af7Sopenharmony_ci		ctx.beginSection("GL_INVALID_ENUM is generated if glSamplerParameteri is called for a non-scalar parameter.");
735e5c31af7Sopenharmony_ci		ctx.glSamplerParameteri(sampler, GL_TEXTURE_BORDER_COLOR, 0);
736e5c31af7Sopenharmony_ci		ctx.expectError(GL_INVALID_ENUM);
737e5c31af7Sopenharmony_ci		ctx.endSection();
738e5c31af7Sopenharmony_ci	}
739e5c31af7Sopenharmony_ci
740e5c31af7Sopenharmony_ci	ctx.glDeleteSamplers(1, &sampler);
741e5c31af7Sopenharmony_ci}
742e5c31af7Sopenharmony_ci
743e5c31af7Sopenharmony_civoid sampler_parameteriv (NegativeTestContext& ctx)
744e5c31af7Sopenharmony_ci{
745e5c31af7Sopenharmony_ci	int				params = 0x1234;
746e5c31af7Sopenharmony_ci	GLuint			sampler = 0;
747e5c31af7Sopenharmony_ci	ctx.glGenSamplers	(1, &sampler);
748e5c31af7Sopenharmony_ci
749e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object previously returned from a call to ctx.glGenSamplers.");
750e5c31af7Sopenharmony_ci	params = GL_CLAMP_TO_EDGE;
751e5c31af7Sopenharmony_ci	ctx.glSamplerParameteriv	(-1, GL_TEXTURE_WRAP_S, &params);
752e5c31af7Sopenharmony_ci	ctx.expectError			(GL_INVALID_OPERATION);
753e5c31af7Sopenharmony_ci	ctx.endSection();
754e5c31af7Sopenharmony_ci
755e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.");
756e5c31af7Sopenharmony_ci	params = -1;
757e5c31af7Sopenharmony_ci	ctx.glSamplerParameteriv	(sampler, GL_TEXTURE_WRAP_S, &params);
758e5c31af7Sopenharmony_ci	ctx.expectError			(GL_INVALID_ENUM);
759e5c31af7Sopenharmony_ci	ctx.endSection();
760e5c31af7Sopenharmony_ci
761e5c31af7Sopenharmony_ci	ctx.glDeleteSamplers(1, &sampler);
762e5c31af7Sopenharmony_ci}
763e5c31af7Sopenharmony_ci
764e5c31af7Sopenharmony_civoid sampler_parameterf (NegativeTestContext& ctx)
765e5c31af7Sopenharmony_ci{
766e5c31af7Sopenharmony_ci	GLuint sampler = 0;
767e5c31af7Sopenharmony_ci
768e5c31af7Sopenharmony_ci	ctx.glGenSamplers(1, &sampler);
769e5c31af7Sopenharmony_ci
770e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object previously returned from a call to ctx.glGenSamplers.");
771e5c31af7Sopenharmony_ci	ctx.glSamplerParameterf(-1, GL_TEXTURE_MIN_LOD, -1000.0f);
772e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
773e5c31af7Sopenharmony_ci	ctx.endSection();
774e5c31af7Sopenharmony_ci
775e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.");
776e5c31af7Sopenharmony_ci	ctx.glSamplerParameterf(sampler, GL_TEXTURE_WRAP_S, -1.0f);
777e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_ENUM);
778e5c31af7Sopenharmony_ci	ctx.endSection();
779e5c31af7Sopenharmony_ci
780e5c31af7Sopenharmony_ci	if (supportsES32orGL45(ctx))
781e5c31af7Sopenharmony_ci	{
782e5c31af7Sopenharmony_ci		ctx.beginSection("GL_INVALID_ENUM is generated if glSamplerParameterf is called for a non-scalar parameter.");
783e5c31af7Sopenharmony_ci		ctx.glSamplerParameteri(sampler, GL_TEXTURE_BORDER_COLOR, 0);
784e5c31af7Sopenharmony_ci		ctx.expectError(GL_INVALID_ENUM);
785e5c31af7Sopenharmony_ci		ctx.endSection();
786e5c31af7Sopenharmony_ci	}
787e5c31af7Sopenharmony_ci
788e5c31af7Sopenharmony_ci	ctx.glDeleteSamplers(1, &sampler);
789e5c31af7Sopenharmony_ci}
790e5c31af7Sopenharmony_ci
791e5c31af7Sopenharmony_civoid sampler_parameterfv (NegativeTestContext& ctx)
792e5c31af7Sopenharmony_ci{
793e5c31af7Sopenharmony_ci	float			params;
794e5c31af7Sopenharmony_ci	GLuint			sampler = 0;
795e5c31af7Sopenharmony_ci	ctx.glGenSamplers	(1, &sampler);
796e5c31af7Sopenharmony_ci
797e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object previously returned from a call to ctx.glGenSamplers.");
798e5c31af7Sopenharmony_ci	params = -1000.0f;
799e5c31af7Sopenharmony_ci	ctx.glSamplerParameterfv	(-1, GL_TEXTURE_WRAP_S, &params);
800e5c31af7Sopenharmony_ci	ctx.expectError			(GL_INVALID_OPERATION);
801e5c31af7Sopenharmony_ci	ctx.endSection();
802e5c31af7Sopenharmony_ci
803e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if params should have a defined constant value (based on the value of pname) and does not.");
804e5c31af7Sopenharmony_ci	params = -1.0f;
805e5c31af7Sopenharmony_ci	ctx.glSamplerParameterfv	(sampler, GL_TEXTURE_WRAP_S, &params);
806e5c31af7Sopenharmony_ci	ctx.expectError			(GL_INVALID_ENUM);
807e5c31af7Sopenharmony_ci	ctx.endSection();
808e5c31af7Sopenharmony_ci
809e5c31af7Sopenharmony_ci	ctx.glDeleteSamplers(1, &sampler);
810e5c31af7Sopenharmony_ci}
811e5c31af7Sopenharmony_ci
812e5c31af7Sopenharmony_civoid sampler_parameterIiv (NegativeTestContext& ctx)
813e5c31af7Sopenharmony_ci{
814e5c31af7Sopenharmony_ci	if (!supportsES32orGL45(ctx))
815e5c31af7Sopenharmony_ci		throw tcu::NotSupportedError("glSamplerParameterIiv is not supported.", DE_NULL, __FILE__, __LINE__);
816e5c31af7Sopenharmony_ci
817e5c31af7Sopenharmony_ci	GLuint	sampler;
818e5c31af7Sopenharmony_ci	GLint	color[]	= {0, 0, 0, 0};
819e5c31af7Sopenharmony_ci
820e5c31af7Sopenharmony_ci	ctx.glGenSamplers(1, &sampler);
821e5c31af7Sopenharmony_ci
822e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object previously returned from a call to ctx.glGenSamplers.");
823e5c31af7Sopenharmony_ci	ctx.glSamplerParameterIiv(-1, GL_TEXTURE_BORDER_COLOR, color);
824e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
825e5c31af7Sopenharmony_ci	ctx.endSection();
826e5c31af7Sopenharmony_ci
827e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted sampler state name.");
828e5c31af7Sopenharmony_ci	ctx.glSamplerParameterIiv(sampler, -1, color);
829e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_ENUM);
830e5c31af7Sopenharmony_ci	ctx.endSection();
831e5c31af7Sopenharmony_ci}
832e5c31af7Sopenharmony_ci
833e5c31af7Sopenharmony_civoid sampler_parameterIuiv (NegativeTestContext& ctx)
834e5c31af7Sopenharmony_ci{
835e5c31af7Sopenharmony_ci	if (!supportsES32orGL45(ctx))
836e5c31af7Sopenharmony_ci		throw tcu::NotSupportedError("glSamplerParameterIuiv is not supported.", DE_NULL, __FILE__, __LINE__);
837e5c31af7Sopenharmony_ci
838e5c31af7Sopenharmony_ci	GLuint	sampler;
839e5c31af7Sopenharmony_ci	GLuint	color[]	= {0, 0, 0, 0};
840e5c31af7Sopenharmony_ci
841e5c31af7Sopenharmony_ci	ctx.glGenSamplers(1, &sampler);
842e5c31af7Sopenharmony_ci
843e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object previously returned from a call to ctx.glGenSamplers.");
844e5c31af7Sopenharmony_ci	ctx.glSamplerParameterIuiv(-1, GL_TEXTURE_BORDER_COLOR, color);
845e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
846e5c31af7Sopenharmony_ci	ctx.endSection();
847e5c31af7Sopenharmony_ci
848e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted sampler state name.");
849e5c31af7Sopenharmony_ci	ctx.glSamplerParameterIuiv(sampler, -1, color);
850e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_ENUM);
851e5c31af7Sopenharmony_ci	ctx.endSection();
852e5c31af7Sopenharmony_ci}
853e5c31af7Sopenharmony_ci
854e5c31af7Sopenharmony_ci// Shader data commands
855e5c31af7Sopenharmony_ci
856e5c31af7Sopenharmony_civoid get_attrib_location (NegativeTestContext& ctx)
857e5c31af7Sopenharmony_ci{
858e5c31af7Sopenharmony_ci	GLuint programEmpty		= ctx.glCreateProgram();
859e5c31af7Sopenharmony_ci	GLuint shader			= ctx.glCreateShader(GL_VERTEX_SHADER);
860e5c31af7Sopenharmony_ci
861e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
862e5c31af7Sopenharmony_ci
863e5c31af7Sopenharmony_ci	const GLuint notAProgram = ctx.glCreateProgram();
864e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(notAProgram);
865e5c31af7Sopenharmony_ci
866e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
867e5c31af7Sopenharmony_ci	ctx.glBindAttribLocation		(programEmpty, 0, "test");
868e5c31af7Sopenharmony_ci	ctx.glGetAttribLocation			(programEmpty, "test");
869e5c31af7Sopenharmony_ci	ctx.expectError				(GL_INVALID_OPERATION);
870e5c31af7Sopenharmony_ci	ctx.endSection();
871e5c31af7Sopenharmony_ci
872e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if program is not a program or shader object.");
873e5c31af7Sopenharmony_ci	ctx.glUseProgram				(program.getProgram());
874e5c31af7Sopenharmony_ci	ctx.glBindAttribLocation		(program.getProgram(), 0, "test");
875e5c31af7Sopenharmony_ci	ctx.expectError				(GL_NO_ERROR);
876e5c31af7Sopenharmony_ci	ctx.glGetAttribLocation			(program.getProgram(), "test");
877e5c31af7Sopenharmony_ci	ctx.expectError				(GL_NO_ERROR);
878e5c31af7Sopenharmony_ci	ctx.glGetAttribLocation			(notAProgram, "test");
879e5c31af7Sopenharmony_ci	ctx.expectError				(GL_INVALID_VALUE);
880e5c31af7Sopenharmony_ci	ctx.endSection();
881e5c31af7Sopenharmony_ci
882e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
883e5c31af7Sopenharmony_ci	ctx.glGetAttribLocation			(shader, "test");
884e5c31af7Sopenharmony_ci	ctx.expectError				(GL_INVALID_OPERATION);
885e5c31af7Sopenharmony_ci	ctx.endSection();
886e5c31af7Sopenharmony_ci
887e5c31af7Sopenharmony_ci	ctx.glUseProgram				(0);
888e5c31af7Sopenharmony_ci	ctx.glDeleteShader				(shader);
889e5c31af7Sopenharmony_ci	ctx.glDeleteProgram				(programEmpty);
890e5c31af7Sopenharmony_ci}
891e5c31af7Sopenharmony_ci
892e5c31af7Sopenharmony_civoid get_uniform_location (NegativeTestContext& ctx)
893e5c31af7Sopenharmony_ci{
894e5c31af7Sopenharmony_ci	GLuint programEmpty = ctx.glCreateProgram();
895e5c31af7Sopenharmony_ci	GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
896e5c31af7Sopenharmony_ci
897e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
898e5c31af7Sopenharmony_ci
899e5c31af7Sopenharmony_ci	const GLuint notAProgram = ctx.glCreateProgram();
900e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(notAProgram);
901e5c31af7Sopenharmony_ci
902e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
903e5c31af7Sopenharmony_ci	ctx.glGetUniformLocation(programEmpty, "test");
904e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
905e5c31af7Sopenharmony_ci	ctx.endSection();
906e5c31af7Sopenharmony_ci
907e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
908e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
909e5c31af7Sopenharmony_ci	ctx.glGetUniformLocation(notAProgram, "test");
910e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
911e5c31af7Sopenharmony_ci	ctx.endSection();
912e5c31af7Sopenharmony_ci
913e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
914e5c31af7Sopenharmony_ci	ctx.glGetAttribLocation(shader, "test");
915e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
916e5c31af7Sopenharmony_ci	ctx.endSection();
917e5c31af7Sopenharmony_ci
918e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
919e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(programEmpty);
920e5c31af7Sopenharmony_ci	ctx.glDeleteShader(shader);
921e5c31af7Sopenharmony_ci}
922e5c31af7Sopenharmony_ci
923e5c31af7Sopenharmony_civoid bind_attrib_location (NegativeTestContext& ctx)
924e5c31af7Sopenharmony_ci{
925e5c31af7Sopenharmony_ci	GLuint program = ctx.glCreateProgram();
926e5c31af7Sopenharmony_ci	GLuint maxIndex = ctx.getInteger(GL_MAX_VERTEX_ATTRIBS);
927e5c31af7Sopenharmony_ci	GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
928e5c31af7Sopenharmony_ci
929e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
930e5c31af7Sopenharmony_ci	ctx.glBindAttribLocation(program, maxIndex, "test");
931e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
932e5c31af7Sopenharmony_ci	ctx.endSection();
933e5c31af7Sopenharmony_ci
934e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if name starts with the reserved prefix \"gl_\".");
935e5c31af7Sopenharmony_ci	ctx.glBindAttribLocation(program, maxIndex-1, "gl_test");
936e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
937e5c31af7Sopenharmony_ci	ctx.endSection();
938e5c31af7Sopenharmony_ci
939e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
940e5c31af7Sopenharmony_ci	ctx.glBindAttribLocation(-1, maxIndex-1, "test");
941e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
942e5c31af7Sopenharmony_ci	ctx.endSection();
943e5c31af7Sopenharmony_ci
944e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
945e5c31af7Sopenharmony_ci	ctx.glBindAttribLocation(shader, maxIndex-1, "test");
946e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
947e5c31af7Sopenharmony_ci	ctx.endSection();
948e5c31af7Sopenharmony_ci
949e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(program);
950e5c31af7Sopenharmony_ci	ctx.glDeleteShader(shader);
951e5c31af7Sopenharmony_ci}
952e5c31af7Sopenharmony_ci
953e5c31af7Sopenharmony_civoid uniform_block_binding (NegativeTestContext& ctx)
954e5c31af7Sopenharmony_ci{
955e5c31af7Sopenharmony_ci	GLint				maxUniformBufferBindings	= -1;
956e5c31af7Sopenharmony_ci	GLint				numActiveUniforms			= -1;
957e5c31af7Sopenharmony_ci	GLint				numActiveBlocks				= -1;
958e5c31af7Sopenharmony_ci	GLuint				shader						= -1;
959e5c31af7Sopenharmony_ci	glu::ShaderProgram	program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformBlockVertSource, uniformTestFragSource));
960e5c31af7Sopenharmony_ci
961e5c31af7Sopenharmony_ci	shader = ctx.glCreateShader(GL_VERTEX_SHADER);
962e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
963e5c31af7Sopenharmony_ci
964e5c31af7Sopenharmony_ci	ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUniformBufferBindings);
965e5c31af7Sopenharmony_ci	ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_UNIFORMS, &numActiveUniforms);
966e5c31af7Sopenharmony_ci	ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_UNIFORM_BLOCKS, &numActiveBlocks);
967e5c31af7Sopenharmony_ci	ctx.getLog() << TestLog::Message << "// GL_MAX_UNIFORM_BUFFER_BINDINGS = " << maxUniformBufferBindings << TestLog::EndMessage;
968e5c31af7Sopenharmony_ci	ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORMS = "				<< numActiveUniforms		<< TestLog::EndMessage;
969e5c31af7Sopenharmony_ci	ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORM_BLOCKS = "		<< numActiveBlocks			<< TestLog::EndMessage;
970e5c31af7Sopenharmony_ci	ctx.expectError	(GL_NO_ERROR);
971e5c31af7Sopenharmony_ci
972e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if uniformBlockIndex is not an active uniform block index of program.");
973e5c31af7Sopenharmony_ci	ctx.glUniformBlockBinding(program.getProgram(), -1, 0);
974e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
975e5c31af7Sopenharmony_ci	ctx.glUniformBlockBinding(program.getProgram(), 5, 0);
976e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
977e5c31af7Sopenharmony_ci	ctx.endSection();
978e5c31af7Sopenharmony_ci
979e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if uniformBlockBinding is greater than or equal to the value of GL_MAX_UNIFORM_BUFFER_BINDINGS.");
980e5c31af7Sopenharmony_ci	ctx.glUniformBlockBinding(program.getProgram(), maxUniformBufferBindings, 0);
981e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
982e5c31af7Sopenharmony_ci	ctx.endSection();
983e5c31af7Sopenharmony_ci
984e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of a program object generated by the GL.");
985e5c31af7Sopenharmony_ci	ctx.glUniformBlockBinding(-1, 0, 0);
986e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
987e5c31af7Sopenharmony_ci	ctx.endSection();
988e5c31af7Sopenharmony_ci
989e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object.");
990e5c31af7Sopenharmony_ci	ctx.glUniformBlockBinding(shader, 0, 0);
991e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
992e5c31af7Sopenharmony_ci	ctx.endSection();
993e5c31af7Sopenharmony_ci
994e5c31af7Sopenharmony_ci	ctx.glDeleteShader(shader);
995e5c31af7Sopenharmony_ci}
996e5c31af7Sopenharmony_ci
997e5c31af7Sopenharmony_ci// ctx.glUniform*f
998e5c31af7Sopenharmony_ci
999e5c31af7Sopenharmony_civoid uniformf_invalid_program (NegativeTestContext& ctx)
1000e5c31af7Sopenharmony_ci{
1001e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1002e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1003e5c31af7Sopenharmony_ci	ctx.glUniform1f(-1, 0.0f);
1004e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1005e5c31af7Sopenharmony_ci	ctx.glUniform2f(-1, 0.0f, 0.0f);
1006e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1007e5c31af7Sopenharmony_ci	ctx.glUniform3f(-1, 0.0f, 0.0f, 0.0f);
1008e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1009e5c31af7Sopenharmony_ci	ctx.glUniform4f(-1, 0.0f, 0.0f, 0.0f, 0.0f);
1010e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1011e5c31af7Sopenharmony_ci	ctx.endSection();
1012e5c31af7Sopenharmony_ci}
1013e5c31af7Sopenharmony_ci
1014e5c31af7Sopenharmony_civoid uniformf_incompatible_type (NegativeTestContext& ctx)
1015e5c31af7Sopenharmony_ci{
1016e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1017e5c31af7Sopenharmony_ci
1018e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1019e5c31af7Sopenharmony_ci	GLint vec4_v	= ctx.glGetUniformLocation(program.getProgram(), "vec4_v");	// vec4
1020e5c31af7Sopenharmony_ci	GLint ivec4_f	= ctx.glGetUniformLocation(program.getProgram(), "ivec4_f");	// ivec4
1021e5c31af7Sopenharmony_ci	GLint uvec4_f	= ctx.glGetUniformLocation(program.getProgram(), "uvec4_f");	// uvec4
1022e5c31af7Sopenharmony_ci	GLint sampler_f	= ctx.glGetUniformLocation(program.getProgram(), "sampler_f");	// sampler2D
1023e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1024e5c31af7Sopenharmony_ci
1025e5c31af7Sopenharmony_ci	if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1026e5c31af7Sopenharmony_ci	{
1027e5c31af7Sopenharmony_ci		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1028e5c31af7Sopenharmony_ci		ctx.fail("Failed to retrieve uniform location");
1029e5c31af7Sopenharmony_ci	}
1030e5c31af7Sopenharmony_ci
1031e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the ctx.glUniform command.");
1032e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1033e5c31af7Sopenharmony_ci	ctx.glUniform1f(vec4_v, 0.0f);
1034e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1035e5c31af7Sopenharmony_ci	ctx.glUniform2f(vec4_v, 0.0f, 0.0f);
1036e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1037e5c31af7Sopenharmony_ci	ctx.glUniform3f(vec4_v, 0.0f, 0.0f, 0.0f);
1038e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1039e5c31af7Sopenharmony_ci	ctx.glUniform4f(vec4_v, 0.0f, 0.0f, 0.0f, 0.0f);
1040e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1041e5c31af7Sopenharmony_ci	ctx.endSection();
1042e5c31af7Sopenharmony_ci
1043e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}f is used to load a uniform variable of type int, ivec2, ivec3, ivec4, unsigned int, uvec2, uvec3, uvec4.");
1044e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1045e5c31af7Sopenharmony_ci	ctx.glUniform4f(ivec4_f, 0.0f, 0.0f, 0.0f, 0.0f);
1046e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1047e5c31af7Sopenharmony_ci	ctx.glUniform4f(uvec4_f, 0.0f, 0.0f, 0.0f, 0.0f);
1048e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1049e5c31af7Sopenharmony_ci	ctx.endSection();
1050e5c31af7Sopenharmony_ci
1051e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than ctx.glUniform1i and ctx.glUniform1iv.");
1052e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1053e5c31af7Sopenharmony_ci	ctx.glUniform1f(sampler_f, 0.0f);
1054e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1055e5c31af7Sopenharmony_ci	ctx.endSection();
1056e5c31af7Sopenharmony_ci
1057e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1058e5c31af7Sopenharmony_ci}
1059e5c31af7Sopenharmony_ci
1060e5c31af7Sopenharmony_civoid uniformf_invalid_location (NegativeTestContext& ctx)
1061e5c31af7Sopenharmony_ci{
1062e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1063e5c31af7Sopenharmony_ci
1064e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1065e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1066e5c31af7Sopenharmony_ci
1067e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1068e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1069e5c31af7Sopenharmony_ci	ctx.glUniform1f(-2, 0.0f);
1070e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1071e5c31af7Sopenharmony_ci	ctx.glUniform2f(-2, 0.0f, 0.0f);
1072e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1073e5c31af7Sopenharmony_ci	ctx.glUniform3f(-2, 0.0f, 0.0f, 0.0f);
1074e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1075e5c31af7Sopenharmony_ci	ctx.glUniform4f(-2, 0.0f, 0.0f, 0.0f, 0.0f);
1076e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1077e5c31af7Sopenharmony_ci
1078e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1079e5c31af7Sopenharmony_ci	ctx.glUniform1f(-1, 0.0f);
1080e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1081e5c31af7Sopenharmony_ci	ctx.glUniform2f(-1, 0.0f, 0.0f);
1082e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1083e5c31af7Sopenharmony_ci	ctx.glUniform3f(-1, 0.0f, 0.0f, 0.0f);
1084e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1085e5c31af7Sopenharmony_ci	ctx.glUniform4f(-1, 0.0f, 0.0f, 0.0f, 0.0f);
1086e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1087e5c31af7Sopenharmony_ci	ctx.endSection();
1088e5c31af7Sopenharmony_ci
1089e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1090e5c31af7Sopenharmony_ci}
1091e5c31af7Sopenharmony_ci
1092e5c31af7Sopenharmony_ci// ctx.glUniform*fv
1093e5c31af7Sopenharmony_ci
1094e5c31af7Sopenharmony_civoid uniformfv_invalid_program (NegativeTestContext& ctx)
1095e5c31af7Sopenharmony_ci{
1096e5c31af7Sopenharmony_ci	std::vector<GLfloat> data(4);
1097e5c31af7Sopenharmony_ci
1098e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1099e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1100e5c31af7Sopenharmony_ci	ctx.glUniform1fv(-1, 1, &data[0]);
1101e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1102e5c31af7Sopenharmony_ci	ctx.glUniform2fv(-1, 1, &data[0]);
1103e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1104e5c31af7Sopenharmony_ci	ctx.glUniform3fv(-1, 1, &data[0]);
1105e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1106e5c31af7Sopenharmony_ci	ctx.glUniform4fv(-1, 1, &data[0]);
1107e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1108e5c31af7Sopenharmony_ci	ctx.endSection();
1109e5c31af7Sopenharmony_ci}
1110e5c31af7Sopenharmony_ci
1111e5c31af7Sopenharmony_civoid uniformfv_incompatible_type (NegativeTestContext& ctx)
1112e5c31af7Sopenharmony_ci{
1113e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1114e5c31af7Sopenharmony_ci
1115e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1116e5c31af7Sopenharmony_ci	GLint vec4_v	= ctx.glGetUniformLocation(program.getProgram(), "vec4_v");	// vec4
1117e5c31af7Sopenharmony_ci	GLint ivec4_f	= ctx.glGetUniformLocation(program.getProgram(), "ivec4_f");	// ivec4
1118e5c31af7Sopenharmony_ci	GLint uvec4_f	= ctx.glGetUniformLocation(program.getProgram(), "uvec4_f");	// uvec4
1119e5c31af7Sopenharmony_ci	GLint sampler_f	= ctx.glGetUniformLocation(program.getProgram(), "sampler_f");	// sampler2D
1120e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1121e5c31af7Sopenharmony_ci
1122e5c31af7Sopenharmony_ci	if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1123e5c31af7Sopenharmony_ci	{
1124e5c31af7Sopenharmony_ci		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1125e5c31af7Sopenharmony_ci		ctx.fail("Failed to retrieve uniform location");
1126e5c31af7Sopenharmony_ci	}
1127e5c31af7Sopenharmony_ci
1128e5c31af7Sopenharmony_ci	std::vector<GLfloat> data(4);
1129e5c31af7Sopenharmony_ci
1130e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the ctx.glUniform command.");
1131e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1132e5c31af7Sopenharmony_ci	ctx.glUniform1fv(vec4_v, 1, &data[0]);
1133e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1134e5c31af7Sopenharmony_ci	ctx.glUniform2fv(vec4_v, 1, &data[0]);
1135e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1136e5c31af7Sopenharmony_ci	ctx.glUniform3fv(vec4_v, 1, &data[0]);
1137e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1138e5c31af7Sopenharmony_ci	ctx.glUniform4fv(vec4_v, 1, &data[0]);
1139e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1140e5c31af7Sopenharmony_ci	ctx.endSection();
1141e5c31af7Sopenharmony_ci
1142e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}fv is used to load a uniform variable of type int, ivec2, ivec3, ivec4, unsigned int, uvec2, uvec3, uvec4.");
1143e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1144e5c31af7Sopenharmony_ci	ctx.glUniform4fv(ivec4_f, 1, &data[0]);
1145e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1146e5c31af7Sopenharmony_ci	ctx.glUniform4fv(uvec4_f, 1, &data[0]);
1147e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1148e5c31af7Sopenharmony_ci	ctx.endSection();
1149e5c31af7Sopenharmony_ci
1150e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than ctx.glUniform1i and ctx.glUniform1iv.");
1151e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1152e5c31af7Sopenharmony_ci	ctx.glUniform1fv(sampler_f, 1, &data[0]);
1153e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1154e5c31af7Sopenharmony_ci	ctx.endSection();
1155e5c31af7Sopenharmony_ci
1156e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1157e5c31af7Sopenharmony_ci}
1158e5c31af7Sopenharmony_ci
1159e5c31af7Sopenharmony_civoid uniformfv_invalid_location (NegativeTestContext& ctx)
1160e5c31af7Sopenharmony_ci{
1161e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1162e5c31af7Sopenharmony_ci
1163e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1164e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1165e5c31af7Sopenharmony_ci
1166e5c31af7Sopenharmony_ci	std::vector<GLfloat> data(4);
1167e5c31af7Sopenharmony_ci
1168e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1169e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1170e5c31af7Sopenharmony_ci	ctx.glUniform1fv(-2, 1, &data[0]);
1171e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1172e5c31af7Sopenharmony_ci	ctx.glUniform2fv(-2, 1, &data[0]);
1173e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1174e5c31af7Sopenharmony_ci	ctx.glUniform3fv(-2, 1, &data[0]);
1175e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1176e5c31af7Sopenharmony_ci	ctx.glUniform4fv(-2, 1, &data[0]);
1177e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1178e5c31af7Sopenharmony_ci
1179e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1180e5c31af7Sopenharmony_ci	ctx.glUniform1fv(-1, 1, &data[0]);
1181e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1182e5c31af7Sopenharmony_ci	ctx.glUniform2fv(-1, 1, &data[0]);
1183e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1184e5c31af7Sopenharmony_ci	ctx.glUniform3fv(-1, 1, &data[0]);
1185e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1186e5c31af7Sopenharmony_ci	ctx.glUniform4fv(-1, 1, &data[0]);
1187e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1188e5c31af7Sopenharmony_ci	ctx.endSection();
1189e5c31af7Sopenharmony_ci
1190e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1191e5c31af7Sopenharmony_ci}
1192e5c31af7Sopenharmony_ci
1193e5c31af7Sopenharmony_civoid uniformfv_invalid_count (NegativeTestContext& ctx)
1194e5c31af7Sopenharmony_ci{
1195e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1196e5c31af7Sopenharmony_ci
1197e5c31af7Sopenharmony_ci	ctx.glUseProgram	(program.getProgram());
1198e5c31af7Sopenharmony_ci	GLint vec4_v			= ctx.glGetUniformLocation(program.getProgram(), "vec4_v");	// vec4
1199e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1200e5c31af7Sopenharmony_ci
1201e5c31af7Sopenharmony_ci	if (vec4_v == -1)
1202e5c31af7Sopenharmony_ci	{
1203e5c31af7Sopenharmony_ci		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1204e5c31af7Sopenharmony_ci		ctx.fail("Failed to retrieve uniform location");
1205e5c31af7Sopenharmony_ci	}
1206e5c31af7Sopenharmony_ci
1207e5c31af7Sopenharmony_ci	std::vector<GLfloat> data(8);
1208e5c31af7Sopenharmony_ci
1209e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.");
1210e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1211e5c31af7Sopenharmony_ci	ctx.glUniform1fv(vec4_v, 2, &data[0]);
1212e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1213e5c31af7Sopenharmony_ci	ctx.glUniform2fv(vec4_v, 2, &data[0]);
1214e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1215e5c31af7Sopenharmony_ci	ctx.glUniform3fv(vec4_v, 2, &data[0]);
1216e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1217e5c31af7Sopenharmony_ci	ctx.glUniform4fv(vec4_v, 2, &data[0]);
1218e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1219e5c31af7Sopenharmony_ci	ctx.endSection();
1220e5c31af7Sopenharmony_ci
1221e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1222e5c31af7Sopenharmony_ci}
1223e5c31af7Sopenharmony_ci
1224e5c31af7Sopenharmony_ci// ctx.glUniform*i
1225e5c31af7Sopenharmony_ci
1226e5c31af7Sopenharmony_civoid uniformi_invalid_program (NegativeTestContext& ctx)
1227e5c31af7Sopenharmony_ci{
1228e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1229e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1230e5c31af7Sopenharmony_ci	ctx.glUniform1i(-1, 0);
1231e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1232e5c31af7Sopenharmony_ci	ctx.glUniform2i(-1, 0, 0);
1233e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1234e5c31af7Sopenharmony_ci	ctx.glUniform3i(-1, 0, 0, 0);
1235e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1236e5c31af7Sopenharmony_ci	ctx.glUniform4i(-1, 0, 0, 0, 0);
1237e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1238e5c31af7Sopenharmony_ci	ctx.endSection();
1239e5c31af7Sopenharmony_ci}
1240e5c31af7Sopenharmony_ci
1241e5c31af7Sopenharmony_civoid uniformi_incompatible_type (NegativeTestContext& ctx)
1242e5c31af7Sopenharmony_ci{
1243e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1244e5c31af7Sopenharmony_ci
1245e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1246e5c31af7Sopenharmony_ci	GLint vec4_v	= ctx.glGetUniformLocation(program.getProgram(), "vec4_v");	// vec4
1247e5c31af7Sopenharmony_ci	GLint ivec4_f	= ctx.glGetUniformLocation(program.getProgram(), "ivec4_f");	// ivec4
1248e5c31af7Sopenharmony_ci	GLint uvec4_f	= ctx.glGetUniformLocation(program.getProgram(), "uvec4_f");	// uvec4
1249e5c31af7Sopenharmony_ci	GLint sampler_f	= ctx.glGetUniformLocation(program.getProgram(), "sampler_f");	// sampler2D
1250e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1251e5c31af7Sopenharmony_ci
1252e5c31af7Sopenharmony_ci	if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1253e5c31af7Sopenharmony_ci	{
1254e5c31af7Sopenharmony_ci		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1255e5c31af7Sopenharmony_ci		ctx.fail("Failed to retrieve uniform location");
1256e5c31af7Sopenharmony_ci	}
1257e5c31af7Sopenharmony_ci
1258e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the ctx.glUniform command.");
1259e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1260e5c31af7Sopenharmony_ci	ctx.glUniform1i(ivec4_f, 0);
1261e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1262e5c31af7Sopenharmony_ci	ctx.glUniform2i(ivec4_f, 0, 0);
1263e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1264e5c31af7Sopenharmony_ci	ctx.glUniform3i(ivec4_f, 0, 0, 0);
1265e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1266e5c31af7Sopenharmony_ci	ctx.glUniform4i(ivec4_f, 0, 0, 0, 0);
1267e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1268e5c31af7Sopenharmony_ci	ctx.endSection();
1269e5c31af7Sopenharmony_ci
1270e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}i is used to load a uniform variable of type unsigned int, uvec2, uvec3, uvec4, or an array of these.");
1271e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1272e5c31af7Sopenharmony_ci	ctx.glUniform1i(uvec4_f, 0);
1273e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1274e5c31af7Sopenharmony_ci	ctx.glUniform2i(uvec4_f, 0, 0);
1275e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1276e5c31af7Sopenharmony_ci	ctx.glUniform3i(uvec4_f, 0, 0, 0);
1277e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1278e5c31af7Sopenharmony_ci	ctx.glUniform4i(uvec4_f, 0, 0, 0, 0);
1279e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1280e5c31af7Sopenharmony_ci	ctx.endSection();
1281e5c31af7Sopenharmony_ci
1282e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}i is used to load a uniform variable of type float, vec2, vec3, or vec4.");
1283e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1284e5c31af7Sopenharmony_ci	ctx.glUniform1i(vec4_v, 0);
1285e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1286e5c31af7Sopenharmony_ci	ctx.glUniform2i(vec4_v, 0, 0);
1287e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1288e5c31af7Sopenharmony_ci	ctx.glUniform3i(vec4_v, 0, 0, 0);
1289e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1290e5c31af7Sopenharmony_ci	ctx.glUniform4i(vec4_v, 0, 0, 0, 0);
1291e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1292e5c31af7Sopenharmony_ci	ctx.endSection();
1293e5c31af7Sopenharmony_ci
1294e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1295e5c31af7Sopenharmony_ci}
1296e5c31af7Sopenharmony_ci
1297e5c31af7Sopenharmony_civoid uniformi_invalid_location (NegativeTestContext& ctx)
1298e5c31af7Sopenharmony_ci{
1299e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1300e5c31af7Sopenharmony_ci
1301e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1302e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1303e5c31af7Sopenharmony_ci
1304e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1305e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1306e5c31af7Sopenharmony_ci	ctx.glUniform1i(-2, 0);
1307e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1308e5c31af7Sopenharmony_ci	ctx.glUniform2i(-2, 0, 0);
1309e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1310e5c31af7Sopenharmony_ci	ctx.glUniform3i(-2, 0, 0, 0);
1311e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1312e5c31af7Sopenharmony_ci	ctx.glUniform4i(-2, 0, 0, 0, 0);
1313e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1314e5c31af7Sopenharmony_ci
1315e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1316e5c31af7Sopenharmony_ci	ctx.glUniform1i(-1, 0);
1317e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1318e5c31af7Sopenharmony_ci	ctx.glUniform2i(-1, 0, 0);
1319e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1320e5c31af7Sopenharmony_ci	ctx.glUniform3i(-1, 0, 0, 0);
1321e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1322e5c31af7Sopenharmony_ci	ctx.glUniform4i(-1, 0, 0, 0, 0);
1323e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1324e5c31af7Sopenharmony_ci	ctx.endSection();
1325e5c31af7Sopenharmony_ci
1326e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1327e5c31af7Sopenharmony_ci}
1328e5c31af7Sopenharmony_ci
1329e5c31af7Sopenharmony_ci// ctx.glUniform*iv
1330e5c31af7Sopenharmony_ci
1331e5c31af7Sopenharmony_civoid uniformiv_invalid_program (NegativeTestContext& ctx)
1332e5c31af7Sopenharmony_ci{
1333e5c31af7Sopenharmony_ci	std::vector<GLint> data(4);
1334e5c31af7Sopenharmony_ci
1335e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1336e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1337e5c31af7Sopenharmony_ci	ctx.glUniform1iv(-1, 1, &data[0]);
1338e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1339e5c31af7Sopenharmony_ci	ctx.glUniform2iv(-1, 1, &data[0]);
1340e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1341e5c31af7Sopenharmony_ci	ctx.glUniform3iv(-1, 1, &data[0]);
1342e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1343e5c31af7Sopenharmony_ci	ctx.glUniform4iv(-1, 1, &data[0]);
1344e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1345e5c31af7Sopenharmony_ci	ctx.endSection();
1346e5c31af7Sopenharmony_ci}
1347e5c31af7Sopenharmony_ci
1348e5c31af7Sopenharmony_civoid uniformiv_incompatible_type (NegativeTestContext& ctx)
1349e5c31af7Sopenharmony_ci{
1350e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1351e5c31af7Sopenharmony_ci
1352e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1353e5c31af7Sopenharmony_ci	GLint vec4_v	= ctx.glGetUniformLocation(program.getProgram(), "vec4_v");	// vec4
1354e5c31af7Sopenharmony_ci	GLint ivec4_f	= ctx.glGetUniformLocation(program.getProgram(), "ivec4_f");	// ivec4
1355e5c31af7Sopenharmony_ci	GLint uvec4_f	= ctx.glGetUniformLocation(program.getProgram(), "uvec4_f");	// uvec4
1356e5c31af7Sopenharmony_ci	GLint sampler_f	= ctx.glGetUniformLocation(program.getProgram(), "sampler_f");	// sampler2D
1357e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1358e5c31af7Sopenharmony_ci
1359e5c31af7Sopenharmony_ci	if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1360e5c31af7Sopenharmony_ci	{
1361e5c31af7Sopenharmony_ci		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1362e5c31af7Sopenharmony_ci		ctx.fail("Failed to retrieve uniform location");
1363e5c31af7Sopenharmony_ci	}
1364e5c31af7Sopenharmony_ci
1365e5c31af7Sopenharmony_ci	std::vector<GLint> data(4);
1366e5c31af7Sopenharmony_ci
1367e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the ctx.glUniform command.");
1368e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1369e5c31af7Sopenharmony_ci	ctx.glUniform1iv(ivec4_f, 1, &data[0]);
1370e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1371e5c31af7Sopenharmony_ci	ctx.glUniform2iv(ivec4_f, 1, &data[0]);
1372e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1373e5c31af7Sopenharmony_ci	ctx.glUniform3iv(ivec4_f, 1, &data[0]);
1374e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1375e5c31af7Sopenharmony_ci	ctx.glUniform4iv(ivec4_f, 1, &data[0]);
1376e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1377e5c31af7Sopenharmony_ci	ctx.endSection();
1378e5c31af7Sopenharmony_ci
1379e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}iv is used to load a uniform variable of type float, vec2, vec3, or vec4.");
1380e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1381e5c31af7Sopenharmony_ci	ctx.glUniform1iv(vec4_v, 1, &data[0]);
1382e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1383e5c31af7Sopenharmony_ci	ctx.glUniform2iv(vec4_v, 1, &data[0]);
1384e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1385e5c31af7Sopenharmony_ci	ctx.glUniform3iv(vec4_v, 1, &data[0]);
1386e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1387e5c31af7Sopenharmony_ci	ctx.glUniform4iv(vec4_v, 1, &data[0]);
1388e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1389e5c31af7Sopenharmony_ci	ctx.endSection();
1390e5c31af7Sopenharmony_ci
1391e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}iv is used to load a uniform variable of type unsigned int, uvec2, uvec3 or uvec4.");
1392e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1393e5c31af7Sopenharmony_ci	ctx.glUniform1iv(uvec4_f, 1, &data[0]);
1394e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1395e5c31af7Sopenharmony_ci	ctx.glUniform2iv(uvec4_f, 1, &data[0]);
1396e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1397e5c31af7Sopenharmony_ci	ctx.glUniform3iv(uvec4_f, 1, &data[0]);
1398e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1399e5c31af7Sopenharmony_ci	ctx.glUniform4iv(uvec4_f, 1, &data[0]);
1400e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1401e5c31af7Sopenharmony_ci	ctx.endSection();
1402e5c31af7Sopenharmony_ci
1403e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1404e5c31af7Sopenharmony_ci}
1405e5c31af7Sopenharmony_ci
1406e5c31af7Sopenharmony_civoid uniformiv_invalid_location (NegativeTestContext& ctx)
1407e5c31af7Sopenharmony_ci{
1408e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1409e5c31af7Sopenharmony_ci
1410e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1411e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1412e5c31af7Sopenharmony_ci
1413e5c31af7Sopenharmony_ci	std::vector<GLint> data(4);
1414e5c31af7Sopenharmony_ci
1415e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1416e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1417e5c31af7Sopenharmony_ci	ctx.glUniform1iv(-2, 1, &data[0]);
1418e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1419e5c31af7Sopenharmony_ci	ctx.glUniform2iv(-2, 1, &data[0]);
1420e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1421e5c31af7Sopenharmony_ci	ctx.glUniform3iv(-2, 1, &data[0]);
1422e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1423e5c31af7Sopenharmony_ci	ctx.glUniform4iv(-2, 1, &data[0]);
1424e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1425e5c31af7Sopenharmony_ci
1426e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1427e5c31af7Sopenharmony_ci	ctx.glUniform1iv(-1, 1, &data[0]);
1428e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1429e5c31af7Sopenharmony_ci	ctx.glUniform2iv(-1, 1, &data[0]);
1430e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1431e5c31af7Sopenharmony_ci	ctx.glUniform3iv(-1, 1, &data[0]);
1432e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1433e5c31af7Sopenharmony_ci	ctx.glUniform4iv(-1, 1, &data[0]);
1434e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1435e5c31af7Sopenharmony_ci	ctx.endSection();
1436e5c31af7Sopenharmony_ci
1437e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1438e5c31af7Sopenharmony_ci}
1439e5c31af7Sopenharmony_ci
1440e5c31af7Sopenharmony_civoid uniformiv_invalid_count (NegativeTestContext& ctx)
1441e5c31af7Sopenharmony_ci{
1442e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1443e5c31af7Sopenharmony_ci
1444e5c31af7Sopenharmony_ci	ctx.glUseProgram			(program.getProgram());
1445e5c31af7Sopenharmony_ci	GLint ivec4_f			= ctx.glGetUniformLocation(program.getProgram(), "ivec4_f"); // ivec4
1446e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1447e5c31af7Sopenharmony_ci
1448e5c31af7Sopenharmony_ci	if (ivec4_f == -1)
1449e5c31af7Sopenharmony_ci	{
1450e5c31af7Sopenharmony_ci		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1451e5c31af7Sopenharmony_ci		ctx.fail("Failed to retrieve uniform location");
1452e5c31af7Sopenharmony_ci	}
1453e5c31af7Sopenharmony_ci
1454e5c31af7Sopenharmony_ci	std::vector<GLint> data(8);
1455e5c31af7Sopenharmony_ci
1456e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.");
1457e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1458e5c31af7Sopenharmony_ci	ctx.glUniform1iv(ivec4_f, 2, &data[0]);
1459e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1460e5c31af7Sopenharmony_ci	ctx.glUniform2iv(ivec4_f, 2, &data[0]);
1461e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1462e5c31af7Sopenharmony_ci	ctx.glUniform3iv(ivec4_f, 2, &data[0]);
1463e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1464e5c31af7Sopenharmony_ci	ctx.glUniform4iv(ivec4_f, 2, &data[0]);
1465e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1466e5c31af7Sopenharmony_ci	ctx.endSection();
1467e5c31af7Sopenharmony_ci
1468e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1469e5c31af7Sopenharmony_ci}
1470e5c31af7Sopenharmony_ci
1471e5c31af7Sopenharmony_ci// ctx.glUniform{1234}ui
1472e5c31af7Sopenharmony_ci
1473e5c31af7Sopenharmony_civoid uniformui_invalid_program (NegativeTestContext& ctx)
1474e5c31af7Sopenharmony_ci{
1475e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1476e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1477e5c31af7Sopenharmony_ci	ctx.glUniform1ui(-1, 0);
1478e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1479e5c31af7Sopenharmony_ci	ctx.glUniform2ui(-1, 0, 0);
1480e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1481e5c31af7Sopenharmony_ci	ctx.glUniform3ui(-1, 0, 0, 0);
1482e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1483e5c31af7Sopenharmony_ci	ctx.glUniform4ui(-1, 0, 0, 0, 0);
1484e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1485e5c31af7Sopenharmony_ci	ctx.endSection();
1486e5c31af7Sopenharmony_ci}
1487e5c31af7Sopenharmony_ci
1488e5c31af7Sopenharmony_civoid uniformui_incompatible_type (NegativeTestContext& ctx)
1489e5c31af7Sopenharmony_ci{
1490e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1491e5c31af7Sopenharmony_ci
1492e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1493e5c31af7Sopenharmony_ci	GLint vec4_v	= ctx.glGetUniformLocation(program.getProgram(), "vec4_v");	// vec4
1494e5c31af7Sopenharmony_ci	GLint ivec4_f	= ctx.glGetUniformLocation(program.getProgram(), "ivec4_f");	// ivec4
1495e5c31af7Sopenharmony_ci	GLint uvec4_f	= ctx.glGetUniformLocation(program.getProgram(), "uvec4_f");	// uvec4
1496e5c31af7Sopenharmony_ci	GLint sampler_f	= ctx.glGetUniformLocation(program.getProgram(), "sampler_f");	// sampler2D
1497e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1498e5c31af7Sopenharmony_ci
1499e5c31af7Sopenharmony_ci	if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1500e5c31af7Sopenharmony_ci	{
1501e5c31af7Sopenharmony_ci		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1502e5c31af7Sopenharmony_ci		ctx.fail("Failed to retrieve uniform location");
1503e5c31af7Sopenharmony_ci	}
1504e5c31af7Sopenharmony_ci
1505e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the ctx.glUniform command.");
1506e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1507e5c31af7Sopenharmony_ci	ctx.glUniform1ui(uvec4_f, 0);
1508e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1509e5c31af7Sopenharmony_ci	ctx.glUniform2ui(uvec4_f, 0, 0);
1510e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1511e5c31af7Sopenharmony_ci	ctx.glUniform3ui(uvec4_f, 0, 0, 0);
1512e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1513e5c31af7Sopenharmony_ci	ctx.glUniform4ui(uvec4_f, 0, 0, 0, 0);
1514e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1515e5c31af7Sopenharmony_ci	ctx.endSection();
1516e5c31af7Sopenharmony_ci
1517e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}i is used to load a uniform variable of type int, ivec2, ivec3, ivec4, or an array of these.");
1518e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1519e5c31af7Sopenharmony_ci	ctx.glUniform1ui(ivec4_f, 0);
1520e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1521e5c31af7Sopenharmony_ci	ctx.glUniform2ui(ivec4_f, 0, 0);
1522e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1523e5c31af7Sopenharmony_ci	ctx.glUniform3ui(ivec4_f, 0, 0, 0);
1524e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1525e5c31af7Sopenharmony_ci	ctx.glUniform4ui(ivec4_f, 0, 0, 0, 0);
1526e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1527e5c31af7Sopenharmony_ci	ctx.endSection();
1528e5c31af7Sopenharmony_ci
1529e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}i is used to load a uniform variable of type float, vec2, vec3, or vec4.");
1530e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1531e5c31af7Sopenharmony_ci	ctx.glUniform1ui(vec4_v, 0);
1532e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1533e5c31af7Sopenharmony_ci	ctx.glUniform2ui(vec4_v, 0, 0);
1534e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1535e5c31af7Sopenharmony_ci	ctx.glUniform3ui(vec4_v, 0, 0, 0);
1536e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1537e5c31af7Sopenharmony_ci	ctx.glUniform4ui(vec4_v, 0, 0, 0, 0);
1538e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1539e5c31af7Sopenharmony_ci	ctx.endSection();
1540e5c31af7Sopenharmony_ci
1541e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than ctx.glUniform1i and ctx.glUniform1iv.");
1542e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1543e5c31af7Sopenharmony_ci	ctx.glUniform1ui(sampler_f, 0);
1544e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1545e5c31af7Sopenharmony_ci	ctx.endSection();
1546e5c31af7Sopenharmony_ci
1547e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1548e5c31af7Sopenharmony_ci}
1549e5c31af7Sopenharmony_ci
1550e5c31af7Sopenharmony_civoid uniformui_invalid_location (NegativeTestContext& ctx)
1551e5c31af7Sopenharmony_ci{
1552e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1553e5c31af7Sopenharmony_ci
1554e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1555e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1556e5c31af7Sopenharmony_ci
1557e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1558e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1559e5c31af7Sopenharmony_ci	ctx.glUniform1i(-2, 0);
1560e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1561e5c31af7Sopenharmony_ci	ctx.glUniform2i(-2, 0, 0);
1562e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1563e5c31af7Sopenharmony_ci	ctx.glUniform3i(-2, 0, 0, 0);
1564e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1565e5c31af7Sopenharmony_ci	ctx.glUniform4i(-2, 0, 0, 0, 0);
1566e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1567e5c31af7Sopenharmony_ci
1568e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1569e5c31af7Sopenharmony_ci	ctx.glUniform1i(-1, 0);
1570e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1571e5c31af7Sopenharmony_ci	ctx.glUniform2i(-1, 0, 0);
1572e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1573e5c31af7Sopenharmony_ci	ctx.glUniform3i(-1, 0, 0, 0);
1574e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1575e5c31af7Sopenharmony_ci	ctx.glUniform4i(-1, 0, 0, 0, 0);
1576e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1577e5c31af7Sopenharmony_ci	ctx.endSection();
1578e5c31af7Sopenharmony_ci
1579e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1580e5c31af7Sopenharmony_ci}
1581e5c31af7Sopenharmony_ci
1582e5c31af7Sopenharmony_ci// ctx.glUniform{1234}uiv
1583e5c31af7Sopenharmony_ci
1584e5c31af7Sopenharmony_civoid uniformuiv_invalid_program (NegativeTestContext& ctx)
1585e5c31af7Sopenharmony_ci{
1586e5c31af7Sopenharmony_ci	std::vector<GLuint> data(4);
1587e5c31af7Sopenharmony_ci
1588e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1589e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1590e5c31af7Sopenharmony_ci	ctx.glUniform1uiv(-1, 1, &data[0]);
1591e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1592e5c31af7Sopenharmony_ci	ctx.glUniform2uiv(-1, 1, &data[0]);
1593e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1594e5c31af7Sopenharmony_ci	ctx.glUniform3uiv(-1, 1, &data[0]);
1595e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1596e5c31af7Sopenharmony_ci	ctx.glUniform4uiv(-1, 1, &data[0]);
1597e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1598e5c31af7Sopenharmony_ci	ctx.endSection();
1599e5c31af7Sopenharmony_ci}
1600e5c31af7Sopenharmony_ci
1601e5c31af7Sopenharmony_civoid uniformuiv_incompatible_type (NegativeTestContext& ctx)
1602e5c31af7Sopenharmony_ci{
1603e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1604e5c31af7Sopenharmony_ci
1605e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1606e5c31af7Sopenharmony_ci	GLint vec4_v	= ctx.glGetUniformLocation(program.getProgram(), "vec4_v");	// vec4
1607e5c31af7Sopenharmony_ci	GLint ivec4_f	= ctx.glGetUniformLocation(program.getProgram(), "ivec4_f");	// ivec4
1608e5c31af7Sopenharmony_ci	GLint uvec4_f	= ctx.glGetUniformLocation(program.getProgram(), "uvec4_f");	// uvec4
1609e5c31af7Sopenharmony_ci	GLint sampler_f	= ctx.glGetUniformLocation(program.getProgram(), "sampler_f");	// sampler2D
1610e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1611e5c31af7Sopenharmony_ci
1612e5c31af7Sopenharmony_ci	if (vec4_v == -1 || ivec4_f == -1 || uvec4_f == -1 || sampler_f == -1)
1613e5c31af7Sopenharmony_ci	{
1614e5c31af7Sopenharmony_ci		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1615e5c31af7Sopenharmony_ci		ctx.fail("Failed to retrieve uniform location");
1616e5c31af7Sopenharmony_ci	}
1617e5c31af7Sopenharmony_ci
1618e5c31af7Sopenharmony_ci	std::vector<GLuint> data(4);
1619e5c31af7Sopenharmony_ci
1620e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the ctx.glUniform command.");
1621e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1622e5c31af7Sopenharmony_ci	ctx.glUniform1uiv(uvec4_f, 1, &data[0]);
1623e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1624e5c31af7Sopenharmony_ci	ctx.glUniform2uiv(uvec4_f, 1, &data[0]);
1625e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1626e5c31af7Sopenharmony_ci	ctx.glUniform3uiv(uvec4_f, 1, &data[0]);
1627e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1628e5c31af7Sopenharmony_ci	ctx.glUniform4uiv(uvec4_f, 1, &data[0]);
1629e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1630e5c31af7Sopenharmony_ci	ctx.endSection();
1631e5c31af7Sopenharmony_ci
1632e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}uiv is used to load a uniform variable of type float, vec2, vec3, or vec4.");
1633e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1634e5c31af7Sopenharmony_ci	ctx.glUniform1uiv(vec4_v, 1, &data[0]);
1635e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1636e5c31af7Sopenharmony_ci	ctx.glUniform2uiv(vec4_v, 1, &data[0]);
1637e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1638e5c31af7Sopenharmony_ci	ctx.glUniform3uiv(vec4_v, 1, &data[0]);
1639e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1640e5c31af7Sopenharmony_ci	ctx.glUniform4uiv(vec4_v, 1, &data[0]);
1641e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1642e5c31af7Sopenharmony_ci	ctx.endSection();
1643e5c31af7Sopenharmony_ci
1644e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glUniform{1234}uiv is used to load a uniform variable of type int, ivec2, ivec3 or ivec4.");
1645e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1646e5c31af7Sopenharmony_ci	ctx.glUniform1uiv(ivec4_f, 1, &data[0]);
1647e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1648e5c31af7Sopenharmony_ci	ctx.glUniform2uiv(ivec4_f, 1, &data[0]);
1649e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1650e5c31af7Sopenharmony_ci	ctx.glUniform3uiv(ivec4_f, 1, &data[0]);
1651e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1652e5c31af7Sopenharmony_ci	ctx.glUniform4uiv(ivec4_f, 1, &data[0]);
1653e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1654e5c31af7Sopenharmony_ci	ctx.endSection();
1655e5c31af7Sopenharmony_ci
1656e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than ctx.glUniform1i and ctx.glUniform1iv.");
1657e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1658e5c31af7Sopenharmony_ci	ctx.glUniform1uiv(sampler_f, 1, &data[0]);
1659e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1660e5c31af7Sopenharmony_ci	ctx.endSection();
1661e5c31af7Sopenharmony_ci
1662e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1663e5c31af7Sopenharmony_ci}
1664e5c31af7Sopenharmony_ci
1665e5c31af7Sopenharmony_civoid uniformuiv_invalid_location (NegativeTestContext& ctx)
1666e5c31af7Sopenharmony_ci{
1667e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1668e5c31af7Sopenharmony_ci
1669e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1670e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1671e5c31af7Sopenharmony_ci
1672e5c31af7Sopenharmony_ci	std::vector<GLuint> data(4);
1673e5c31af7Sopenharmony_ci
1674e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1675e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1676e5c31af7Sopenharmony_ci	ctx.glUniform1uiv(-2, 1, &data[0]);
1677e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1678e5c31af7Sopenharmony_ci	ctx.glUniform2uiv(-2, 1, &data[0]);
1679e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1680e5c31af7Sopenharmony_ci	ctx.glUniform3uiv(-2, 1, &data[0]);
1681e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1682e5c31af7Sopenharmony_ci	ctx.glUniform4uiv(-2, 1, &data[0]);
1683e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1684e5c31af7Sopenharmony_ci
1685e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1686e5c31af7Sopenharmony_ci	ctx.glUniform1uiv(-1, 1, &data[0]);
1687e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1688e5c31af7Sopenharmony_ci	ctx.glUniform2uiv(-1, 1, &data[0]);
1689e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1690e5c31af7Sopenharmony_ci	ctx.glUniform3uiv(-1, 1, &data[0]);
1691e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1692e5c31af7Sopenharmony_ci	ctx.glUniform4uiv(-1, 1, &data[0]);
1693e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1694e5c31af7Sopenharmony_ci	ctx.endSection();
1695e5c31af7Sopenharmony_ci
1696e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1697e5c31af7Sopenharmony_ci}
1698e5c31af7Sopenharmony_ci
1699e5c31af7Sopenharmony_civoid uniformuiv_invalid_count (NegativeTestContext& ctx)
1700e5c31af7Sopenharmony_ci{
1701e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1702e5c31af7Sopenharmony_ci
1703e5c31af7Sopenharmony_ci	ctx.glUseProgram			(program.getProgram());
1704e5c31af7Sopenharmony_ci	int uvec4_f				= ctx.glGetUniformLocation(program.getProgram(), "uvec4_f"); // uvec4
1705e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1706e5c31af7Sopenharmony_ci
1707e5c31af7Sopenharmony_ci	if (uvec4_f == -1)
1708e5c31af7Sopenharmony_ci	{
1709e5c31af7Sopenharmony_ci		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1710e5c31af7Sopenharmony_ci		ctx.fail("Failed to retrieve uniform location");
1711e5c31af7Sopenharmony_ci	}
1712e5c31af7Sopenharmony_ci
1713e5c31af7Sopenharmony_ci	std::vector<GLuint> data(8);
1714e5c31af7Sopenharmony_ci
1715e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.");
1716e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1717e5c31af7Sopenharmony_ci	ctx.glUniform1uiv(uvec4_f, 2, &data[0]);
1718e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1719e5c31af7Sopenharmony_ci	ctx.glUniform2uiv(uvec4_f, 2, &data[0]);
1720e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1721e5c31af7Sopenharmony_ci	ctx.glUniform3uiv(uvec4_f, 2, &data[0]);
1722e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1723e5c31af7Sopenharmony_ci	ctx.glUniform4uiv(uvec4_f, 2, &data[0]);
1724e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1725e5c31af7Sopenharmony_ci	ctx.endSection();
1726e5c31af7Sopenharmony_ci
1727e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1728e5c31af7Sopenharmony_ci}
1729e5c31af7Sopenharmony_ci
1730e5c31af7Sopenharmony_ci
1731e5c31af7Sopenharmony_ci// ctx.glUniformMatrix*fv
1732e5c31af7Sopenharmony_ci
1733e5c31af7Sopenharmony_civoid uniform_matrixfv_invalid_program (NegativeTestContext& ctx)
1734e5c31af7Sopenharmony_ci{
1735e5c31af7Sopenharmony_ci	std::vector<GLfloat> data(16);
1736e5c31af7Sopenharmony_ci
1737e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if there is no current program object.");
1738e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1739e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2fv(-1, 1, GL_FALSE, &data[0]);
1740e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1741e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3fv(-1, 1, GL_FALSE, &data[0]);
1742e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1743e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4fv(-1, 1, GL_FALSE, &data[0]);
1744e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1745e5c31af7Sopenharmony_ci
1746e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2x3fv(-1, 1, GL_FALSE, &data[0]);
1747e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1748e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3x2fv(-1, 1, GL_FALSE, &data[0]);
1749e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1750e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2x4fv(-1, 1, GL_FALSE, &data[0]);
1751e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1752e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4x2fv(-1, 1, GL_FALSE, &data[0]);
1753e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1754e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3x4fv(-1, 1, GL_FALSE, &data[0]);
1755e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1756e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4x3fv(-1, 1, GL_FALSE, &data[0]);
1757e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1758e5c31af7Sopenharmony_ci	ctx.endSection();
1759e5c31af7Sopenharmony_ci}
1760e5c31af7Sopenharmony_ci
1761e5c31af7Sopenharmony_civoid uniform_matrixfv_incompatible_type (NegativeTestContext& ctx)
1762e5c31af7Sopenharmony_ci{
1763e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1764e5c31af7Sopenharmony_ci
1765e5c31af7Sopenharmony_ci	ctx.glUseProgram			(program.getProgram());
1766e5c31af7Sopenharmony_ci	GLint mat4_v			= ctx.glGetUniformLocation(program.getProgram(), "mat4_v");	// mat4
1767e5c31af7Sopenharmony_ci	GLint sampler_f			= ctx.glGetUniformLocation(program.getProgram(), "sampler_f");	// sampler2D
1768e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1769e5c31af7Sopenharmony_ci
1770e5c31af7Sopenharmony_ci	if (mat4_v == -1 || sampler_f == -1)
1771e5c31af7Sopenharmony_ci	{
1772e5c31af7Sopenharmony_ci		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1773e5c31af7Sopenharmony_ci		ctx.fail("Failed to retrieve uniform location");
1774e5c31af7Sopenharmony_ci	}
1775e5c31af7Sopenharmony_ci
1776e5c31af7Sopenharmony_ci	std::vector<GLfloat> data(16);
1777e5c31af7Sopenharmony_ci
1778e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the ctx.glUniform command.");
1779e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1780e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2fv(mat4_v, 1, GL_FALSE, &data[0]);
1781e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1782e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3fv(mat4_v, 1, GL_FALSE, &data[0]);
1783e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1784e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4fv(mat4_v, 1, GL_FALSE, &data[0]);
1785e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1786e5c31af7Sopenharmony_ci
1787e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2x3fv(mat4_v, 1, GL_FALSE, &data[0]);
1788e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1789e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3x2fv(mat4_v, 1, GL_FALSE, &data[0]);
1790e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1791e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2x4fv(mat4_v, 1, GL_FALSE, &data[0]);
1792e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1793e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4x2fv(mat4_v, 1, GL_FALSE, &data[0]);
1794e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1795e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3x4fv(mat4_v, 1, GL_FALSE, &data[0]);
1796e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1797e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4x3fv(mat4_v, 1, GL_FALSE, &data[0]);
1798e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1799e5c31af7Sopenharmony_ci	ctx.endSection();
1800e5c31af7Sopenharmony_ci
1801e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if a sampler is loaded using a command other than ctx.glUniform1i and ctx.glUniform1iv.");
1802e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1803e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2fv(sampler_f, 1, GL_FALSE, &data[0]);
1804e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1805e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3fv(sampler_f, 1, GL_FALSE, &data[0]);
1806e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1807e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4fv(sampler_f, 1, GL_FALSE, &data[0]);
1808e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1809e5c31af7Sopenharmony_ci
1810e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2x3fv(sampler_f, 1, GL_FALSE, &data[0]);
1811e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1812e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3x2fv(sampler_f, 1, GL_FALSE, &data[0]);
1813e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1814e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2x4fv(sampler_f, 1, GL_FALSE, &data[0]);
1815e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1816e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4x2fv(sampler_f, 1, GL_FALSE, &data[0]);
1817e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1818e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3x4fv(sampler_f, 1, GL_FALSE, &data[0]);
1819e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1820e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4x3fv(sampler_f, 1, GL_FALSE, &data[0]);
1821e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1822e5c31af7Sopenharmony_ci	ctx.endSection();
1823e5c31af7Sopenharmony_ci
1824e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1825e5c31af7Sopenharmony_ci}
1826e5c31af7Sopenharmony_ci
1827e5c31af7Sopenharmony_civoid uniform_matrixfv_invalid_location (NegativeTestContext& ctx)
1828e5c31af7Sopenharmony_ci{
1829e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1830e5c31af7Sopenharmony_ci
1831e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1832e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1833e5c31af7Sopenharmony_ci
1834e5c31af7Sopenharmony_ci	std::vector<GLfloat> data(16);
1835e5c31af7Sopenharmony_ci
1836e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if location is an invalid uniform location for the current program object and location is not equal to -1.");
1837e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1838e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2fv(-2, 1, GL_FALSE, &data[0]);
1839e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1840e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3fv(-2, 1, GL_FALSE, &data[0]);
1841e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1842e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4fv(-2, 1, GL_FALSE, &data[0]);
1843e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1844e5c31af7Sopenharmony_ci
1845e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2x3fv(-2, 1, GL_FALSE, &data[0]);
1846e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1847e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3x2fv(-2, 1, GL_FALSE, &data[0]);
1848e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1849e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2x4fv(-2, 1, GL_FALSE, &data[0]);
1850e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1851e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4x2fv(-2, 1, GL_FALSE, &data[0]);
1852e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1853e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3x4fv(-2, 1, GL_FALSE, &data[0]);
1854e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1855e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4x3fv(-2, 1, GL_FALSE, &data[0]);
1856e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1857e5c31af7Sopenharmony_ci
1858e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1859e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2fv(-1, 1, GL_FALSE, &data[0]);
1860e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1861e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3fv(-1, 1, GL_FALSE, &data[0]);
1862e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1863e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4fv(-1, 1, GL_FALSE, &data[0]);
1864e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1865e5c31af7Sopenharmony_ci
1866e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2x3fv(-1, 1, GL_FALSE, &data[0]);
1867e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1868e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3x2fv(-1, 1, GL_FALSE, &data[0]);
1869e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1870e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2x4fv(-1, 1, GL_FALSE, &data[0]);
1871e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1872e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4x2fv(-1, 1, GL_FALSE, &data[0]);
1873e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1874e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3x4fv(-1, 1, GL_FALSE, &data[0]);
1875e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1876e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4x3fv(-1, 1, GL_FALSE, &data[0]);
1877e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1878e5c31af7Sopenharmony_ci	ctx.endSection();
1879e5c31af7Sopenharmony_ci
1880e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1881e5c31af7Sopenharmony_ci}
1882e5c31af7Sopenharmony_ci
1883e5c31af7Sopenharmony_civoid uniform_matrixfv_invalid_count (NegativeTestContext& ctx)
1884e5c31af7Sopenharmony_ci{
1885e5c31af7Sopenharmony_ci	glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource));
1886e5c31af7Sopenharmony_ci
1887e5c31af7Sopenharmony_ci	ctx.glUseProgram			(program.getProgram());
1888e5c31af7Sopenharmony_ci	GLint mat4_v			= ctx.glGetUniformLocation(program.getProgram(), "mat4_v"); // mat4
1889e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
1890e5c31af7Sopenharmony_ci
1891e5c31af7Sopenharmony_ci	if (mat4_v == -1)
1892e5c31af7Sopenharmony_ci	{
1893e5c31af7Sopenharmony_ci		ctx.getLog() << TestLog::Message << "// ERROR: Failed to retrieve uniform location" << TestLog::EndMessage;
1894e5c31af7Sopenharmony_ci		ctx.fail("Failed to retrieve uniform location");
1895e5c31af7Sopenharmony_ci	}
1896e5c31af7Sopenharmony_ci
1897e5c31af7Sopenharmony_ci	std::vector<GLfloat> data(32);
1898e5c31af7Sopenharmony_ci
1899e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if count is greater than 1 and the indicated uniform variable is not an array variable.");
1900e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
1901e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2fv(mat4_v, 2, GL_FALSE, &data[0]);
1902e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1903e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3fv(mat4_v, 2, GL_FALSE, &data[0]);
1904e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1905e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4fv(mat4_v, 2, GL_FALSE, &data[0]);
1906e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1907e5c31af7Sopenharmony_ci
1908e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2x3fv(mat4_v, 1, GL_FALSE, &data[0]);
1909e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1910e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3x2fv(mat4_v, 1, GL_FALSE, &data[0]);
1911e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1912e5c31af7Sopenharmony_ci	ctx.glUniformMatrix2x4fv(mat4_v, 1, GL_FALSE, &data[0]);
1913e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1914e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4x2fv(mat4_v, 1, GL_FALSE, &data[0]);
1915e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1916e5c31af7Sopenharmony_ci	ctx.glUniformMatrix3x4fv(mat4_v, 1, GL_FALSE, &data[0]);
1917e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1918e5c31af7Sopenharmony_ci	ctx.glUniformMatrix4x3fv(mat4_v, 1, GL_FALSE, &data[0]);
1919e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1920e5c31af7Sopenharmony_ci	ctx.endSection();
1921e5c31af7Sopenharmony_ci
1922e5c31af7Sopenharmony_ci	ctx.glUseProgram(0);
1923e5c31af7Sopenharmony_ci}
1924e5c31af7Sopenharmony_ci
1925e5c31af7Sopenharmony_ci// Transform feedback
1926e5c31af7Sopenharmony_civoid gen_transform_feedbacks (NegativeTestContext& ctx)
1927e5c31af7Sopenharmony_ci{
1928e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
1929e5c31af7Sopenharmony_ci	GLuint id = 0;
1930e5c31af7Sopenharmony_ci	ctx.glGenTransformFeedbacks(-1, &id);
1931e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
1932e5c31af7Sopenharmony_ci	ctx.endSection();
1933e5c31af7Sopenharmony_ci}
1934e5c31af7Sopenharmony_ci
1935e5c31af7Sopenharmony_civoid bind_transform_feedback (NegativeTestContext& ctx)
1936e5c31af7Sopenharmony_ci{
1937e5c31af7Sopenharmony_ci	GLuint						tfID[2];
1938e5c31af7Sopenharmony_ci	glu::ShaderProgram			program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
1939e5c31af7Sopenharmony_ci	deUint32					buf = 0x1234;
1940e5c31af7Sopenharmony_ci	const char* tfVarying		= "gl_Position";
1941e5c31af7Sopenharmony_ci
1942e5c31af7Sopenharmony_ci	ctx.glGenBuffers				(1, &buf);
1943e5c31af7Sopenharmony_ci	ctx.glGenTransformFeedbacks		(2, tfID);
1944e5c31af7Sopenharmony_ci
1945e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_TRANSFORM_FEEDBACK.");
1946e5c31af7Sopenharmony_ci	ctx.glBindTransformFeedback(-1, tfID[0]);
1947e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_ENUM);
1948e5c31af7Sopenharmony_ci	ctx.endSection();
1949e5c31af7Sopenharmony_ci
1950e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if the transform feedback operation is active on the currently bound transform feedback object, and is not paused.");
1951e5c31af7Sopenharmony_ci	ctx.glUseProgram				(program.getProgram());
1952e5c31af7Sopenharmony_ci	ctx.glTransformFeedbackVaryings	(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
1953e5c31af7Sopenharmony_ci	ctx.glLinkProgram				(program.getProgram());
1954e5c31af7Sopenharmony_ci	ctx.glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID[0]);
1955e5c31af7Sopenharmony_ci	ctx.glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
1956e5c31af7Sopenharmony_ci	ctx.glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
1957e5c31af7Sopenharmony_ci	ctx.glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
1958e5c31af7Sopenharmony_ci	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
1959e5c31af7Sopenharmony_ci	ctx.expectError				(GL_NO_ERROR);
1960e5c31af7Sopenharmony_ci
1961e5c31af7Sopenharmony_ci	ctx.glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID[1]);
1962e5c31af7Sopenharmony_ci	ctx.expectError				(GL_INVALID_OPERATION);
1963e5c31af7Sopenharmony_ci
1964e5c31af7Sopenharmony_ci	ctx.glEndTransformFeedback		();
1965e5c31af7Sopenharmony_ci	ctx.expectError				(GL_NO_ERROR);
1966e5c31af7Sopenharmony_ci	ctx.endSection();
1967e5c31af7Sopenharmony_ci
1968e5c31af7Sopenharmony_ci	ctx.glUseProgram				(0);
1969e5c31af7Sopenharmony_ci	ctx.glDeleteBuffers				(1, &buf);
1970e5c31af7Sopenharmony_ci	ctx.glDeleteTransformFeedbacks	(2, tfID);
1971e5c31af7Sopenharmony_ci	ctx.expectError				(GL_NO_ERROR);
1972e5c31af7Sopenharmony_ci
1973e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if id has been deleted with glDeleteTransformFeedback().");
1974e5c31af7Sopenharmony_ci	ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, tfID[0]);
1975e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1976e5c31af7Sopenharmony_ci	ctx.endSection();
1977e5c31af7Sopenharmony_ci
1978e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if id is not 0 or a value returned from glGenTransformFeedbacks().");
1979e5c31af7Sopenharmony_ci	ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, -1);
1980e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
1981e5c31af7Sopenharmony_ci	ctx.endSection();
1982e5c31af7Sopenharmony_ci}
1983e5c31af7Sopenharmony_ci
1984e5c31af7Sopenharmony_civoid delete_transform_feedbacks (NegativeTestContext& ctx)
1985e5c31af7Sopenharmony_ci{
1986e5c31af7Sopenharmony_ci	GLuint				id			= 0;
1987e5c31af7Sopenharmony_ci	GLuint				tfID[2];
1988e5c31af7Sopenharmony_ci	deUint32			buf			= 0x1234;
1989e5c31af7Sopenharmony_ci	const char*			tfVarying	= "gl_Position";
1990e5c31af7Sopenharmony_ci	glu::ShaderProgram	program		(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
1991e5c31af7Sopenharmony_ci
1992e5c31af7Sopenharmony_ci	ctx.glGenBuffers(1, &buf);
1993e5c31af7Sopenharmony_ci	ctx.glGenTransformFeedbacks(1, &id);
1994e5c31af7Sopenharmony_ci	ctx.glGenTransformFeedbacks(2, tfID);
1995e5c31af7Sopenharmony_ci
1996e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
1997e5c31af7Sopenharmony_ci	ctx.glDeleteTransformFeedbacks(-1, &id);
1998e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
1999e5c31af7Sopenharmony_ci	ctx.endSection();
2000e5c31af7Sopenharmony_ci
2001e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if the transform feedback operation for any object named by ids is currently active.");
2002e5c31af7Sopenharmony_ci	ctx.glUseProgram(program.getProgram());
2003e5c31af7Sopenharmony_ci	ctx.glTransformFeedbackVaryings(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2004e5c31af7Sopenharmony_ci	ctx.glLinkProgram(program.getProgram());
2005e5c31af7Sopenharmony_ci	ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, tfID[0]);
2006e5c31af7Sopenharmony_ci	ctx.glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
2007e5c31af7Sopenharmony_ci	ctx.glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
2008e5c31af7Sopenharmony_ci	ctx.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
2009e5c31af7Sopenharmony_ci	ctx.glBeginTransformFeedback(GL_TRIANGLES);
2010e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
2011e5c31af7Sopenharmony_ci
2012e5c31af7Sopenharmony_ci	ctx.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, tfID[1]);
2013e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
2014e5c31af7Sopenharmony_ci
2015e5c31af7Sopenharmony_ci	ctx.glDeleteTransformFeedbacks(2, tfID);
2016e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
2017e5c31af7Sopenharmony_ci
2018e5c31af7Sopenharmony_ci	ctx.glEndTransformFeedback();
2019e5c31af7Sopenharmony_ci	ctx.expectError(GL_NO_ERROR);
2020e5c31af7Sopenharmony_ci	ctx.endSection();
2021e5c31af7Sopenharmony_ci
2022e5c31af7Sopenharmony_ci
2023e5c31af7Sopenharmony_ci	ctx.glDeleteTransformFeedbacks(1, &id);
2024e5c31af7Sopenharmony_ci	ctx.glDeleteTransformFeedbacks(2, tfID);
2025e5c31af7Sopenharmony_ci	ctx.glDeleteBuffers(1, &buf);
2026e5c31af7Sopenharmony_ci
2027e5c31af7Sopenharmony_ci}
2028e5c31af7Sopenharmony_ci
2029e5c31af7Sopenharmony_civoid begin_transform_feedback (NegativeTestContext& ctx)
2030e5c31af7Sopenharmony_ci{
2031e5c31af7Sopenharmony_ci	GLuint						tfID[2];
2032e5c31af7Sopenharmony_ci	glu::ShaderProgram			program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2033e5c31af7Sopenharmony_ci	deUint32					buf = 0x1234;
2034e5c31af7Sopenharmony_ci	const char* tfVarying		= "gl_Position";
2035e5c31af7Sopenharmony_ci
2036e5c31af7Sopenharmony_ci	ctx.glGenBuffers				(1, &buf);
2037e5c31af7Sopenharmony_ci	ctx.glGenTransformFeedbacks		(2, tfID);
2038e5c31af7Sopenharmony_ci
2039e5c31af7Sopenharmony_ci	ctx.glUseProgram				(program.getProgram());
2040e5c31af7Sopenharmony_ci	ctx.glTransformFeedbackVaryings	(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2041e5c31af7Sopenharmony_ci	ctx.glLinkProgram				(program.getProgram());
2042e5c31af7Sopenharmony_ci	ctx.glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID[0]);
2043e5c31af7Sopenharmony_ci	ctx.glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
2044e5c31af7Sopenharmony_ci	ctx.glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
2045e5c31af7Sopenharmony_ci	ctx.glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
2046e5c31af7Sopenharmony_ci	ctx.expectError					(GL_NO_ERROR);
2047e5c31af7Sopenharmony_ci
2048e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if primitiveMode is not one of GL_POINTS, GL_LINES, or GL_TRIANGLES.");
2049e5c31af7Sopenharmony_ci	ctx.glBeginTransformFeedback	(-1);
2050e5c31af7Sopenharmony_ci	ctx.expectError					(GL_INVALID_ENUM);
2051e5c31af7Sopenharmony_ci	ctx.endSection();
2052e5c31af7Sopenharmony_ci
2053e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is already active.");
2054e5c31af7Sopenharmony_ci	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
2055e5c31af7Sopenharmony_ci	ctx.expectError					(GL_NO_ERROR);
2056e5c31af7Sopenharmony_ci	ctx.glBeginTransformFeedback	(GL_POINTS);
2057e5c31af7Sopenharmony_ci	ctx.expectError					(GL_INVALID_OPERATION);
2058e5c31af7Sopenharmony_ci	ctx.endSection();
2059e5c31af7Sopenharmony_ci
2060e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if any binding point used in transform feedback mode does not have a buffer object bound.");
2061e5c31af7Sopenharmony_ci	ctx.glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, 0);
2062e5c31af7Sopenharmony_ci	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
2063e5c31af7Sopenharmony_ci	ctx.expectError					(GL_INVALID_OPERATION);
2064e5c31af7Sopenharmony_ci	ctx.glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
2065e5c31af7Sopenharmony_ci	ctx.endSection();
2066e5c31af7Sopenharmony_ci
2067e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if no binding points would be used because no program object is active.");
2068e5c31af7Sopenharmony_ci	ctx.glUseProgram				(0);
2069e5c31af7Sopenharmony_ci	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
2070e5c31af7Sopenharmony_ci	ctx.expectError					(GL_INVALID_OPERATION);
2071e5c31af7Sopenharmony_ci	ctx.glUseProgram				(program.getProgram());
2072e5c31af7Sopenharmony_ci	ctx.endSection();
2073e5c31af7Sopenharmony_ci
2074e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if no binding points would be used because the active program object has specified no varying variables to record.");
2075e5c31af7Sopenharmony_ci	ctx.glTransformFeedbackVaryings	(program.getProgram(), 0, 0, GL_INTERLEAVED_ATTRIBS);
2076e5c31af7Sopenharmony_ci	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
2077e5c31af7Sopenharmony_ci	ctx.expectError					(GL_INVALID_OPERATION);
2078e5c31af7Sopenharmony_ci	ctx.endSection();
2079e5c31af7Sopenharmony_ci
2080e5c31af7Sopenharmony_ci	ctx.glEndTransformFeedback		();
2081e5c31af7Sopenharmony_ci	ctx.glDeleteBuffers				(1, &buf);
2082e5c31af7Sopenharmony_ci	ctx.glDeleteTransformFeedbacks	(2, tfID);
2083e5c31af7Sopenharmony_ci	ctx.expectError					(GL_NO_ERROR);
2084e5c31af7Sopenharmony_ci}
2085e5c31af7Sopenharmony_ci
2086e5c31af7Sopenharmony_civoid pause_transform_feedback (NegativeTestContext& ctx)
2087e5c31af7Sopenharmony_ci{
2088e5c31af7Sopenharmony_ci	GLuint						tfID[2];
2089e5c31af7Sopenharmony_ci	glu::ShaderProgram			program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2090e5c31af7Sopenharmony_ci	deUint32					buf = 0x1234;
2091e5c31af7Sopenharmony_ci	const char* tfVarying		= "gl_Position";
2092e5c31af7Sopenharmony_ci
2093e5c31af7Sopenharmony_ci	ctx.glGenBuffers				(1, &buf);
2094e5c31af7Sopenharmony_ci	ctx.glGenTransformFeedbacks		(2, tfID);
2095e5c31af7Sopenharmony_ci
2096e5c31af7Sopenharmony_ci	ctx.glUseProgram				(program.getProgram());
2097e5c31af7Sopenharmony_ci	ctx.glTransformFeedbackVaryings	(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2098e5c31af7Sopenharmony_ci	ctx.glLinkProgram				(program.getProgram());
2099e5c31af7Sopenharmony_ci	ctx.glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID[0]);
2100e5c31af7Sopenharmony_ci	ctx.glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
2101e5c31af7Sopenharmony_ci	ctx.glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
2102e5c31af7Sopenharmony_ci	ctx.glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
2103e5c31af7Sopenharmony_ci	ctx.expectError					(GL_NO_ERROR);
2104e5c31af7Sopenharmony_ci
2105e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if the currently bound transform feedback object is not active or is paused.");
2106e5c31af7Sopenharmony_ci	ctx.glPauseTransformFeedback	();
2107e5c31af7Sopenharmony_ci	ctx.expectError					(GL_INVALID_OPERATION);
2108e5c31af7Sopenharmony_ci	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
2109e5c31af7Sopenharmony_ci	ctx.glPauseTransformFeedback	();
2110e5c31af7Sopenharmony_ci	ctx.expectError					(GL_NO_ERROR);
2111e5c31af7Sopenharmony_ci	ctx.glPauseTransformFeedback	();
2112e5c31af7Sopenharmony_ci	ctx.expectError					(GL_INVALID_OPERATION);
2113e5c31af7Sopenharmony_ci	ctx.endSection();
2114e5c31af7Sopenharmony_ci
2115e5c31af7Sopenharmony_ci	ctx.glEndTransformFeedback		();
2116e5c31af7Sopenharmony_ci	ctx.glDeleteBuffers				(1, &buf);
2117e5c31af7Sopenharmony_ci	ctx.glDeleteTransformFeedbacks	(2, tfID);
2118e5c31af7Sopenharmony_ci	ctx.expectError					(GL_NO_ERROR);
2119e5c31af7Sopenharmony_ci}
2120e5c31af7Sopenharmony_ci
2121e5c31af7Sopenharmony_civoid resume_transform_feedback (NegativeTestContext& ctx)
2122e5c31af7Sopenharmony_ci{
2123e5c31af7Sopenharmony_ci	GLuint						tfID[2];
2124e5c31af7Sopenharmony_ci	glu::ShaderProgram			program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2125e5c31af7Sopenharmony_ci	deUint32					buf = 0x1234;
2126e5c31af7Sopenharmony_ci	const char* tfVarying		= "gl_Position";
2127e5c31af7Sopenharmony_ci
2128e5c31af7Sopenharmony_ci	ctx.glGenBuffers				(1, &buf);
2129e5c31af7Sopenharmony_ci	ctx.glGenTransformFeedbacks		(2, tfID);
2130e5c31af7Sopenharmony_ci
2131e5c31af7Sopenharmony_ci	ctx.glUseProgram				(program.getProgram());
2132e5c31af7Sopenharmony_ci	ctx.glTransformFeedbackVaryings	(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2133e5c31af7Sopenharmony_ci	ctx.glLinkProgram				(program.getProgram());
2134e5c31af7Sopenharmony_ci	ctx.glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID[0]);
2135e5c31af7Sopenharmony_ci	ctx.glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
2136e5c31af7Sopenharmony_ci	ctx.glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
2137e5c31af7Sopenharmony_ci	ctx.glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
2138e5c31af7Sopenharmony_ci	ctx.expectError					(GL_NO_ERROR);
2139e5c31af7Sopenharmony_ci
2140e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if the currently bound transform feedback object is not active or is not paused.");
2141e5c31af7Sopenharmony_ci	ctx.glResumeTransformFeedback	();
2142e5c31af7Sopenharmony_ci	ctx.expectError					(GL_INVALID_OPERATION);
2143e5c31af7Sopenharmony_ci	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
2144e5c31af7Sopenharmony_ci	ctx.glResumeTransformFeedback	();
2145e5c31af7Sopenharmony_ci	ctx.expectError					(GL_INVALID_OPERATION);
2146e5c31af7Sopenharmony_ci	ctx.glPauseTransformFeedback	();
2147e5c31af7Sopenharmony_ci	ctx.glResumeTransformFeedback	();
2148e5c31af7Sopenharmony_ci	ctx.expectError					(GL_NO_ERROR);
2149e5c31af7Sopenharmony_ci	ctx.endSection();
2150e5c31af7Sopenharmony_ci
2151e5c31af7Sopenharmony_ci	ctx.glEndTransformFeedback		();
2152e5c31af7Sopenharmony_ci	ctx.glDeleteBuffers				(1, &buf);
2153e5c31af7Sopenharmony_ci	ctx.glDeleteTransformFeedbacks	(2, tfID);
2154e5c31af7Sopenharmony_ci	ctx.expectError					(GL_NO_ERROR);
2155e5c31af7Sopenharmony_ci}
2156e5c31af7Sopenharmony_ci
2157e5c31af7Sopenharmony_civoid end_transform_feedback (NegativeTestContext& ctx)
2158e5c31af7Sopenharmony_ci{
2159e5c31af7Sopenharmony_ci	GLuint						tfID = 0;
2160e5c31af7Sopenharmony_ci	glu::ShaderProgram			program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2161e5c31af7Sopenharmony_ci	deUint32					buf = 0x1234;
2162e5c31af7Sopenharmony_ci	const char* tfVarying		= "gl_Position";
2163e5c31af7Sopenharmony_ci
2164e5c31af7Sopenharmony_ci	ctx.glGenBuffers				(1, &buf);
2165e5c31af7Sopenharmony_ci	ctx.glGenTransformFeedbacks		(1, &tfID);
2166e5c31af7Sopenharmony_ci
2167e5c31af7Sopenharmony_ci	ctx.glUseProgram				(program.getProgram());
2168e5c31af7Sopenharmony_ci	ctx.glTransformFeedbackVaryings	(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2169e5c31af7Sopenharmony_ci	ctx.glLinkProgram				(program.getProgram());
2170e5c31af7Sopenharmony_ci	ctx.glBindTransformFeedback		(GL_TRANSFORM_FEEDBACK, tfID);
2171e5c31af7Sopenharmony_ci	ctx.glBindBuffer				(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
2172e5c31af7Sopenharmony_ci	ctx.glBufferData				(GL_TRANSFORM_FEEDBACK_BUFFER, 32, DE_NULL, GL_DYNAMIC_DRAW);
2173e5c31af7Sopenharmony_ci	ctx.glBindBufferBase			(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
2174e5c31af7Sopenharmony_ci	ctx.expectError					(GL_NO_ERROR);
2175e5c31af7Sopenharmony_ci
2176e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is not active.");
2177e5c31af7Sopenharmony_ci	ctx.glEndTransformFeedback		();
2178e5c31af7Sopenharmony_ci	ctx.expectError					(GL_INVALID_OPERATION);
2179e5c31af7Sopenharmony_ci	ctx.glBeginTransformFeedback	(GL_TRIANGLES);
2180e5c31af7Sopenharmony_ci	ctx.glEndTransformFeedback		();
2181e5c31af7Sopenharmony_ci	ctx.expectError					(GL_NO_ERROR);
2182e5c31af7Sopenharmony_ci	ctx.endSection();
2183e5c31af7Sopenharmony_ci
2184e5c31af7Sopenharmony_ci	ctx.glDeleteBuffers				(1, &buf);
2185e5c31af7Sopenharmony_ci	ctx.glDeleteTransformFeedbacks	(1, &tfID);
2186e5c31af7Sopenharmony_ci	ctx.expectError					(GL_NO_ERROR);
2187e5c31af7Sopenharmony_ci}
2188e5c31af7Sopenharmony_ci
2189e5c31af7Sopenharmony_civoid get_transform_feedback_varying (NegativeTestContext& ctx)
2190e5c31af7Sopenharmony_ci{
2191e5c31af7Sopenharmony_ci	GLuint					tfID = 0;
2192e5c31af7Sopenharmony_ci	glu::ShaderProgram		program			(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2193e5c31af7Sopenharmony_ci	glu::ShaderProgram		programInvalid	(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, ""));
2194e5c31af7Sopenharmony_ci	const char* tfVarying	= "gl_Position";
2195e5c31af7Sopenharmony_ci	int						maxTransformFeedbackVaryings = 0;
2196e5c31af7Sopenharmony_ci
2197e5c31af7Sopenharmony_ci	GLsizei					length;
2198e5c31af7Sopenharmony_ci	GLsizei					size;
2199e5c31af7Sopenharmony_ci	GLenum					type;
2200e5c31af7Sopenharmony_ci	char					name[32];
2201e5c31af7Sopenharmony_ci
2202e5c31af7Sopenharmony_ci	const GLuint notAProgram = ctx.glCreateProgram();
2203e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(notAProgram);
2204e5c31af7Sopenharmony_ci
2205e5c31af7Sopenharmony_ci	ctx.glGenTransformFeedbacks				(1, &tfID);
2206e5c31af7Sopenharmony_ci
2207e5c31af7Sopenharmony_ci	ctx.glTransformFeedbackVaryings			(program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2208e5c31af7Sopenharmony_ci	ctx.expectError						(GL_NO_ERROR);
2209e5c31af7Sopenharmony_ci	ctx.glLinkProgram						(program.getProgram());
2210e5c31af7Sopenharmony_ci	ctx.expectError						(GL_NO_ERROR);
2211e5c31af7Sopenharmony_ci
2212e5c31af7Sopenharmony_ci	ctx.glBindTransformFeedback				(GL_TRANSFORM_FEEDBACK, tfID);
2213e5c31af7Sopenharmony_ci	ctx.expectError						(GL_NO_ERROR);
2214e5c31af7Sopenharmony_ci
2215e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of a program object.");
2216e5c31af7Sopenharmony_ci	ctx.glGetTransformFeedbackVarying		(notAProgram, 0, 32, &length, &size, &type, &name[0]);
2217e5c31af7Sopenharmony_ci	ctx.expectError						(GL_INVALID_VALUE);
2218e5c31af7Sopenharmony_ci	ctx.endSection();
2219e5c31af7Sopenharmony_ci
2220e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if index is greater or equal to the value of GL_TRANSFORM_FEEDBACK_VARYINGS.");
2221e5c31af7Sopenharmony_ci	ctx.glGetProgramiv						(program.getProgram(), GL_TRANSFORM_FEEDBACK_VARYINGS, &maxTransformFeedbackVaryings);
2222e5c31af7Sopenharmony_ci	ctx.glGetTransformFeedbackVarying		(program.getProgram(), maxTransformFeedbackVaryings, 32, &length, &size, &type, &name[0]);
2223e5c31af7Sopenharmony_ci	ctx.expectError						(GL_INVALID_VALUE);
2224e5c31af7Sopenharmony_ci	ctx.endSection();
2225e5c31af7Sopenharmony_ci
2226e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION or GL_INVALID_VALUE is generated program has not been linked.");
2227e5c31af7Sopenharmony_ci	ctx.glGetTransformFeedbackVarying		(programInvalid.getProgram(), 0, 32, &length, &size, &type, &name[0]);
2228e5c31af7Sopenharmony_ci	ctx.expectError						(GL_INVALID_OPERATION, GL_INVALID_VALUE);
2229e5c31af7Sopenharmony_ci	ctx.endSection();
2230e5c31af7Sopenharmony_ci
2231e5c31af7Sopenharmony_ci	ctx.glDeleteTransformFeedbacks			(1, &tfID);
2232e5c31af7Sopenharmony_ci	ctx.expectError						(GL_NO_ERROR);
2233e5c31af7Sopenharmony_ci}
2234e5c31af7Sopenharmony_ci
2235e5c31af7Sopenharmony_civoid transform_feedback_varyings (NegativeTestContext& ctx)
2236e5c31af7Sopenharmony_ci{
2237e5c31af7Sopenharmony_ci	GLuint										tfID = 0;
2238e5c31af7Sopenharmony_ci	GLuint shader								= ctx.glCreateShader(GL_VERTEX_SHADER);
2239e5c31af7Sopenharmony_ci	glu::ShaderProgram program					(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
2240e5c31af7Sopenharmony_ci	const char* tfVarying						= "gl_Position";
2241e5c31af7Sopenharmony_ci	GLint maxTransformFeedbackSeparateAttribs	= 0;
2242e5c31af7Sopenharmony_ci
2243e5c31af7Sopenharmony_ci	const GLuint notAProgram = ctx.glCreateProgram();
2244e5c31af7Sopenharmony_ci	ctx.glDeleteProgram(notAProgram);
2245e5c31af7Sopenharmony_ci
2246e5c31af7Sopenharmony_ci	ctx.glGenTransformFeedbacks				(1, &tfID);
2247e5c31af7Sopenharmony_ci	ctx.expectError						(GL_NO_ERROR);
2248e5c31af7Sopenharmony_ci
2249e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of a program object.");
2250e5c31af7Sopenharmony_ci	ctx.glTransformFeedbackVaryings			(notAProgram, 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2251e5c31af7Sopenharmony_ci	ctx.expectError						(GL_INVALID_VALUE);
2252e5c31af7Sopenharmony_ci	ctx.endSection();
2253e5c31af7Sopenharmony_ci
2254e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object.");
2255e5c31af7Sopenharmony_ci	ctx.glTransformFeedbackVaryings(shader, 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2256e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_OPERATION);
2257e5c31af7Sopenharmony_ci	ctx.glDeleteShader(shader);
2258e5c31af7Sopenharmony_ci	ctx.endSection();
2259e5c31af7Sopenharmony_ci
2260e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if count is negative.");
2261e5c31af7Sopenharmony_ci	ctx.glTransformFeedbackVaryings(program.getProgram(), -1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
2262e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_VALUE);
2263e5c31af7Sopenharmony_ci	ctx.endSection();
2264e5c31af7Sopenharmony_ci
2265e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if bufferMode is not SEPARATE_ATTRIBS or INTERLEAVED_ATTRIBS.");
2266e5c31af7Sopenharmony_ci	ctx.glTransformFeedbackVaryings(program.getProgram(), 1, &tfVarying, 0);
2267e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_ENUM);
2268e5c31af7Sopenharmony_ci	ctx.endSection();
2269e5c31af7Sopenharmony_ci
2270e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_VALUE is generated if bufferMode is GL_SEPARATE_ATTRIBS and count is greater than GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS.");
2271e5c31af7Sopenharmony_ci	ctx.glGetIntegerv						(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &maxTransformFeedbackSeparateAttribs);
2272e5c31af7Sopenharmony_ci	ctx.glTransformFeedbackVaryings			(program.getProgram(), maxTransformFeedbackSeparateAttribs+1, &tfVarying, GL_SEPARATE_ATTRIBS);
2273e5c31af7Sopenharmony_ci	ctx.expectError						(GL_INVALID_VALUE);
2274e5c31af7Sopenharmony_ci	ctx.endSection();
2275e5c31af7Sopenharmony_ci
2276e5c31af7Sopenharmony_ci	ctx.glDeleteTransformFeedbacks			(1, &tfID);
2277e5c31af7Sopenharmony_ci	ctx.expectError						(GL_NO_ERROR);
2278e5c31af7Sopenharmony_ci
2279e5c31af7Sopenharmony_ci}
2280e5c31af7Sopenharmony_ci
2281e5c31af7Sopenharmony_civoid link_compute_shader (NegativeTestContext& ctx)
2282e5c31af7Sopenharmony_ci{
2283e5c31af7Sopenharmony_ci	const char* computeShaderSource		=	"#version 320 es\n"
2284e5c31af7Sopenharmony_ci											"void main (void)\n"
2285e5c31af7Sopenharmony_ci											"{\n"
2286e5c31af7Sopenharmony_ci											"}\n\0";
2287e5c31af7Sopenharmony_ci	{
2288e5c31af7Sopenharmony_ci		const GLenum shaderTypes[]			=	{
2289e5c31af7Sopenharmony_ci													GL_VERTEX_SHADER,
2290e5c31af7Sopenharmony_ci													GL_FRAGMENT_SHADER,
2291e5c31af7Sopenharmony_ci													GL_GEOMETRY_SHADER,
2292e5c31af7Sopenharmony_ci													GL_TESS_CONTROL_SHADER,
2293e5c31af7Sopenharmony_ci													GL_TESS_EVALUATION_SHADER
2294e5c31af7Sopenharmony_ci												};
2295e5c31af7Sopenharmony_ci
2296e5c31af7Sopenharmony_ci		ctx.beginSection("Compute Shader linked with shader of other kind.");
2297e5c31af7Sopenharmony_ci		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(shaderTypes); ndx++)
2298e5c31af7Sopenharmony_ci		{
2299e5c31af7Sopenharmony_ci			GLint linkStatus				=	-1;
2300e5c31af7Sopenharmony_ci			GLuint program					=	ctx.glCreateProgram();
2301e5c31af7Sopenharmony_ci			GLuint computeShader			=	ctx.glCreateShader(GL_COMPUTE_SHADER);
2302e5c31af7Sopenharmony_ci			GLuint otherShader				=	ctx.glCreateShader(shaderTypes[ndx]);
2303e5c31af7Sopenharmony_ci			const char* otherShaderSource	=	(shaderTypes[ndx] != GL_GEOMETRY_SHADER)	?
2304e5c31af7Sopenharmony_ci												computeShaderSource							:
2305e5c31af7Sopenharmony_ci												"#version 320 es\n"
2306e5c31af7Sopenharmony_ci												"layout(max_vertices = 3) out;\n"
2307e5c31af7Sopenharmony_ci												"void main(void){}\n\0";
2308e5c31af7Sopenharmony_ci
2309e5c31af7Sopenharmony_ci			ctx.glShaderSource(computeShader, 1, &computeShaderSource, DE_NULL);
2310e5c31af7Sopenharmony_ci			ctx.glShaderSource(otherShader, 1, &otherShaderSource, DE_NULL);
2311e5c31af7Sopenharmony_ci			ctx.glCompileShader(computeShader);
2312e5c31af7Sopenharmony_ci			ctx.glCompileShader(otherShader);
2313e5c31af7Sopenharmony_ci			ctx.glAttachShader(program, computeShader);
2314e5c31af7Sopenharmony_ci			ctx.glAttachShader(program, otherShader);
2315e5c31af7Sopenharmony_ci			ctx.glLinkProgram(program);
2316e5c31af7Sopenharmony_ci			ctx.glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
2317e5c31af7Sopenharmony_ci			ctx.glDeleteShader(otherShader);
2318e5c31af7Sopenharmony_ci			ctx.glDeleteShader(computeShader);
2319e5c31af7Sopenharmony_ci			ctx.glDeleteProgram(program);
2320e5c31af7Sopenharmony_ci			if (linkStatus != GL_FALSE)
2321e5c31af7Sopenharmony_ci				ctx.fail("Program should not have linked");
2322e5c31af7Sopenharmony_ci		}
2323e5c31af7Sopenharmony_ci		ctx.endSection();
2324e5c31af7Sopenharmony_ci	}
2325e5c31af7Sopenharmony_ci	{
2326e5c31af7Sopenharmony_ci		const char* computeShaderSource310	=	"#version 310 es\n"
2327e5c31af7Sopenharmony_ci												"void main (void)\n"
2328e5c31af7Sopenharmony_ci												"{\n"
2329e5c31af7Sopenharmony_ci												"}\n\0";
2330e5c31af7Sopenharmony_ci		GLint linkStatus					=	-1;
2331e5c31af7Sopenharmony_ci		GLuint program						=	ctx.glCreateProgram();
2332e5c31af7Sopenharmony_ci		GLuint computeShader				=	ctx.glCreateShader(GL_COMPUTE_SHADER);
2333e5c31af7Sopenharmony_ci		GLuint computeShader310				=	ctx.glCreateShader(GL_FRAGMENT_SHADER);
2334e5c31af7Sopenharmony_ci
2335e5c31af7Sopenharmony_ci		ctx.glShaderSource(computeShader, 1, &computeShaderSource, DE_NULL);
2336e5c31af7Sopenharmony_ci		ctx.glShaderSource(computeShader310, 1, &computeShaderSource310, DE_NULL);
2337e5c31af7Sopenharmony_ci		ctx.beginSection("Compute Shader should not be linked with shaders of different version.");
2338e5c31af7Sopenharmony_ci		ctx.glCompileShader(computeShader);
2339e5c31af7Sopenharmony_ci		ctx.glCompileShader(computeShader310);
2340e5c31af7Sopenharmony_ci		ctx.glAttachShader(program, computeShader);
2341e5c31af7Sopenharmony_ci		ctx.glAttachShader(program, computeShader310);
2342e5c31af7Sopenharmony_ci		ctx.glLinkProgram(program);
2343e5c31af7Sopenharmony_ci		ctx.glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
2344e5c31af7Sopenharmony_ci		ctx.glDeleteShader(computeShader310);
2345e5c31af7Sopenharmony_ci		ctx.glDeleteShader(computeShader);
2346e5c31af7Sopenharmony_ci		ctx.glDeleteProgram(program);
2347e5c31af7Sopenharmony_ci		if (linkStatus != GL_FALSE)
2348e5c31af7Sopenharmony_ci			ctx.fail("Program should not have linked");
2349e5c31af7Sopenharmony_ci		ctx.endSection();
2350e5c31af7Sopenharmony_ci	}
2351e5c31af7Sopenharmony_ci}
2352e5c31af7Sopenharmony_ci
2353e5c31af7Sopenharmony_civoid compile_compute_shader_helper (NegativeTestContext& ctx, const char* const* computeShaderSource, GLint* compileStatus)
2354e5c31af7Sopenharmony_ci{
2355e5c31af7Sopenharmony_ci	GLuint shader = ctx.glCreateShader(GL_COMPUTE_SHADER);
2356e5c31af7Sopenharmony_ci
2357e5c31af7Sopenharmony_ci	*compileStatus = -1;
2358e5c31af7Sopenharmony_ci	ctx.glShaderSource(shader, 1, computeShaderSource, DE_NULL);
2359e5c31af7Sopenharmony_ci	ctx.glCompileShader(shader);
2360e5c31af7Sopenharmony_ci	ctx.glGetShaderiv(shader, GL_COMPILE_STATUS, compileStatus);
2361e5c31af7Sopenharmony_ci	ctx.glDeleteShader(shader);
2362e5c31af7Sopenharmony_ci}
2363e5c31af7Sopenharmony_ci
2364e5c31af7Sopenharmony_civoid compile_compute_shader (NegativeTestContext& ctx)
2365e5c31af7Sopenharmony_ci{
2366e5c31af7Sopenharmony_ci	GLint compileStatus;
2367e5c31af7Sopenharmony_ci	ctx.beginSection("Compile Computer Shader");
2368e5c31af7Sopenharmony_ci
2369e5c31af7Sopenharmony_ci	{
2370e5c31af7Sopenharmony_ci		const char* const computeShaderSource		=	"#version 300 es\n"
2371e5c31af7Sopenharmony_ci														"void main (void)\n"
2372e5c31af7Sopenharmony_ci														"{\n"
2373e5c31af7Sopenharmony_ci														"}\n";
2374e5c31af7Sopenharmony_ci
2375e5c31af7Sopenharmony_ci		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2376e5c31af7Sopenharmony_ci		if (compileStatus != GL_FALSE)
2377e5c31af7Sopenharmony_ci			ctx.fail("Compute Shader should not have compiled with #version 300 es.");
2378e5c31af7Sopenharmony_ci	}
2379e5c31af7Sopenharmony_ci	{
2380e5c31af7Sopenharmony_ci		const char* const computeShaderSource		=	"#version 310 es\n"
2381e5c31af7Sopenharmony_ci														"buffer SSBO { vec4 data }"
2382e5c31af7Sopenharmony_ci														"void main (void)\n"
2383e5c31af7Sopenharmony_ci														"{\n"
2384e5c31af7Sopenharmony_ci														"}\n";
2385e5c31af7Sopenharmony_ci
2386e5c31af7Sopenharmony_ci		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2387e5c31af7Sopenharmony_ci		if (compileStatus != GL_FALSE)
2388e5c31af7Sopenharmony_ci			ctx.fail("Compute Shader should not have compiled: incorrect SSBO syntax.");
2389e5c31af7Sopenharmony_ci	}
2390e5c31af7Sopenharmony_ci	{
2391e5c31af7Sopenharmony_ci		const char* const computeShaderSource		=	"#version 310 es\n"
2392e5c31af7Sopenharmony_ci														"buffer SSBO { vec4 data;};"
2393e5c31af7Sopenharmony_ci														"uniform mat4 data;"
2394e5c31af7Sopenharmony_ci														"void main (void)\n"
2395e5c31af7Sopenharmony_ci														"{\n"
2396e5c31af7Sopenharmony_ci														"}\n";
2397e5c31af7Sopenharmony_ci
2398e5c31af7Sopenharmony_ci		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2399e5c31af7Sopenharmony_ci		if (compileStatus != GL_FALSE)
2400e5c31af7Sopenharmony_ci			ctx.fail("Compute Shader should not have compiled: buffer variable redefinition.");
2401e5c31af7Sopenharmony_ci	}
2402e5c31af7Sopenharmony_ci	{
2403e5c31af7Sopenharmony_ci		const char* const computeShaderSource		=	"#version 310 es\n"
2404e5c31af7Sopenharmony_ci														"buffer SSBO { vec4 data[]; vec4 moreData;};"
2405e5c31af7Sopenharmony_ci														"void main (void)\n"
2406e5c31af7Sopenharmony_ci														"{\n"
2407e5c31af7Sopenharmony_ci														"}\n";
2408e5c31af7Sopenharmony_ci
2409e5c31af7Sopenharmony_ci		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2410e5c31af7Sopenharmony_ci		if (compileStatus != GL_FALSE)
2411e5c31af7Sopenharmony_ci			ctx.fail("Compute Shader should not have compiled: unspecified length buffer member not at the end.");
2412e5c31af7Sopenharmony_ci	}
2413e5c31af7Sopenharmony_ci	{
2414e5c31af7Sopenharmony_ci		const char* const computeShaderSource		=	"#version 310 es\n"
2415e5c31af7Sopenharmony_ci														"in vec4 data;"
2416e5c31af7Sopenharmony_ci														"void main (void)\n"
2417e5c31af7Sopenharmony_ci														"{\n"
2418e5c31af7Sopenharmony_ci														"}\n";
2419e5c31af7Sopenharmony_ci
2420e5c31af7Sopenharmony_ci		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2421e5c31af7Sopenharmony_ci		if (compileStatus != GL_FALSE)
2422e5c31af7Sopenharmony_ci			ctx.fail("Compute Shader should not have compiled: input qualifier used.");
2423e5c31af7Sopenharmony_ci	}
2424e5c31af7Sopenharmony_ci	{
2425e5c31af7Sopenharmony_ci		const char* const computeShaderSource		=	"#version 310 es\n"
2426e5c31af7Sopenharmony_ci														"shared uint data = 0;";
2427e5c31af7Sopenharmony_ci
2428e5c31af7Sopenharmony_ci		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2429e5c31af7Sopenharmony_ci		if (compileStatus != GL_FALSE)
2430e5c31af7Sopenharmony_ci			ctx.fail("Compute Shader should not have compiled: shared-qualified variable initialized.");
2431e5c31af7Sopenharmony_ci	}
2432e5c31af7Sopenharmony_ci	{
2433e5c31af7Sopenharmony_ci		const char* const computeShaderSource		=	"#version 310 es\n"
2434e5c31af7Sopenharmony_ci														"buffer SSBO { vec4 data; vec4 moreData[];} ssbo;"
2435e5c31af7Sopenharmony_ci														"void test (vec4 data[10]) {}"
2436e5c31af7Sopenharmony_ci														"void main (void)\n"
2437e5c31af7Sopenharmony_ci														"{\n"
2438e5c31af7Sopenharmony_ci														"    test(ssbo.moreData);"
2439e5c31af7Sopenharmony_ci														"}\n";
2440e5c31af7Sopenharmony_ci
2441e5c31af7Sopenharmony_ci		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2442e5c31af7Sopenharmony_ci		if (compileStatus != GL_FALSE)
2443e5c31af7Sopenharmony_ci			ctx.fail("Compute Shader should not have compiled: unspecified length buffer member passed as argument to function.");
2444e5c31af7Sopenharmony_ci	}
2445e5c31af7Sopenharmony_ci	{
2446e5c31af7Sopenharmony_ci		const char* const computeShaderSource		=	"#version 310 es\n"
2447e5c31af7Sopenharmony_ci														"buffer SSBO { vec4 data; vec4 moreData[];} ssbo;"
2448e5c31af7Sopenharmony_ci														"void main (void)\n"
2449e5c31af7Sopenharmony_ci														"{\n"
2450e5c31af7Sopenharmony_ci														"    vec4 var = ssbo.moreData[-1];"
2451e5c31af7Sopenharmony_ci														"}\n";
2452e5c31af7Sopenharmony_ci
2453e5c31af7Sopenharmony_ci		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2454e5c31af7Sopenharmony_ci		if (compileStatus != GL_FALSE)
2455e5c31af7Sopenharmony_ci			ctx.fail("Compute Shader should not have compiled: unspecified length buffer member indexed with negative constant expression.");
2456e5c31af7Sopenharmony_ci	}
2457e5c31af7Sopenharmony_ci	{
2458e5c31af7Sopenharmony_ci		const char* const computeShaderSource		=	"#version 310 es\n"
2459e5c31af7Sopenharmony_ci														"layout(binding=-1) buffer SSBO { vec4 data;};"
2460e5c31af7Sopenharmony_ci														"void main (void)\n"
2461e5c31af7Sopenharmony_ci														"{\n"
2462e5c31af7Sopenharmony_ci														"}\n";
2463e5c31af7Sopenharmony_ci
2464e5c31af7Sopenharmony_ci		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2465e5c31af7Sopenharmony_ci		if (compileStatus != GL_FALSE)
2466e5c31af7Sopenharmony_ci			ctx.fail("Compute Shader should not have compiled: binding point less than zero.");
2467e5c31af7Sopenharmony_ci	}
2468e5c31af7Sopenharmony_ci	{
2469e5c31af7Sopenharmony_ci		const char* const computeShaderSource		=	"#version 310 es\n"
2470e5c31af7Sopenharmony_ci														"layout(binding=1) buffer;"
2471e5c31af7Sopenharmony_ci														"layout(binding=2) buffer SSBO { vec4 data;};"
2472e5c31af7Sopenharmony_ci														"void main (void)\n"
2473e5c31af7Sopenharmony_ci														"{\n"
2474e5c31af7Sopenharmony_ci														"}\n";
2475e5c31af7Sopenharmony_ci
2476e5c31af7Sopenharmony_ci		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2477e5c31af7Sopenharmony_ci		if (compileStatus != GL_FALSE)
2478e5c31af7Sopenharmony_ci			ctx.fail("Compute Shader should not have compiled: binding point specified for global scope.");
2479e5c31af7Sopenharmony_ci	}
2480e5c31af7Sopenharmony_ci	{
2481e5c31af7Sopenharmony_ci		const char* const computeShaderSource		=	"#version 310 es\n"
2482e5c31af7Sopenharmony_ci														"buffer SSBO {"
2483e5c31af7Sopenharmony_ci														"	layout(binding=1) vec4 data;"
2484e5c31af7Sopenharmony_ci														"	layout(binding=2) vec4 moreData[];"
2485e5c31af7Sopenharmony_ci														"} ssbo;"
2486e5c31af7Sopenharmony_ci														"void main (void)\n"
2487e5c31af7Sopenharmony_ci														"{\n"
2488e5c31af7Sopenharmony_ci														"}\n";
2489e5c31af7Sopenharmony_ci
2490e5c31af7Sopenharmony_ci		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2491e5c31af7Sopenharmony_ci		if (compileStatus != GL_FALSE)
2492e5c31af7Sopenharmony_ci			ctx.fail("Compute Shader should not have compiled: binding point specified for block member declarations.");
2493e5c31af7Sopenharmony_ci	}
2494e5c31af7Sopenharmony_ci	{
2495e5c31af7Sopenharmony_ci		const char* const computeShaderSource		=	"#version 310 es\n"
2496e5c31af7Sopenharmony_ci														"readonly buffer SSBO {vec4 data;} ssbo;"
2497e5c31af7Sopenharmony_ci														"void main (void)\n"
2498e5c31af7Sopenharmony_ci														"{\n"
2499e5c31af7Sopenharmony_ci															"ssbo.data = vec4(1, 1, 1, 1);"
2500e5c31af7Sopenharmony_ci														"}\n";
2501e5c31af7Sopenharmony_ci
2502e5c31af7Sopenharmony_ci		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2503e5c31af7Sopenharmony_ci		if (compileStatus != GL_FALSE)
2504e5c31af7Sopenharmony_ci			ctx.fail("Compute Shader should not have compiled: writing to buffer block qualified with readonly.");
2505e5c31af7Sopenharmony_ci	}
2506e5c31af7Sopenharmony_ci	{
2507e5c31af7Sopenharmony_ci		const char* const computeShaderSource		=	"#version 310 es\n"
2508e5c31af7Sopenharmony_ci														"writeonly buffer SSBO {vec4 data;} ssbo;"
2509e5c31af7Sopenharmony_ci														"void main (void)\n"
2510e5c31af7Sopenharmony_ci														"{\n"
2511e5c31af7Sopenharmony_ci															"vec4 var = ssbo.data;"
2512e5c31af7Sopenharmony_ci														"}\n";
2513e5c31af7Sopenharmony_ci
2514e5c31af7Sopenharmony_ci		compile_compute_shader_helper(ctx, &computeShaderSource, &compileStatus);
2515e5c31af7Sopenharmony_ci		if (compileStatus != GL_FALSE)
2516e5c31af7Sopenharmony_ci			ctx.fail("Compute Shader should not have compiled: reading from buffer block qualified with writeonly.");
2517e5c31af7Sopenharmony_ci	}
2518e5c31af7Sopenharmony_ci
2519e5c31af7Sopenharmony_ci	ctx.endSection();
2520e5c31af7Sopenharmony_ci}
2521e5c31af7Sopenharmony_ci
2522e5c31af7Sopenharmony_civoid srgb_decode_samplerparameteri (NegativeTestContext& ctx)
2523e5c31af7Sopenharmony_ci{
2524e5c31af7Sopenharmony_ci	if (!ctx.isExtensionSupported("GL_EXT_texture_sRGB_decode"))
2525e5c31af7Sopenharmony_ci		TCU_THROW(NotSupportedError, "GL_EXT_texture_sRGB_decode is not supported.");
2526e5c31af7Sopenharmony_ci
2527e5c31af7Sopenharmony_ci	GLuint	sampler		= 0x1234;
2528e5c31af7Sopenharmony_ci	GLint	samplerMode	= -1;
2529e5c31af7Sopenharmony_ci
2530e5c31af7Sopenharmony_ci	ctx.glGenSamplers(1, &sampler);
2531e5c31af7Sopenharmony_ci
2532e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if pname is GL_TEXTURE_SRGB_DECODE_EXT and the value of param(s) is not a valid value (one of DECODE_EXT, or SKIP_DECODE_EXT).");
2533e5c31af7Sopenharmony_ci	ctx.glSamplerParameteri(sampler, GL_TEXTURE_SRGB_DECODE_EXT, samplerMode);
2534e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_ENUM);
2535e5c31af7Sopenharmony_ci	ctx.endSection();
2536e5c31af7Sopenharmony_ci
2537e5c31af7Sopenharmony_ci	ctx.glDeleteSamplers(1, &sampler);
2538e5c31af7Sopenharmony_ci}
2539e5c31af7Sopenharmony_ci
2540e5c31af7Sopenharmony_civoid srgb_decode_samplerparameterf (NegativeTestContext& ctx)
2541e5c31af7Sopenharmony_ci{
2542e5c31af7Sopenharmony_ci	if (!ctx.isExtensionSupported("GL_EXT_texture_sRGB_decode"))
2543e5c31af7Sopenharmony_ci		TCU_THROW(NotSupportedError, "GL_EXT_texture_sRGB_decode is not supported.");
2544e5c31af7Sopenharmony_ci
2545e5c31af7Sopenharmony_ci	GLuint	sampler	= 0x1234;
2546e5c31af7Sopenharmony_ci	GLfloat	samplerMode	= -1.0f;
2547e5c31af7Sopenharmony_ci
2548e5c31af7Sopenharmony_ci	ctx.glGenSamplers(1, &sampler);
2549e5c31af7Sopenharmony_ci
2550e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if pname is GL_TEXTURE_SRGB_DECODE_EXT and the value of param(s) is not a valid value (one of DECODE_EXT, or SKIP_DECODE_EXT).");
2551e5c31af7Sopenharmony_ci	ctx.glSamplerParameterf(sampler, GL_TEXTURE_SRGB_DECODE_EXT, samplerMode);
2552e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_ENUM);
2553e5c31af7Sopenharmony_ci	ctx.endSection();
2554e5c31af7Sopenharmony_ci
2555e5c31af7Sopenharmony_ci	ctx.glDeleteSamplers(1, &sampler);
2556e5c31af7Sopenharmony_ci}
2557e5c31af7Sopenharmony_ci
2558e5c31af7Sopenharmony_civoid srgb_decode_samplerparameteriv (NegativeTestContext& ctx)
2559e5c31af7Sopenharmony_ci{
2560e5c31af7Sopenharmony_ci	if (!ctx.isExtensionSupported("GL_EXT_texture_sRGB_decode"))
2561e5c31af7Sopenharmony_ci		TCU_THROW(NotSupportedError, "GL_EXT_texture_sRGB_decode is not supported.");
2562e5c31af7Sopenharmony_ci
2563e5c31af7Sopenharmony_ci	int		params[1]	= { GL_LINEAR };
2564e5c31af7Sopenharmony_ci	GLuint	sampler		= 0x1234;
2565e5c31af7Sopenharmony_ci
2566e5c31af7Sopenharmony_ci	ctx.glGenSamplers(1, &sampler);
2567e5c31af7Sopenharmony_ci
2568e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if pname is GL_TEXTURE_SRGB_DECODE_EXT and the value of param(s) is not a valid value (one of DECODE_EXT, or SKIP_DECODE_EXT).");
2569e5c31af7Sopenharmony_ci	params[0] = -1;
2570e5c31af7Sopenharmony_ci	ctx.glSamplerParameteriv(sampler, GL_TEXTURE_SRGB_DECODE_EXT, &params[0]);
2571e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_ENUM);
2572e5c31af7Sopenharmony_ci	ctx.endSection();
2573e5c31af7Sopenharmony_ci
2574e5c31af7Sopenharmony_ci	ctx.glDeleteSamplers(1, &sampler);
2575e5c31af7Sopenharmony_ci}
2576e5c31af7Sopenharmony_ci
2577e5c31af7Sopenharmony_civoid srgb_decode_samplerparameterfv (NegativeTestContext& ctx)
2578e5c31af7Sopenharmony_ci{
2579e5c31af7Sopenharmony_ci	if (!ctx.isExtensionSupported("GL_EXT_texture_sRGB_decode"))
2580e5c31af7Sopenharmony_ci		TCU_THROW(NotSupportedError, "GL_EXT_texture_sRGB_decode is not supported.");
2581e5c31af7Sopenharmony_ci
2582e5c31af7Sopenharmony_ci	float	params[1]	= { GL_LINEAR };
2583e5c31af7Sopenharmony_ci	GLuint	sampler		= 0x1234;
2584e5c31af7Sopenharmony_ci
2585e5c31af7Sopenharmony_ci	ctx.glGenSamplers(1, &sampler);
2586e5c31af7Sopenharmony_ci
2587e5c31af7Sopenharmony_ci	params[0] = -1.0f;
2588e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if pname is GL_TEXTURE_SRGB_DECODE_EXT and the value of param(s) is not a valid value (one of DECODE_EXT, or SKIP_DECODE_EXT).");
2589e5c31af7Sopenharmony_ci	ctx.glSamplerParameterfv(sampler, GL_TEXTURE_SRGB_DECODE_EXT, &params[0]);
2590e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_ENUM);
2591e5c31af7Sopenharmony_ci	ctx.endSection();
2592e5c31af7Sopenharmony_ci
2593e5c31af7Sopenharmony_ci	ctx.glDeleteSamplers(1, &sampler);
2594e5c31af7Sopenharmony_ci}
2595e5c31af7Sopenharmony_ci
2596e5c31af7Sopenharmony_civoid srgb_decode_samplerparameterIiv (NegativeTestContext& ctx)
2597e5c31af7Sopenharmony_ci{
2598e5c31af7Sopenharmony_ci	if (!supportsES32orGL45(ctx))
2599e5c31af7Sopenharmony_ci		TCU_THROW(NotSupportedError, "glSamplerParameterIiv is not supported.");
2600e5c31af7Sopenharmony_ci
2601e5c31af7Sopenharmony_ci	if (!ctx.isExtensionSupported("GL_EXT_texture_sRGB_decode"))
2602e5c31af7Sopenharmony_ci		TCU_THROW(NotSupportedError, "GL_EXT_texture_sRGB_decode is not supported.");
2603e5c31af7Sopenharmony_ci
2604e5c31af7Sopenharmony_ci	GLint	samplerMode[]	= {GL_DEPTH_COMPONENT, GL_STENCIL_INDEX};
2605e5c31af7Sopenharmony_ci	GLuint	sampler			= 0x1234;
2606e5c31af7Sopenharmony_ci
2607e5c31af7Sopenharmony_ci	ctx.glGenSamplers(1, &sampler);
2608e5c31af7Sopenharmony_ci
2609e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if pname is GL_TEXTURE_SRGB_DECODE_EXT and the value of param(s) is not a valid value (one of DECODE_EXT, or SKIP_DECODE_EXT).");
2610e5c31af7Sopenharmony_ci	samplerMode[0] = -1;
2611e5c31af7Sopenharmony_ci	samplerMode[1] = -1;
2612e5c31af7Sopenharmony_ci	ctx.glSamplerParameterIiv(sampler, GL_TEXTURE_SRGB_DECODE_EXT, samplerMode);
2613e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_ENUM);
2614e5c31af7Sopenharmony_ci	ctx.endSection();
2615e5c31af7Sopenharmony_ci
2616e5c31af7Sopenharmony_ci	ctx.glDeleteSamplers(1, &sampler);
2617e5c31af7Sopenharmony_ci}
2618e5c31af7Sopenharmony_ci
2619e5c31af7Sopenharmony_civoid srgb_decode_samplerparameterIuiv (NegativeTestContext& ctx)
2620e5c31af7Sopenharmony_ci{
2621e5c31af7Sopenharmony_ci	if (!supportsES32orGL45(ctx))
2622e5c31af7Sopenharmony_ci		TCU_THROW(NotSupportedError, "glSamplerParameterIuiv is not supported.");
2623e5c31af7Sopenharmony_ci
2624e5c31af7Sopenharmony_ci	if (!ctx.isExtensionSupported("GL_EXT_texture_sRGB_decode"))
2625e5c31af7Sopenharmony_ci		TCU_THROW(NotSupportedError, "GL_EXT_texture_sRGB_decode is not supported.");
2626e5c31af7Sopenharmony_ci
2627e5c31af7Sopenharmony_ci	GLuint	samplerMode[]	= {GL_DEPTH_COMPONENT, GL_STENCIL_INDEX};
2628e5c31af7Sopenharmony_ci	GLuint	sampler			= 0x1234;
2629e5c31af7Sopenharmony_ci
2630e5c31af7Sopenharmony_ci	ctx.glGenSamplers(1, &sampler);
2631e5c31af7Sopenharmony_ci
2632e5c31af7Sopenharmony_ci	ctx.beginSection("GL_INVALID_ENUM is generated if pname is GL_TEXTURE_SRGB_DECODE_EXT and the value of param(s) is not a valid value (one of DECODE_EXT, or SKIP_DECODE_EXT).");
2633e5c31af7Sopenharmony_ci	samplerMode[0] = GL_DONT_CARE;
2634e5c31af7Sopenharmony_ci	samplerMode[1] = GL_DONT_CARE;
2635e5c31af7Sopenharmony_ci	ctx.glSamplerParameterIuiv(sampler, GL_TEXTURE_SRGB_DECODE_EXT, samplerMode);
2636e5c31af7Sopenharmony_ci	ctx.expectError(GL_INVALID_ENUM);
2637e5c31af7Sopenharmony_ci	ctx.endSection();
2638e5c31af7Sopenharmony_ci
2639e5c31af7Sopenharmony_ci	ctx.glDeleteSamplers(1, &sampler);
2640e5c31af7Sopenharmony_ci}
2641e5c31af7Sopenharmony_ci
2642e5c31af7Sopenharmony_cistd::vector<FunctionContainer> getNegativeShaderApiTestFunctions ()
2643e5c31af7Sopenharmony_ci{
2644e5c31af7Sopenharmony_ci	FunctionContainer funcs[] =
2645e5c31af7Sopenharmony_ci	{
2646e5c31af7Sopenharmony_ci		{create_shader,							"create_shader",						"Invalid glCreateShader() usage"			   },
2647e5c31af7Sopenharmony_ci		{shader_source,							"shader_source",						"Invalid glShaderSource() usage"			   },
2648e5c31af7Sopenharmony_ci		{compile_shader,						"compile_shader",						"Invalid glCompileShader() usage"			   },
2649e5c31af7Sopenharmony_ci		{delete_shader,							"delete_shader",						"Invalid glDeleteShader() usage"			   },
2650e5c31af7Sopenharmony_ci		{shader_binary,							"shader_binary",						"Invalid glShaderBinary() usage"			   },
2651e5c31af7Sopenharmony_ci		{attach_shader,							"attach_shader",						"Invalid glAttachShader() usage"			   },
2652e5c31af7Sopenharmony_ci		{detach_shader,							"detach_shader",						"Invalid glDetachShader() usage"			   },
2653e5c31af7Sopenharmony_ci		{link_program,							"link_program",							"Invalid glLinkProgram() usage"				   },
2654e5c31af7Sopenharmony_ci		{use_program,							"use_program",							"Invalid glUseProgram() usage"				   },
2655e5c31af7Sopenharmony_ci		{delete_program,						"delete_program",						"Invalid glDeleteProgram() usage"			   },
2656e5c31af7Sopenharmony_ci		{validate_program,						"validate_program",						"Invalid glValidateProgram() usage"			   },
2657e5c31af7Sopenharmony_ci		{get_program_binary,					"get_program_binary",					"Invalid glGetProgramBinary() usage"		   },
2658e5c31af7Sopenharmony_ci		{program_binary,						"program_binary",						"Invalid glProgramBinary() usage"			   },
2659e5c31af7Sopenharmony_ci		{program_parameteri,					"program_parameteri",					"Invalid glProgramParameteri() usage"		   },
2660e5c31af7Sopenharmony_ci		{gen_samplers,							"gen_samplers",							"Invalid glGenSamplers() usage"				   },
2661e5c31af7Sopenharmony_ci		{bind_sampler,							"bind_sampler",							"Invalid glBindSampler() usage"				   },
2662e5c31af7Sopenharmony_ci		{delete_samplers,						"delete_samplers",						"Invalid glDeleteSamplers() usage"			   },
2663e5c31af7Sopenharmony_ci		{get_sampler_parameteriv,				"get_sampler_parameteriv",				"Invalid glGetSamplerParameteriv() usage"	   },
2664e5c31af7Sopenharmony_ci		{get_sampler_parameterfv,				"get_sampler_parameterfv",				"Invalid glGetSamplerParameterfv() usage"	   },
2665e5c31af7Sopenharmony_ci		{get_sampler_parameterIiv,				"get_sampler_parameterIiv",				"Invalid glGetSamplerParameterIiv() usage"	   },
2666e5c31af7Sopenharmony_ci		{get_sampler_parameterIuiv,				"get_sampler_parameterIuiv",			"Invalid glGetSamplerParameterIuiv() usage"	   },
2667e5c31af7Sopenharmony_ci		{sampler_parameteri,					"sampler_parameteri",					"Invalid glSamplerParameteri() usage"		   },
2668e5c31af7Sopenharmony_ci		{sampler_parameteriv,					"sampler_parameteriv",					"Invalid glSamplerParameteriv() usage"		   },
2669e5c31af7Sopenharmony_ci		{sampler_parameterf,					"sampler_parameterf",					"Invalid glSamplerParameterf() usage"		   },
2670e5c31af7Sopenharmony_ci		{sampler_parameterfv,					"sampler_parameterfv",					"Invalid glSamplerParameterfv() usage"		   },
2671e5c31af7Sopenharmony_ci		{sampler_parameterIiv,					"sampler_parameterIiv",					"Invalid glSamplerParameterIiv() usage"		   },
2672e5c31af7Sopenharmony_ci		{sampler_parameterIuiv,					"sampler_parameterIuiv",				"Invalid glSamplerParameterIuiv() usage"	   },
2673e5c31af7Sopenharmony_ci		{get_attrib_location,					"get_attrib_location",					"Invalid glGetAttribLocation() usage"		   },
2674e5c31af7Sopenharmony_ci		{get_uniform_location,					"get_uniform_location",					"Invalid glGetUniformLocation() usage"		   },
2675e5c31af7Sopenharmony_ci		{bind_attrib_location,					"bind_attrib_location",					"Invalid glBindAttribLocation() usage"		   },
2676e5c31af7Sopenharmony_ci		{uniform_block_binding,					"uniform_block_binding",				"Invalid glUniformBlockBinding() usage"		   },
2677e5c31af7Sopenharmony_ci		{uniformf_invalid_program,				"uniformf_invalid_program",				"Invalid glUniform{1234}f() usage"			   },
2678e5c31af7Sopenharmony_ci		{uniformf_incompatible_type,			"uniformf_incompatible_type",			"Invalid glUniform{1234}f() usage"			   },
2679e5c31af7Sopenharmony_ci		{uniformf_invalid_location,				"uniformf_invalid_location",			"Invalid glUniform{1234}f() usage"			   },
2680e5c31af7Sopenharmony_ci		{uniformfv_invalid_program,				"uniformfv_invalid_program",			"Invalid glUniform{1234}fv() usage"			   },
2681e5c31af7Sopenharmony_ci		{uniformfv_incompatible_type,			"uniformfv_incompatible_type",			"Invalid glUniform{1234}fv() usage"			   },
2682e5c31af7Sopenharmony_ci		{uniformfv_invalid_location,			"uniformfv_invalid_location",			"Invalid glUniform{1234}fv() usage"			   },
2683e5c31af7Sopenharmony_ci		{uniformfv_invalid_count,				"uniformfv_invalid_count",				"Invalid glUniform{1234}fv() usage"			   },
2684e5c31af7Sopenharmony_ci		{uniformi_invalid_program,				"uniformi_invalid_program",				"Invalid glUniform{1234}i() usage"			   },
2685e5c31af7Sopenharmony_ci		{uniformi_incompatible_type,			"uniformi_incompatible_type",			"Invalid glUniform{1234}i() usage"			   },
2686e5c31af7Sopenharmony_ci		{uniformi_invalid_location,				"uniformi_invalid_location",			"Invalid glUniform{1234}i() usage"			   },
2687e5c31af7Sopenharmony_ci		{uniformiv_invalid_program,				"uniformiv_invalid_program",			"Invalid glUniform{1234}iv() usage"			   },
2688e5c31af7Sopenharmony_ci		{uniformiv_incompatible_type,			"uniformiv_incompatible_type",			"Invalid glUniform{1234}iv() usage"			   },
2689e5c31af7Sopenharmony_ci		{uniformiv_invalid_location,			"uniformiv_invalid_location",			"Invalid glUniform{1234}iv() usage"			   },
2690e5c31af7Sopenharmony_ci		{uniformiv_invalid_count,				"uniformiv_invalid_count",				"Invalid glUniform{1234}iv() usage"			   },
2691e5c31af7Sopenharmony_ci		{uniformui_invalid_program,				"uniformui_invalid_program",			"Invalid glUniform{234}ui() usage"			   },
2692e5c31af7Sopenharmony_ci		{uniformui_incompatible_type,			"uniformui_incompatible_type",			"Invalid glUniform{1234}ui() usage"			   },
2693e5c31af7Sopenharmony_ci		{uniformui_invalid_location,			"uniformui_invalid_location",			"Invalid glUniform{1234}ui() usage"			   },
2694e5c31af7Sopenharmony_ci		{uniformuiv_invalid_program,			"uniformuiv_invalid_program",			"Invalid glUniform{234}uiv() usage"			   },
2695e5c31af7Sopenharmony_ci		{uniformuiv_incompatible_type,			"uniformuiv_incompatible_type",			"Invalid glUniform{1234}uiv() usage"		   },
2696e5c31af7Sopenharmony_ci		{uniformuiv_invalid_location,			"uniformuiv_invalid_location",			"Invalid glUniform{1234}uiv() usage"		   },
2697e5c31af7Sopenharmony_ci		{uniformuiv_invalid_count,				"uniformuiv_invalid_count",				"Invalid glUniform{1234}uiv() usage"		   },
2698e5c31af7Sopenharmony_ci		{uniform_matrixfv_invalid_program,		"uniform_matrixfv_invalid_program",		"Invalid glUniformMatrix{234}fv() usage"	   },
2699e5c31af7Sopenharmony_ci		{uniform_matrixfv_incompatible_type,	"uniform_matrixfv_incompatible_type",	"Invalid glUniformMatrix{234}fv() usage"	   },
2700e5c31af7Sopenharmony_ci		{uniform_matrixfv_invalid_location,		"uniform_matrixfv_invalid_location",	"Invalid glUniformMatrix{234}fv() usage"	   },
2701e5c31af7Sopenharmony_ci		{uniform_matrixfv_invalid_count,		"uniform_matrixfv_invalid_count",		"Invalid glUniformMatrix{234}fv() usage"	   },
2702e5c31af7Sopenharmony_ci		{gen_transform_feedbacks,				"gen_transform_feedbacks",				"Invalid glGenTransformFeedbacks() usage"	   },
2703e5c31af7Sopenharmony_ci		{bind_transform_feedback,				"bind_transform_feedback",				"Invalid glBindTransformFeedback() usage"	   },
2704e5c31af7Sopenharmony_ci		{delete_transform_feedbacks,			"delete_transform_feedbacks",			"Invalid glDeleteTransformFeedbacks() usage"   },
2705e5c31af7Sopenharmony_ci		{begin_transform_feedback,				"begin_transform_feedback",				"Invalid glBeginTransformFeedback() usage"	   },
2706e5c31af7Sopenharmony_ci		{pause_transform_feedback,				"pause_transform_feedback",				"Invalid glPauseTransformFeedback() usage"	   },
2707e5c31af7Sopenharmony_ci		{resume_transform_feedback,				"resume_transform_feedback",			"Invalid glResumeTransformFeedback() usage"	   },
2708e5c31af7Sopenharmony_ci		{end_transform_feedback,				"end_transform_feedback",				"Invalid glEndTransformFeedback() usage"	   },
2709e5c31af7Sopenharmony_ci		{get_transform_feedback_varying,		"get_transform_feedback_varying",		"Invalid glGetTransformFeedbackVarying() usage"},
2710e5c31af7Sopenharmony_ci		{transform_feedback_varyings,			"transform_feedback_varyings",			"Invalid glTransformFeedbackVaryings() usage"  },
2711e5c31af7Sopenharmony_ci		{compile_compute_shader,				"compile_compute_shader",				"Invalid Compute Shader compilation"		   },
2712e5c31af7Sopenharmony_ci		{link_compute_shader,					"link_compute_shader",					"Invalid Compute Shader linkage"			   },
2713e5c31af7Sopenharmony_ci		{srgb_decode_samplerparameteri,			"srgb_decode_samplerparameteri",		"Invalid glSamplerParameteri() usage srgb"	   },
2714e5c31af7Sopenharmony_ci		{srgb_decode_samplerparameterf,			"srgb_decode_samplerparameterf",		"Invalid glSamplerParameterf() usage srgb"	   },
2715e5c31af7Sopenharmony_ci		{srgb_decode_samplerparameteriv,		"srgb_decode_samplerparameteriv",		"Invalid glSamplerParameteriv() usage srgb"	   },
2716e5c31af7Sopenharmony_ci		{srgb_decode_samplerparameterfv,		"srgb_decode_samplerparameterfv",		"Invalid glSamplerParameterfv() usage srgb"	   },
2717e5c31af7Sopenharmony_ci		{srgb_decode_samplerparameterIiv,		"srgb_decode_samplerparameterIiv",		"Invalid glSamplerParameterIiv() usage srgb"   },
2718e5c31af7Sopenharmony_ci		{srgb_decode_samplerparameterIuiv,		"srgb_decode_samplerparameterIuiv",		"Invalid glSamplerParameterIiuv() usage srgb"  },
2719e5c31af7Sopenharmony_ci	};
2720e5c31af7Sopenharmony_ci
2721e5c31af7Sopenharmony_ci	return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
2722e5c31af7Sopenharmony_ci}
2723e5c31af7Sopenharmony_ci
2724e5c31af7Sopenharmony_ci} // NegativeTestShared
2725e5c31af7Sopenharmony_ci} // Functional
2726e5c31af7Sopenharmony_ci} // gles31
2727e5c31af7Sopenharmony_ci} // deqp
2728