1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program OpenGL ES 3.0 Module
3*35238bceSAndroid Build Coastguard Worker * -------------------------------------------------
4*35238bceSAndroid Build Coastguard Worker *
5*35238bceSAndroid Build Coastguard Worker * Copyright 2014 The Android Open Source Project
6*35238bceSAndroid Build Coastguard Worker *
7*35238bceSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
8*35238bceSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
9*35238bceSAndroid Build Coastguard Worker * You may obtain a copy of the License at
10*35238bceSAndroid Build Coastguard Worker *
11*35238bceSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0
12*35238bceSAndroid Build Coastguard Worker *
13*35238bceSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
14*35238bceSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
15*35238bceSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16*35238bceSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
17*35238bceSAndroid Build Coastguard Worker * limitations under the License.
18*35238bceSAndroid Build Coastguard Worker *
19*35238bceSAndroid Build Coastguard Worker *//*!
20*35238bceSAndroid Build Coastguard Worker * \file
21*35238bceSAndroid Build Coastguard Worker * \brief Negative GL State API tests.
22*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker
24*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeStateApiTests.hpp"
25*35238bceSAndroid Build Coastguard Worker
26*35238bceSAndroid Build Coastguard Worker #include "gluCallLogWrapper.hpp"
27*35238bceSAndroid Build Coastguard Worker #include "gluContextInfo.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "gluShaderProgram.hpp"
29*35238bceSAndroid Build Coastguard Worker
30*35238bceSAndroid Build Coastguard Worker #include "glwDefs.hpp"
31*35238bceSAndroid Build Coastguard Worker #include "glwEnums.hpp"
32*35238bceSAndroid Build Coastguard Worker
33*35238bceSAndroid Build Coastguard Worker #include "tcuStringTemplate.hpp"
34*35238bceSAndroid Build Coastguard Worker
35*35238bceSAndroid Build Coastguard Worker #include "deMemory.h"
36*35238bceSAndroid Build Coastguard Worker
37*35238bceSAndroid Build Coastguard Worker #include <string>
38*35238bceSAndroid Build Coastguard Worker #include <map>
39*35238bceSAndroid Build Coastguard Worker
40*35238bceSAndroid Build Coastguard Worker namespace deqp
41*35238bceSAndroid Build Coastguard Worker {
42*35238bceSAndroid Build Coastguard Worker namespace gles31
43*35238bceSAndroid Build Coastguard Worker {
44*35238bceSAndroid Build Coastguard Worker namespace Functional
45*35238bceSAndroid Build Coastguard Worker {
46*35238bceSAndroid Build Coastguard Worker namespace NegativeTestShared
47*35238bceSAndroid Build Coastguard Worker {
48*35238bceSAndroid Build Coastguard Worker
49*35238bceSAndroid Build Coastguard Worker using glu::CallLogWrapper;
50*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
51*35238bceSAndroid Build Coastguard Worker using namespace glw;
52*35238bceSAndroid Build Coastguard Worker
53*35238bceSAndroid Build Coastguard Worker static const char *uniformTestVertSource = "${GLSL_VERSION_DECL}\n"
54*35238bceSAndroid Build Coastguard Worker "uniform mediump vec4 vUnif_vec4;\n"
55*35238bceSAndroid Build Coastguard Worker "in mediump vec4 attr;"
56*35238bceSAndroid Build Coastguard Worker "layout(shared) uniform Block { mediump vec4 blockVar; };\n"
57*35238bceSAndroid Build Coastguard Worker "void main (void)\n"
58*35238bceSAndroid Build Coastguard Worker "{\n"
59*35238bceSAndroid Build Coastguard Worker " gl_Position = vUnif_vec4 + blockVar + attr;\n"
60*35238bceSAndroid Build Coastguard Worker "}\n\0";
61*35238bceSAndroid Build Coastguard Worker
62*35238bceSAndroid Build Coastguard Worker static const char *uniformTestFragSource = "${GLSL_VERSION_DECL}\n"
63*35238bceSAndroid Build Coastguard Worker "uniform mediump ivec4 fUnif_ivec4;\n"
64*35238bceSAndroid Build Coastguard Worker "uniform mediump uvec4 fUnif_uvec4;\n"
65*35238bceSAndroid Build Coastguard Worker "layout(location = 0) out mediump vec4 fragColor;"
66*35238bceSAndroid Build Coastguard Worker "void main (void)\n"
67*35238bceSAndroid Build Coastguard Worker "{\n"
68*35238bceSAndroid Build Coastguard Worker " fragColor = vec4(vec4(fUnif_ivec4) + vec4(fUnif_uvec4));\n"
69*35238bceSAndroid Build Coastguard Worker "}\n\0";
70*35238bceSAndroid Build Coastguard Worker
71*35238bceSAndroid Build Coastguard Worker // Helper class that enables tests to be executed on GL4.5 context
72*35238bceSAndroid Build Coastguard Worker // and removes code redundancy in each test that requires it.
73*35238bceSAndroid Build Coastguard Worker class VAOHelper
74*35238bceSAndroid Build Coastguard Worker {
75*35238bceSAndroid Build Coastguard Worker public:
VAOHelper(NegativeTestContext & ctx)76*35238bceSAndroid Build Coastguard Worker VAOHelper(NegativeTestContext &ctx) : m_vao(0), m_ctx(ctx)
77*35238bceSAndroid Build Coastguard Worker {
78*35238bceSAndroid Build Coastguard Worker // tests need vao only for GL4.5 context
79*35238bceSAndroid Build Coastguard Worker if (glu::isContextTypeES(ctx.getRenderContext().getType()))
80*35238bceSAndroid Build Coastguard Worker return;
81*35238bceSAndroid Build Coastguard Worker
82*35238bceSAndroid Build Coastguard Worker m_ctx.glGenVertexArrays(1, &m_vao);
83*35238bceSAndroid Build Coastguard Worker m_ctx.glBindVertexArray(m_vao);
84*35238bceSAndroid Build Coastguard Worker }
85*35238bceSAndroid Build Coastguard Worker
~VAOHelper()86*35238bceSAndroid Build Coastguard Worker ~VAOHelper()
87*35238bceSAndroid Build Coastguard Worker {
88*35238bceSAndroid Build Coastguard Worker if (m_vao)
89*35238bceSAndroid Build Coastguard Worker m_ctx.glDeleteVertexArrays(1, &m_vao);
90*35238bceSAndroid Build Coastguard Worker }
91*35238bceSAndroid Build Coastguard Worker
92*35238bceSAndroid Build Coastguard Worker private:
93*35238bceSAndroid Build Coastguard Worker GLuint m_vao;
94*35238bceSAndroid Build Coastguard Worker NegativeTestContext &m_ctx;
95*35238bceSAndroid Build Coastguard Worker };
96*35238bceSAndroid Build Coastguard Worker
getVtxFragVersionSources(const std::string source,NegativeTestContext & ctx)97*35238bceSAndroid Build Coastguard Worker static std::string getVtxFragVersionSources(const std::string source, NegativeTestContext &ctx)
98*35238bceSAndroid Build Coastguard Worker {
99*35238bceSAndroid Build Coastguard Worker const bool supportsES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
100*35238bceSAndroid Build Coastguard Worker
101*35238bceSAndroid Build Coastguard Worker std::map<std::string, std::string> args;
102*35238bceSAndroid Build Coastguard Worker
103*35238bceSAndroid Build Coastguard Worker args["GLSL_VERSION_DECL"] = supportsES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) :
104*35238bceSAndroid Build Coastguard Worker getGLSLVersionDeclaration(glu::GLSL_VERSION_300_ES);
105*35238bceSAndroid Build Coastguard Worker
106*35238bceSAndroid Build Coastguard Worker return tcu::StringTemplate(source).specialize(args);
107*35238bceSAndroid Build Coastguard Worker }
108*35238bceSAndroid Build Coastguard Worker
109*35238bceSAndroid Build Coastguard Worker // Enabling & disabling states
enable(NegativeTestContext & ctx)110*35238bceSAndroid Build Coastguard Worker void enable(NegativeTestContext &ctx)
111*35238bceSAndroid Build Coastguard Worker {
112*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if cap is not one of the allowed values.");
113*35238bceSAndroid Build Coastguard Worker ctx.glEnable(-1);
114*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
115*35238bceSAndroid Build Coastguard Worker ctx.endSection();
116*35238bceSAndroid Build Coastguard Worker }
117*35238bceSAndroid Build Coastguard Worker
checkSupport(NegativeTestContext & ctx)118*35238bceSAndroid Build Coastguard Worker static bool checkSupport(NegativeTestContext &ctx)
119*35238bceSAndroid Build Coastguard Worker {
120*35238bceSAndroid Build Coastguard Worker return contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) ||
121*35238bceSAndroid Build Coastguard Worker contextSupports(ctx.getRenderContext().getType(), glu::ApiType::core(4, 5));
122*35238bceSAndroid Build Coastguard Worker }
123*35238bceSAndroid Build Coastguard Worker
124*35238bceSAndroid Build Coastguard Worker // Enabling & disabling states
enablei(NegativeTestContext & ctx)125*35238bceSAndroid Build Coastguard Worker void enablei(NegativeTestContext &ctx)
126*35238bceSAndroid Build Coastguard Worker {
127*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version.");
128*35238bceSAndroid Build Coastguard Worker
129*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if cap is not one of the allowed values.");
130*35238bceSAndroid Build Coastguard Worker ctx.glEnablei(-1, -1);
131*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
132*35238bceSAndroid Build Coastguard Worker ctx.endSection();
133*35238bceSAndroid Build Coastguard Worker
134*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to the number of indexed "
135*35238bceSAndroid Build Coastguard Worker "capabilities for cap.");
136*35238bceSAndroid Build Coastguard Worker ctx.glEnablei(GL_BLEND, -1);
137*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
138*35238bceSAndroid Build Coastguard Worker ctx.endSection();
139*35238bceSAndroid Build Coastguard Worker }
140*35238bceSAndroid Build Coastguard Worker
disable(NegativeTestContext & ctx)141*35238bceSAndroid Build Coastguard Worker void disable(NegativeTestContext &ctx)
142*35238bceSAndroid Build Coastguard Worker {
143*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if cap is not one of the allowed values.");
144*35238bceSAndroid Build Coastguard Worker ctx.glDisable(-1);
145*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
146*35238bceSAndroid Build Coastguard Worker ctx.endSection();
147*35238bceSAndroid Build Coastguard Worker }
148*35238bceSAndroid Build Coastguard Worker
disablei(NegativeTestContext & ctx)149*35238bceSAndroid Build Coastguard Worker void disablei(NegativeTestContext &ctx)
150*35238bceSAndroid Build Coastguard Worker {
151*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version.");
152*35238bceSAndroid Build Coastguard Worker
153*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if cap is not one of the allowed values.");
154*35238bceSAndroid Build Coastguard Worker ctx.glDisablei(-1, -1);
155*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
156*35238bceSAndroid Build Coastguard Worker ctx.endSection();
157*35238bceSAndroid Build Coastguard Worker
158*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to the number of indexed "
159*35238bceSAndroid Build Coastguard Worker "capabilities for cap.");
160*35238bceSAndroid Build Coastguard Worker ctx.glDisablei(GL_BLEND, -1);
161*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
162*35238bceSAndroid Build Coastguard Worker ctx.endSection();
163*35238bceSAndroid Build Coastguard Worker }
164*35238bceSAndroid Build Coastguard Worker
165*35238bceSAndroid Build Coastguard Worker // Simple state queries
get_booleanv(NegativeTestContext & ctx)166*35238bceSAndroid Build Coastguard Worker void get_booleanv(NegativeTestContext &ctx)
167*35238bceSAndroid Build Coastguard Worker {
168*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the allowed values.");
169*35238bceSAndroid Build Coastguard Worker GLboolean params = GL_FALSE;
170*35238bceSAndroid Build Coastguard Worker ctx.glGetBooleanv(-1, ¶ms);
171*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
172*35238bceSAndroid Build Coastguard Worker ctx.endSection();
173*35238bceSAndroid Build Coastguard Worker }
174*35238bceSAndroid Build Coastguard Worker
get_booleani_v(NegativeTestContext & ctx)175*35238bceSAndroid Build Coastguard Worker void get_booleani_v(NegativeTestContext &ctx)
176*35238bceSAndroid Build Coastguard Worker {
177*35238bceSAndroid Build Coastguard Worker GLboolean data = -1;
178*35238bceSAndroid Build Coastguard Worker GLint maxUniformBufferBindings = 0;
179*35238bceSAndroid Build Coastguard Worker
180*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target is not indexed state queriable with these commands.");
181*35238bceSAndroid Build Coastguard Worker ctx.glGetBooleani_v(-1, 0, &data);
182*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
183*35238bceSAndroid Build Coastguard Worker ctx.endSection();
184*35238bceSAndroid Build Coastguard Worker
185*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
186*35238bceSAndroid Build Coastguard Worker "GL_INVALID_VALUE is generated if index is outside of the valid range for the indexed state target.");
187*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUniformBufferBindings);
188*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
189*35238bceSAndroid Build Coastguard Worker ctx.glGetBooleani_v(GL_UNIFORM_BUFFER_BINDING, maxUniformBufferBindings, &data);
190*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
191*35238bceSAndroid Build Coastguard Worker ctx.endSection();
192*35238bceSAndroid Build Coastguard Worker }
193*35238bceSAndroid Build Coastguard Worker
get_floatv(NegativeTestContext & ctx)194*35238bceSAndroid Build Coastguard Worker void get_floatv(NegativeTestContext &ctx)
195*35238bceSAndroid Build Coastguard Worker {
196*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the allowed values.");
197*35238bceSAndroid Build Coastguard Worker GLfloat params = 0.0f;
198*35238bceSAndroid Build Coastguard Worker ctx.glGetFloatv(-1, ¶ms);
199*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
200*35238bceSAndroid Build Coastguard Worker ctx.endSection();
201*35238bceSAndroid Build Coastguard Worker }
202*35238bceSAndroid Build Coastguard Worker
get_integerv(NegativeTestContext & ctx)203*35238bceSAndroid Build Coastguard Worker void get_integerv(NegativeTestContext &ctx)
204*35238bceSAndroid Build Coastguard Worker {
205*35238bceSAndroid Build Coastguard Worker GLint params = -1;
206*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the allowed values.");
207*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(-1, ¶ms);
208*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
209*35238bceSAndroid Build Coastguard Worker ctx.endSection();
210*35238bceSAndroid Build Coastguard Worker }
211*35238bceSAndroid Build Coastguard Worker
get_integer64v(NegativeTestContext & ctx)212*35238bceSAndroid Build Coastguard Worker void get_integer64v(NegativeTestContext &ctx)
213*35238bceSAndroid Build Coastguard Worker {
214*35238bceSAndroid Build Coastguard Worker GLint64 params = -1;
215*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the allowed values.");
216*35238bceSAndroid Build Coastguard Worker ctx.glGetInteger64v(-1, ¶ms);
217*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
218*35238bceSAndroid Build Coastguard Worker ctx.endSection();
219*35238bceSAndroid Build Coastguard Worker }
220*35238bceSAndroid Build Coastguard Worker
get_integeri_v(NegativeTestContext & ctx)221*35238bceSAndroid Build Coastguard Worker void get_integeri_v(NegativeTestContext &ctx)
222*35238bceSAndroid Build Coastguard Worker {
223*35238bceSAndroid Build Coastguard Worker GLint data = -1;
224*35238bceSAndroid Build Coastguard Worker GLint maxUniformBufferBindings = 0;
225*35238bceSAndroid Build Coastguard Worker GLint maxShaderStorageBufferBindings = 0;
226*35238bceSAndroid Build Coastguard Worker
227*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if name is not an accepted value.");
228*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegeri_v(-1, 0, &data);
229*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
230*35238bceSAndroid Build Coastguard Worker ctx.endSection();
231*35238bceSAndroid Build Coastguard Worker
232*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
233*35238bceSAndroid Build Coastguard Worker "GL_INVALID_VALUE is generated if index is outside of the valid range for the indexed state target.");
234*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUniformBufferBindings);
235*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
236*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegeri_v(GL_UNIFORM_BUFFER_BINDING, maxUniformBufferBindings, &data);
237*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
238*35238bceSAndroid Build Coastguard Worker ctx.endSection();
239*35238bceSAndroid Build Coastguard Worker
240*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
241*35238bceSAndroid Build Coastguard Worker "GL_INVALID_VALUE is generated if index is outside of the valid range for the indexed state target.");
242*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, &maxShaderStorageBufferBindings);
243*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
244*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegeri_v(GL_SHADER_STORAGE_BUFFER_BINDING, maxShaderStorageBufferBindings, &data);
245*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
246*35238bceSAndroid Build Coastguard Worker ctx.endSection();
247*35238bceSAndroid Build Coastguard Worker }
248*35238bceSAndroid Build Coastguard Worker
get_integer64i_v(NegativeTestContext & ctx)249*35238bceSAndroid Build Coastguard Worker void get_integer64i_v(NegativeTestContext &ctx)
250*35238bceSAndroid Build Coastguard Worker {
251*35238bceSAndroid Build Coastguard Worker GLint64 data = (GLint64)-1;
252*35238bceSAndroid Build Coastguard Worker GLint maxUniformBufferBindings = 0;
253*35238bceSAndroid Build Coastguard Worker GLint maxShaderStorageBufferBindings = 0;
254*35238bceSAndroid Build Coastguard Worker
255*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if name is not an accepted value.");
256*35238bceSAndroid Build Coastguard Worker ctx.glGetInteger64i_v(-1, 0, &data);
257*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
258*35238bceSAndroid Build Coastguard Worker ctx.endSection();
259*35238bceSAndroid Build Coastguard Worker
260*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
261*35238bceSAndroid Build Coastguard Worker "GL_INVALID_VALUE is generated if index is outside of the valid range for the indexed state target.");
262*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUniformBufferBindings);
263*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
264*35238bceSAndroid Build Coastguard Worker ctx.glGetInteger64i_v(GL_UNIFORM_BUFFER_START, maxUniformBufferBindings, &data);
265*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
266*35238bceSAndroid Build Coastguard Worker ctx.endSection();
267*35238bceSAndroid Build Coastguard Worker
268*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
269*35238bceSAndroid Build Coastguard Worker "GL_INVALID_VALUE is generated if index is outside of the valid range for the indexed state target.");
270*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, &maxShaderStorageBufferBindings);
271*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
272*35238bceSAndroid Build Coastguard Worker ctx.glGetInteger64i_v(GL_SHADER_STORAGE_BUFFER_START, maxShaderStorageBufferBindings, &data);
273*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
274*35238bceSAndroid Build Coastguard Worker ctx.glGetInteger64i_v(GL_SHADER_STORAGE_BUFFER_SIZE, maxShaderStorageBufferBindings, &data);
275*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
276*35238bceSAndroid Build Coastguard Worker ctx.endSection();
277*35238bceSAndroid Build Coastguard Worker }
278*35238bceSAndroid Build Coastguard Worker
get_string(NegativeTestContext & ctx)279*35238bceSAndroid Build Coastguard Worker void get_string(NegativeTestContext &ctx)
280*35238bceSAndroid Build Coastguard Worker {
281*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if name is not an accepted value.");
282*35238bceSAndroid Build Coastguard Worker ctx.glGetString(-1);
283*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
284*35238bceSAndroid Build Coastguard Worker ctx.endSection();
285*35238bceSAndroid Build Coastguard Worker }
286*35238bceSAndroid Build Coastguard Worker
get_stringi(NegativeTestContext & ctx)287*35238bceSAndroid Build Coastguard Worker void get_stringi(NegativeTestContext &ctx)
288*35238bceSAndroid Build Coastguard Worker {
289*35238bceSAndroid Build Coastguard Worker GLint numExtensions = 0;
290*35238bceSAndroid Build Coastguard Worker
291*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if name is not an accepted value.");
292*35238bceSAndroid Build Coastguard Worker ctx.glGetStringi(-1, 0);
293*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
294*35238bceSAndroid Build Coastguard Worker ctx.endSection();
295*35238bceSAndroid Build Coastguard Worker
296*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if index is outside the valid range for indexed state name.");
297*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
298*35238bceSAndroid Build Coastguard Worker ctx.glGetStringi(GL_EXTENSIONS, numExtensions);
299*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
300*35238bceSAndroid Build Coastguard Worker ctx.endSection();
301*35238bceSAndroid Build Coastguard Worker }
302*35238bceSAndroid Build Coastguard Worker
303*35238bceSAndroid Build Coastguard Worker // Enumerated state queries: Shaders
304*35238bceSAndroid Build Coastguard Worker
get_attached_shaders(NegativeTestContext & ctx)305*35238bceSAndroid Build Coastguard Worker void get_attached_shaders(NegativeTestContext &ctx)
306*35238bceSAndroid Build Coastguard Worker {
307*35238bceSAndroid Build Coastguard Worker GLuint shaders[1] = {0};
308*35238bceSAndroid Build Coastguard Worker GLuint shaderObject = ctx.glCreateShader(GL_VERTEX_SHADER);
309*35238bceSAndroid Build Coastguard Worker GLuint program = ctx.glCreateProgram();
310*35238bceSAndroid Build Coastguard Worker GLsizei count[1] = {0};
311*35238bceSAndroid Build Coastguard Worker
312*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
313*35238bceSAndroid Build Coastguard Worker ctx.glGetAttachedShaders(-1, 1, &count[0], &shaders[0]);
314*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
315*35238bceSAndroid Build Coastguard Worker ctx.endSection();
316*35238bceSAndroid Build Coastguard Worker
317*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
318*35238bceSAndroid Build Coastguard Worker ctx.glGetAttachedShaders(shaderObject, 1, &count[0], &shaders[0]);
319*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
320*35238bceSAndroid Build Coastguard Worker ctx.endSection();
321*35238bceSAndroid Build Coastguard Worker
322*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if maxCount is less than 0.");
323*35238bceSAndroid Build Coastguard Worker ctx.glGetAttachedShaders(program, -1, &count[0], &shaders[0]);
324*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
325*35238bceSAndroid Build Coastguard Worker ctx.endSection();
326*35238bceSAndroid Build Coastguard Worker
327*35238bceSAndroid Build Coastguard Worker ctx.glDeleteShader(shaderObject);
328*35238bceSAndroid Build Coastguard Worker ctx.glDeleteProgram(program);
329*35238bceSAndroid Build Coastguard Worker }
330*35238bceSAndroid Build Coastguard Worker
get_shaderiv(NegativeTestContext & ctx)331*35238bceSAndroid Build Coastguard Worker void get_shaderiv(NegativeTestContext &ctx)
332*35238bceSAndroid Build Coastguard Worker {
333*35238bceSAndroid Build Coastguard Worker GLboolean shaderCompilerSupported;
334*35238bceSAndroid Build Coastguard Worker GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
335*35238bceSAndroid Build Coastguard Worker GLuint program = ctx.glCreateProgram();
336*35238bceSAndroid Build Coastguard Worker GLint param[1] = {-1};
337*35238bceSAndroid Build Coastguard Worker
338*35238bceSAndroid Build Coastguard Worker ctx.glGetBooleanv(GL_SHADER_COMPILER, &shaderCompilerSupported);
339*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// GL_SHADER_COMPILER = " << (shaderCompilerSupported ? "GL_TRUE" : "GL_FALSE")
340*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
341*35238bceSAndroid Build Coastguard Worker
342*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
343*35238bceSAndroid Build Coastguard Worker ctx.glGetShaderiv(shader, -1, ¶m[0]);
344*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
345*35238bceSAndroid Build Coastguard Worker ctx.endSection();
346*35238bceSAndroid Build Coastguard Worker
347*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
348*35238bceSAndroid Build Coastguard Worker ctx.glGetShaderiv(-1, GL_SHADER_TYPE, ¶m[0]);
349*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
350*35238bceSAndroid Build Coastguard Worker ctx.endSection();
351*35238bceSAndroid Build Coastguard Worker
352*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if shader does not refer to a shader object.");
353*35238bceSAndroid Build Coastguard Worker ctx.glGetShaderiv(program, GL_SHADER_TYPE, ¶m[0]);
354*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
355*35238bceSAndroid Build Coastguard Worker ctx.endSection();
356*35238bceSAndroid Build Coastguard Worker
357*35238bceSAndroid Build Coastguard Worker ctx.glDeleteShader(shader);
358*35238bceSAndroid Build Coastguard Worker ctx.glDeleteProgram(program);
359*35238bceSAndroid Build Coastguard Worker }
360*35238bceSAndroid Build Coastguard Worker
get_shader_info_log(NegativeTestContext & ctx)361*35238bceSAndroid Build Coastguard Worker void get_shader_info_log(NegativeTestContext &ctx)
362*35238bceSAndroid Build Coastguard Worker {
363*35238bceSAndroid Build Coastguard Worker GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
364*35238bceSAndroid Build Coastguard Worker GLuint program = ctx.glCreateProgram();
365*35238bceSAndroid Build Coastguard Worker GLsizei length[1] = {-1};
366*35238bceSAndroid Build Coastguard Worker char infoLog[128] = {0};
367*35238bceSAndroid Build Coastguard Worker
368*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
369*35238bceSAndroid Build Coastguard Worker ctx.glGetShaderInfoLog(-1, 128, &length[0], &infoLog[0]);
370*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
371*35238bceSAndroid Build Coastguard Worker ctx.endSection();
372*35238bceSAndroid Build Coastguard Worker
373*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not a shader object.");
374*35238bceSAndroid Build Coastguard Worker ctx.glGetShaderInfoLog(program, 128, &length[0], &infoLog[0]);
375*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
376*35238bceSAndroid Build Coastguard Worker ctx.endSection();
377*35238bceSAndroid Build Coastguard Worker
378*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if maxLength is less than 0.");
379*35238bceSAndroid Build Coastguard Worker ctx.glGetShaderInfoLog(shader, -1, &length[0], &infoLog[0]);
380*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
381*35238bceSAndroid Build Coastguard Worker ctx.endSection();
382*35238bceSAndroid Build Coastguard Worker
383*35238bceSAndroid Build Coastguard Worker ctx.glDeleteShader(shader);
384*35238bceSAndroid Build Coastguard Worker ctx.glDeleteProgram(program);
385*35238bceSAndroid Build Coastguard Worker }
386*35238bceSAndroid Build Coastguard Worker
get_shader_precision_format(NegativeTestContext & ctx)387*35238bceSAndroid Build Coastguard Worker void get_shader_precision_format(NegativeTestContext &ctx)
388*35238bceSAndroid Build Coastguard Worker {
389*35238bceSAndroid Build Coastguard Worker GLboolean shaderCompilerSupported;
390*35238bceSAndroid Build Coastguard Worker GLint range[2];
391*35238bceSAndroid Build Coastguard Worker GLint precision[1];
392*35238bceSAndroid Build Coastguard Worker
393*35238bceSAndroid Build Coastguard Worker ctx.glGetBooleanv(GL_SHADER_COMPILER, &shaderCompilerSupported);
394*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// GL_SHADER_COMPILER = " << (shaderCompilerSupported ? "GL_TRUE" : "GL_FALSE")
395*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
396*35238bceSAndroid Build Coastguard Worker
397*35238bceSAndroid Build Coastguard Worker deMemset(&range[0], 0xcd, sizeof(range));
398*35238bceSAndroid Build Coastguard Worker deMemset(&precision[0], 0xcd, sizeof(precision));
399*35238bceSAndroid Build Coastguard Worker
400*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if shaderType or precisionType is not an accepted value.");
401*35238bceSAndroid Build Coastguard Worker ctx.glGetShaderPrecisionFormat(-1, GL_MEDIUM_FLOAT, &range[0], &precision[0]);
402*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
403*35238bceSAndroid Build Coastguard Worker ctx.glGetShaderPrecisionFormat(GL_VERTEX_SHADER, -1, &range[0], &precision[0]);
404*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
405*35238bceSAndroid Build Coastguard Worker ctx.glGetShaderPrecisionFormat(-1, -1, &range[0], &precision[0]);
406*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
407*35238bceSAndroid Build Coastguard Worker ctx.endSection();
408*35238bceSAndroid Build Coastguard Worker }
409*35238bceSAndroid Build Coastguard Worker
get_shader_source(NegativeTestContext & ctx)410*35238bceSAndroid Build Coastguard Worker void get_shader_source(NegativeTestContext &ctx)
411*35238bceSAndroid Build Coastguard Worker {
412*35238bceSAndroid Build Coastguard Worker GLsizei length[1] = {0};
413*35238bceSAndroid Build Coastguard Worker char source[1] = {0};
414*35238bceSAndroid Build Coastguard Worker GLuint program = ctx.glCreateProgram();
415*35238bceSAndroid Build Coastguard Worker GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
416*35238bceSAndroid Build Coastguard Worker
417*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
418*35238bceSAndroid Build Coastguard Worker ctx.glGetShaderSource(-1, 1, &length[0], &source[0]);
419*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
420*35238bceSAndroid Build Coastguard Worker ctx.endSection();
421*35238bceSAndroid Build Coastguard Worker
422*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not a shader object.");
423*35238bceSAndroid Build Coastguard Worker ctx.glGetShaderSource(program, 1, &length[0], &source[0]);
424*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
425*35238bceSAndroid Build Coastguard Worker ctx.endSection();
426*35238bceSAndroid Build Coastguard Worker
427*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is less than 0.");
428*35238bceSAndroid Build Coastguard Worker ctx.glGetShaderSource(shader, -1, &length[0], &source[0]);
429*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
430*35238bceSAndroid Build Coastguard Worker ctx.endSection();
431*35238bceSAndroid Build Coastguard Worker
432*35238bceSAndroid Build Coastguard Worker ctx.glDeleteProgram(program);
433*35238bceSAndroid Build Coastguard Worker ctx.glDeleteShader(shader);
434*35238bceSAndroid Build Coastguard Worker }
435*35238bceSAndroid Build Coastguard Worker
436*35238bceSAndroid Build Coastguard Worker // Enumerated state queries: Programs
437*35238bceSAndroid Build Coastguard Worker
get_programiv(NegativeTestContext & ctx)438*35238bceSAndroid Build Coastguard Worker void get_programiv(NegativeTestContext &ctx)
439*35238bceSAndroid Build Coastguard Worker {
440*35238bceSAndroid Build Coastguard Worker GLuint program = ctx.glCreateProgram();
441*35238bceSAndroid Build Coastguard Worker GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
442*35238bceSAndroid Build Coastguard Worker GLint params[1] = {0};
443*35238bceSAndroid Build Coastguard Worker
444*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
445*35238bceSAndroid Build Coastguard Worker ctx.glGetProgramiv(program, -1, ¶ms[0]);
446*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
447*35238bceSAndroid Build Coastguard Worker ctx.endSection();
448*35238bceSAndroid Build Coastguard Worker
449*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
450*35238bceSAndroid Build Coastguard Worker ctx.glGetProgramiv(-1, GL_LINK_STATUS, ¶ms[0]);
451*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
452*35238bceSAndroid Build Coastguard Worker ctx.endSection();
453*35238bceSAndroid Build Coastguard Worker
454*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program does not refer to a program object.");
455*35238bceSAndroid Build Coastguard Worker ctx.glGetProgramiv(shader, GL_LINK_STATUS, ¶ms[0]);
456*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
457*35238bceSAndroid Build Coastguard Worker ctx.endSection();
458*35238bceSAndroid Build Coastguard Worker
459*35238bceSAndroid Build Coastguard Worker ctx.glDeleteProgram(program);
460*35238bceSAndroid Build Coastguard Worker ctx.glDeleteShader(shader);
461*35238bceSAndroid Build Coastguard Worker }
462*35238bceSAndroid Build Coastguard Worker
get_program_info_log(NegativeTestContext & ctx)463*35238bceSAndroid Build Coastguard Worker void get_program_info_log(NegativeTestContext &ctx)
464*35238bceSAndroid Build Coastguard Worker {
465*35238bceSAndroid Build Coastguard Worker GLuint program = ctx.glCreateProgram();
466*35238bceSAndroid Build Coastguard Worker GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
467*35238bceSAndroid Build Coastguard Worker GLsizei length[1] = {0};
468*35238bceSAndroid Build Coastguard Worker char infoLog[1] = {'x'};
469*35238bceSAndroid Build Coastguard Worker
470*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
471*35238bceSAndroid Build Coastguard Worker ctx.glGetProgramInfoLog(-1, 1, &length[0], &infoLog[0]);
472*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
473*35238bceSAndroid Build Coastguard Worker ctx.endSection();
474*35238bceSAndroid Build Coastguard Worker
475*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
476*35238bceSAndroid Build Coastguard Worker ctx.glGetProgramInfoLog(shader, 1, &length[0], &infoLog[0]);
477*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
478*35238bceSAndroid Build Coastguard Worker ctx.endSection();
479*35238bceSAndroid Build Coastguard Worker
480*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if maxLength is less than 0.");
481*35238bceSAndroid Build Coastguard Worker ctx.glGetProgramInfoLog(program, -1, &length[0], &infoLog[0]);
482*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
483*35238bceSAndroid Build Coastguard Worker ctx.endSection();
484*35238bceSAndroid Build Coastguard Worker
485*35238bceSAndroid Build Coastguard Worker ctx.glDeleteProgram(program);
486*35238bceSAndroid Build Coastguard Worker ctx.glDeleteShader(shader);
487*35238bceSAndroid Build Coastguard Worker }
488*35238bceSAndroid Build Coastguard Worker
489*35238bceSAndroid Build Coastguard Worker // Enumerated state queries: Shader variables
490*35238bceSAndroid Build Coastguard Worker
get_tex_parameterfv(NegativeTestContext & ctx)491*35238bceSAndroid Build Coastguard Worker void get_tex_parameterfv(NegativeTestContext &ctx)
492*35238bceSAndroid Build Coastguard Worker {
493*35238bceSAndroid Build Coastguard Worker GLfloat params[1] = {0};
494*35238bceSAndroid Build Coastguard Worker
495*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
496*35238bceSAndroid Build Coastguard Worker ctx.glGetTexParameterfv(-1, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
497*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
498*35238bceSAndroid Build Coastguard Worker ctx.glGetTexParameterfv(GL_TEXTURE_2D, -1, ¶ms[0]);
499*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
500*35238bceSAndroid Build Coastguard Worker ctx.glGetTexParameterfv(-1, -1, ¶ms[0]);
501*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
502*35238bceSAndroid Build Coastguard Worker ctx.endSection();
503*35238bceSAndroid Build Coastguard Worker }
504*35238bceSAndroid Build Coastguard Worker
get_tex_parameteriv(NegativeTestContext & ctx)505*35238bceSAndroid Build Coastguard Worker void get_tex_parameteriv(NegativeTestContext &ctx)
506*35238bceSAndroid Build Coastguard Worker {
507*35238bceSAndroid Build Coastguard Worker GLint params[1] = {0};
508*35238bceSAndroid Build Coastguard Worker
509*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
510*35238bceSAndroid Build Coastguard Worker ctx.glGetTexParameteriv(-1, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
511*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
512*35238bceSAndroid Build Coastguard Worker ctx.glGetTexParameteriv(GL_TEXTURE_2D, -1, ¶ms[0]);
513*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
514*35238bceSAndroid Build Coastguard Worker ctx.glGetTexParameteriv(-1, -1, ¶ms[0]);
515*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
516*35238bceSAndroid Build Coastguard Worker ctx.endSection();
517*35238bceSAndroid Build Coastguard Worker }
518*35238bceSAndroid Build Coastguard Worker
get_tex_parameteriiv(NegativeTestContext & ctx)519*35238bceSAndroid Build Coastguard Worker void get_tex_parameteriiv(NegativeTestContext &ctx)
520*35238bceSAndroid Build Coastguard Worker {
521*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version.");
522*35238bceSAndroid Build Coastguard Worker
523*35238bceSAndroid Build Coastguard Worker GLint params[1] = {0};
524*35238bceSAndroid Build Coastguard Worker
525*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
526*35238bceSAndroid Build Coastguard Worker ctx.glGetTexParameterIiv(-1, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
527*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
528*35238bceSAndroid Build Coastguard Worker ctx.glGetTexParameterIiv(GL_TEXTURE_2D, -1, ¶ms[0]);
529*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
530*35238bceSAndroid Build Coastguard Worker ctx.glGetTexParameterIiv(-1, -1, ¶ms[0]);
531*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
532*35238bceSAndroid Build Coastguard Worker ctx.endSection();
533*35238bceSAndroid Build Coastguard Worker }
534*35238bceSAndroid Build Coastguard Worker
get_tex_parameteriuiv(NegativeTestContext & ctx)535*35238bceSAndroid Build Coastguard Worker void get_tex_parameteriuiv(NegativeTestContext &ctx)
536*35238bceSAndroid Build Coastguard Worker {
537*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version.");
538*35238bceSAndroid Build Coastguard Worker
539*35238bceSAndroid Build Coastguard Worker GLuint params[1] = {0};
540*35238bceSAndroid Build Coastguard Worker
541*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
542*35238bceSAndroid Build Coastguard Worker ctx.glGetTexParameterIuiv(-1, GL_TEXTURE_MAG_FILTER, ¶ms[0]);
543*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
544*35238bceSAndroid Build Coastguard Worker ctx.glGetTexParameterIuiv(GL_TEXTURE_2D, -1, ¶ms[0]);
545*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
546*35238bceSAndroid Build Coastguard Worker ctx.glGetTexParameterIuiv(-1, -1, ¶ms[0]);
547*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
548*35238bceSAndroid Build Coastguard Worker ctx.endSection();
549*35238bceSAndroid Build Coastguard Worker }
550*35238bceSAndroid Build Coastguard Worker
get_uniformfv(NegativeTestContext & ctx)551*35238bceSAndroid Build Coastguard Worker void get_uniformfv(NegativeTestContext &ctx)
552*35238bceSAndroid Build Coastguard Worker {
553*35238bceSAndroid Build Coastguard Worker glu::ShaderProgram program(ctx.getRenderContext(),
554*35238bceSAndroid Build Coastguard Worker glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx),
555*35238bceSAndroid Build Coastguard Worker getVtxFragVersionSources(uniformTestFragSource, ctx)));
556*35238bceSAndroid Build Coastguard Worker GLfloat params[4] = {0.f};
557*35238bceSAndroid Build Coastguard Worker GLuint shader;
558*35238bceSAndroid Build Coastguard Worker GLuint programEmpty;
559*35238bceSAndroid Build Coastguard Worker GLint unif;
560*35238bceSAndroid Build Coastguard Worker
561*35238bceSAndroid Build Coastguard Worker ctx.glUseProgram(program.getProgram());
562*35238bceSAndroid Build Coastguard Worker
563*35238bceSAndroid Build Coastguard Worker unif = ctx.glGetUniformLocation(program.getProgram(), "vUnif_vec4"); // vec4
564*35238bceSAndroid Build Coastguard Worker if (unif == -1)
565*35238bceSAndroid Build Coastguard Worker ctx.fail("Failed to retrieve uniform location");
566*35238bceSAndroid Build Coastguard Worker
567*35238bceSAndroid Build Coastguard Worker shader = ctx.glCreateShader(GL_VERTEX_SHADER);
568*35238bceSAndroid Build Coastguard Worker programEmpty = ctx.glCreateProgram();
569*35238bceSAndroid Build Coastguard Worker
570*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
571*35238bceSAndroid Build Coastguard Worker ctx.glGetUniformfv(-1, unif, ¶ms[0]);
572*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
573*35238bceSAndroid Build Coastguard Worker ctx.endSection();
574*35238bceSAndroid Build Coastguard Worker
575*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
576*35238bceSAndroid Build Coastguard Worker ctx.glGetUniformfv(shader, unif, ¶ms[0]);
577*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
578*35238bceSAndroid Build Coastguard Worker ctx.endSection();
579*35238bceSAndroid Build Coastguard Worker
580*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
581*35238bceSAndroid Build Coastguard Worker ctx.glGetUniformfv(programEmpty, unif, ¶ms[0]);
582*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
583*35238bceSAndroid Build Coastguard Worker ctx.endSection();
584*35238bceSAndroid Build Coastguard Worker
585*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable "
586*35238bceSAndroid Build Coastguard Worker "location for the specified program object.");
587*35238bceSAndroid Build Coastguard Worker ctx.glGetUniformfv(program.getProgram(), -1, ¶ms[0]);
588*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
589*35238bceSAndroid Build Coastguard Worker ctx.endSection();
590*35238bceSAndroid Build Coastguard Worker
591*35238bceSAndroid Build Coastguard Worker ctx.glDeleteShader(shader);
592*35238bceSAndroid Build Coastguard Worker ctx.glDeleteProgram(programEmpty);
593*35238bceSAndroid Build Coastguard Worker }
594*35238bceSAndroid Build Coastguard Worker
get_nuniformfv(NegativeTestContext & ctx)595*35238bceSAndroid Build Coastguard Worker void get_nuniformfv(NegativeTestContext &ctx)
596*35238bceSAndroid Build Coastguard Worker {
597*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version.");
598*35238bceSAndroid Build Coastguard Worker
599*35238bceSAndroid Build Coastguard Worker glu::ShaderProgram program(ctx.getRenderContext(),
600*35238bceSAndroid Build Coastguard Worker glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx),
601*35238bceSAndroid Build Coastguard Worker getVtxFragVersionSources(uniformTestFragSource, ctx)));
602*35238bceSAndroid Build Coastguard Worker GLint unif = ctx.glGetUniformLocation(program.getProgram(), "vUnif_vec4");
603*35238bceSAndroid Build Coastguard Worker GLfloat params[4] = {0.0f, 0.0f, 0.0f, 0.0f};
604*35238bceSAndroid Build Coastguard Worker GLuint shader;
605*35238bceSAndroid Build Coastguard Worker GLuint programEmpty;
606*35238bceSAndroid Build Coastguard Worker GLsizei bufferSize;
607*35238bceSAndroid Build Coastguard Worker
608*35238bceSAndroid Build Coastguard Worker ctx.glUseProgram(program.getProgram());
609*35238bceSAndroid Build Coastguard Worker
610*35238bceSAndroid Build Coastguard Worker if (unif == -1)
611*35238bceSAndroid Build Coastguard Worker ctx.fail("Failed to retrieve uniform location");
612*35238bceSAndroid Build Coastguard Worker
613*35238bceSAndroid Build Coastguard Worker shader = ctx.glCreateShader(GL_VERTEX_SHADER);
614*35238bceSAndroid Build Coastguard Worker programEmpty = ctx.glCreateProgram();
615*35238bceSAndroid Build Coastguard Worker
616*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS, &bufferSize);
617*35238bceSAndroid Build Coastguard Worker
618*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
619*35238bceSAndroid Build Coastguard Worker ctx.glGetnUniformfv(-1, unif, bufferSize, ¶ms[0]);
620*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
621*35238bceSAndroid Build Coastguard Worker ctx.endSection();
622*35238bceSAndroid Build Coastguard Worker
623*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
624*35238bceSAndroid Build Coastguard Worker ctx.glGetnUniformfv(shader, unif, bufferSize, ¶ms[0]);
625*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
626*35238bceSAndroid Build Coastguard Worker ctx.endSection();
627*35238bceSAndroid Build Coastguard Worker
628*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
629*35238bceSAndroid Build Coastguard Worker ctx.glGetnUniformfv(programEmpty, unif, bufferSize, ¶ms[0]);
630*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
631*35238bceSAndroid Build Coastguard Worker ctx.endSection();
632*35238bceSAndroid Build Coastguard Worker
633*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable "
634*35238bceSAndroid Build Coastguard Worker "location for the specified program object.");
635*35238bceSAndroid Build Coastguard Worker ctx.glGetnUniformfv(program.getProgram(), -1, bufferSize, ¶ms[0]);
636*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
637*35238bceSAndroid Build Coastguard Worker ctx.endSection();
638*35238bceSAndroid Build Coastguard Worker
639*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer size required to store the requested data is "
640*35238bceSAndroid Build Coastguard Worker "greater than bufSize.");
641*35238bceSAndroid Build Coastguard Worker ctx.glGetnUniformfv(program.getProgram(), unif, 0, ¶ms[0]);
642*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
643*35238bceSAndroid Build Coastguard Worker ctx.endSection();
644*35238bceSAndroid Build Coastguard Worker
645*35238bceSAndroid Build Coastguard Worker ctx.glDeleteShader(shader);
646*35238bceSAndroid Build Coastguard Worker ctx.glDeleteProgram(programEmpty);
647*35238bceSAndroid Build Coastguard Worker }
648*35238bceSAndroid Build Coastguard Worker
get_uniformiv(NegativeTestContext & ctx)649*35238bceSAndroid Build Coastguard Worker void get_uniformiv(NegativeTestContext &ctx)
650*35238bceSAndroid Build Coastguard Worker {
651*35238bceSAndroid Build Coastguard Worker glu::ShaderProgram program(ctx.getRenderContext(),
652*35238bceSAndroid Build Coastguard Worker glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx),
653*35238bceSAndroid Build Coastguard Worker getVtxFragVersionSources(uniformTestFragSource, ctx)));
654*35238bceSAndroid Build Coastguard Worker GLint unif = ctx.glGetUniformLocation(program.getProgram(), "fUnif_ivec4");
655*35238bceSAndroid Build Coastguard Worker GLint params[4] = {0, 0, 0, 0};
656*35238bceSAndroid Build Coastguard Worker GLuint shader;
657*35238bceSAndroid Build Coastguard Worker GLuint programEmpty;
658*35238bceSAndroid Build Coastguard Worker
659*35238bceSAndroid Build Coastguard Worker ctx.glUseProgram(program.getProgram());
660*35238bceSAndroid Build Coastguard Worker
661*35238bceSAndroid Build Coastguard Worker if (unif == -1)
662*35238bceSAndroid Build Coastguard Worker ctx.fail("Failed to retrieve uniform location");
663*35238bceSAndroid Build Coastguard Worker
664*35238bceSAndroid Build Coastguard Worker shader = ctx.glCreateShader(GL_VERTEX_SHADER);
665*35238bceSAndroid Build Coastguard Worker programEmpty = ctx.glCreateProgram();
666*35238bceSAndroid Build Coastguard Worker
667*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
668*35238bceSAndroid Build Coastguard Worker ctx.glGetUniformiv(-1, unif, ¶ms[0]);
669*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
670*35238bceSAndroid Build Coastguard Worker ctx.endSection();
671*35238bceSAndroid Build Coastguard Worker
672*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
673*35238bceSAndroid Build Coastguard Worker ctx.glGetUniformiv(shader, unif, ¶ms[0]);
674*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
675*35238bceSAndroid Build Coastguard Worker ctx.endSection();
676*35238bceSAndroid Build Coastguard Worker
677*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
678*35238bceSAndroid Build Coastguard Worker ctx.glGetUniformiv(programEmpty, unif, ¶ms[0]);
679*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
680*35238bceSAndroid Build Coastguard Worker ctx.endSection();
681*35238bceSAndroid Build Coastguard Worker
682*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable "
683*35238bceSAndroid Build Coastguard Worker "location for the specified program object.");
684*35238bceSAndroid Build Coastguard Worker ctx.glGetUniformiv(program.getProgram(), -1, ¶ms[0]);
685*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
686*35238bceSAndroid Build Coastguard Worker ctx.endSection();
687*35238bceSAndroid Build Coastguard Worker
688*35238bceSAndroid Build Coastguard Worker ctx.glDeleteShader(shader);
689*35238bceSAndroid Build Coastguard Worker ctx.glDeleteProgram(programEmpty);
690*35238bceSAndroid Build Coastguard Worker }
691*35238bceSAndroid Build Coastguard Worker
get_nuniformiv(NegativeTestContext & ctx)692*35238bceSAndroid Build Coastguard Worker void get_nuniformiv(NegativeTestContext &ctx)
693*35238bceSAndroid Build Coastguard Worker {
694*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version.");
695*35238bceSAndroid Build Coastguard Worker
696*35238bceSAndroid Build Coastguard Worker glu::ShaderProgram program(ctx.getRenderContext(),
697*35238bceSAndroid Build Coastguard Worker glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx),
698*35238bceSAndroid Build Coastguard Worker getVtxFragVersionSources(uniformTestFragSource, ctx)));
699*35238bceSAndroid Build Coastguard Worker GLint unif = ctx.glGetUniformLocation(program.getProgram(), "fUnif_ivec4");
700*35238bceSAndroid Build Coastguard Worker GLint params[4] = {0, 0, 0, 0};
701*35238bceSAndroid Build Coastguard Worker GLuint shader;
702*35238bceSAndroid Build Coastguard Worker GLuint programEmpty;
703*35238bceSAndroid Build Coastguard Worker GLsizei bufferSize;
704*35238bceSAndroid Build Coastguard Worker
705*35238bceSAndroid Build Coastguard Worker ctx.glUseProgram(program.getProgram());
706*35238bceSAndroid Build Coastguard Worker
707*35238bceSAndroid Build Coastguard Worker if (unif == -1)
708*35238bceSAndroid Build Coastguard Worker ctx.fail("Failed to retrieve uniform location");
709*35238bceSAndroid Build Coastguard Worker
710*35238bceSAndroid Build Coastguard Worker shader = ctx.glCreateShader(GL_VERTEX_SHADER);
711*35238bceSAndroid Build Coastguard Worker programEmpty = ctx.glCreateProgram();
712*35238bceSAndroid Build Coastguard Worker
713*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS, &bufferSize);
714*35238bceSAndroid Build Coastguard Worker
715*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
716*35238bceSAndroid Build Coastguard Worker ctx.glGetnUniformiv(-1, unif, bufferSize, ¶ms[0]);
717*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
718*35238bceSAndroid Build Coastguard Worker ctx.endSection();
719*35238bceSAndroid Build Coastguard Worker
720*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
721*35238bceSAndroid Build Coastguard Worker ctx.glGetnUniformiv(shader, unif, bufferSize, ¶ms[0]);
722*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
723*35238bceSAndroid Build Coastguard Worker ctx.endSection();
724*35238bceSAndroid Build Coastguard Worker
725*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
726*35238bceSAndroid Build Coastguard Worker ctx.glGetnUniformiv(programEmpty, unif, bufferSize, ¶ms[0]);
727*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
728*35238bceSAndroid Build Coastguard Worker ctx.endSection();
729*35238bceSAndroid Build Coastguard Worker
730*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable "
731*35238bceSAndroid Build Coastguard Worker "location for the specified program object.");
732*35238bceSAndroid Build Coastguard Worker ctx.glGetnUniformiv(program.getProgram(), -1, bufferSize, ¶ms[0]);
733*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
734*35238bceSAndroid Build Coastguard Worker ctx.endSection();
735*35238bceSAndroid Build Coastguard Worker
736*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer size required to store the requested data is "
737*35238bceSAndroid Build Coastguard Worker "greater than bufSize.");
738*35238bceSAndroid Build Coastguard Worker ctx.glGetnUniformiv(program.getProgram(), unif, -1, ¶ms[0]);
739*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
740*35238bceSAndroid Build Coastguard Worker ctx.endSection();
741*35238bceSAndroid Build Coastguard Worker
742*35238bceSAndroid Build Coastguard Worker ctx.glDeleteShader(shader);
743*35238bceSAndroid Build Coastguard Worker ctx.glDeleteProgram(programEmpty);
744*35238bceSAndroid Build Coastguard Worker }
745*35238bceSAndroid Build Coastguard Worker
get_uniformuiv(NegativeTestContext & ctx)746*35238bceSAndroid Build Coastguard Worker void get_uniformuiv(NegativeTestContext &ctx)
747*35238bceSAndroid Build Coastguard Worker {
748*35238bceSAndroid Build Coastguard Worker glu::ShaderProgram program(ctx.getRenderContext(),
749*35238bceSAndroid Build Coastguard Worker glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx),
750*35238bceSAndroid Build Coastguard Worker getVtxFragVersionSources(uniformTestFragSource, ctx)));
751*35238bceSAndroid Build Coastguard Worker GLint unif = ctx.glGetUniformLocation(program.getProgram(), "fUnif_uvec4");
752*35238bceSAndroid Build Coastguard Worker GLuint params[4] = {0, 0, 0, 0};
753*35238bceSAndroid Build Coastguard Worker GLuint shader;
754*35238bceSAndroid Build Coastguard Worker GLuint programEmpty;
755*35238bceSAndroid Build Coastguard Worker
756*35238bceSAndroid Build Coastguard Worker ctx.glUseProgram(program.getProgram());
757*35238bceSAndroid Build Coastguard Worker
758*35238bceSAndroid Build Coastguard Worker if (unif == -1)
759*35238bceSAndroid Build Coastguard Worker ctx.fail("Failed to retrieve uniform location");
760*35238bceSAndroid Build Coastguard Worker
761*35238bceSAndroid Build Coastguard Worker shader = ctx.glCreateShader(GL_VERTEX_SHADER);
762*35238bceSAndroid Build Coastguard Worker programEmpty = ctx.glCreateProgram();
763*35238bceSAndroid Build Coastguard Worker
764*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
765*35238bceSAndroid Build Coastguard Worker ctx.glGetUniformuiv(-1, unif, ¶ms[0]);
766*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
767*35238bceSAndroid Build Coastguard Worker ctx.endSection();
768*35238bceSAndroid Build Coastguard Worker
769*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
770*35238bceSAndroid Build Coastguard Worker ctx.glGetUniformuiv(shader, unif, ¶ms[0]);
771*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
772*35238bceSAndroid Build Coastguard Worker ctx.endSection();
773*35238bceSAndroid Build Coastguard Worker
774*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
775*35238bceSAndroid Build Coastguard Worker ctx.glGetUniformuiv(programEmpty, unif, ¶ms[0]);
776*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
777*35238bceSAndroid Build Coastguard Worker ctx.endSection();
778*35238bceSAndroid Build Coastguard Worker
779*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable "
780*35238bceSAndroid Build Coastguard Worker "location for the specified program object.");
781*35238bceSAndroid Build Coastguard Worker ctx.glGetUniformuiv(program.getProgram(), -1, ¶ms[0]);
782*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
783*35238bceSAndroid Build Coastguard Worker ctx.endSection();
784*35238bceSAndroid Build Coastguard Worker
785*35238bceSAndroid Build Coastguard Worker ctx.glDeleteShader(shader);
786*35238bceSAndroid Build Coastguard Worker ctx.glDeleteProgram(programEmpty);
787*35238bceSAndroid Build Coastguard Worker }
788*35238bceSAndroid Build Coastguard Worker
get_nuniformuiv(NegativeTestContext & ctx)789*35238bceSAndroid Build Coastguard Worker void get_nuniformuiv(NegativeTestContext &ctx)
790*35238bceSAndroid Build Coastguard Worker {
791*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version.");
792*35238bceSAndroid Build Coastguard Worker
793*35238bceSAndroid Build Coastguard Worker glu::ShaderProgram program(ctx.getRenderContext(),
794*35238bceSAndroid Build Coastguard Worker glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx),
795*35238bceSAndroid Build Coastguard Worker getVtxFragVersionSources(uniformTestFragSource, ctx)));
796*35238bceSAndroid Build Coastguard Worker GLint unif = ctx.glGetUniformLocation(program.getProgram(), "fUnif_ivec4");
797*35238bceSAndroid Build Coastguard Worker GLuint params[4] = {0, 0, 0, 0};
798*35238bceSAndroid Build Coastguard Worker GLuint shader;
799*35238bceSAndroid Build Coastguard Worker GLuint programEmpty;
800*35238bceSAndroid Build Coastguard Worker GLsizei bufferSize;
801*35238bceSAndroid Build Coastguard Worker
802*35238bceSAndroid Build Coastguard Worker ctx.glUseProgram(program.getProgram());
803*35238bceSAndroid Build Coastguard Worker
804*35238bceSAndroid Build Coastguard Worker if (unif == -1)
805*35238bceSAndroid Build Coastguard Worker ctx.fail("Failed to retrieve uniform location");
806*35238bceSAndroid Build Coastguard Worker
807*35238bceSAndroid Build Coastguard Worker shader = ctx.glCreateShader(GL_VERTEX_SHADER);
808*35238bceSAndroid Build Coastguard Worker programEmpty = ctx.glCreateProgram();
809*35238bceSAndroid Build Coastguard Worker
810*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS, &bufferSize);
811*35238bceSAndroid Build Coastguard Worker
812*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
813*35238bceSAndroid Build Coastguard Worker ctx.glGetnUniformuiv(-1, unif, bufferSize, ¶ms[0]);
814*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
815*35238bceSAndroid Build Coastguard Worker ctx.endSection();
816*35238bceSAndroid Build Coastguard Worker
817*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
818*35238bceSAndroid Build Coastguard Worker ctx.glGetnUniformuiv(shader, unif, bufferSize, ¶ms[0]);
819*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
820*35238bceSAndroid Build Coastguard Worker ctx.endSection();
821*35238bceSAndroid Build Coastguard Worker
822*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
823*35238bceSAndroid Build Coastguard Worker ctx.glGetnUniformuiv(programEmpty, unif, bufferSize, ¶ms[0]);
824*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
825*35238bceSAndroid Build Coastguard Worker ctx.endSection();
826*35238bceSAndroid Build Coastguard Worker
827*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable "
828*35238bceSAndroid Build Coastguard Worker "location for the specified program object.");
829*35238bceSAndroid Build Coastguard Worker ctx.glGetnUniformuiv(program.getProgram(), -1, bufferSize, ¶ms[0]);
830*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
831*35238bceSAndroid Build Coastguard Worker ctx.endSection();
832*35238bceSAndroid Build Coastguard Worker
833*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer size required to store the requested data is "
834*35238bceSAndroid Build Coastguard Worker "greater than bufSize.");
835*35238bceSAndroid Build Coastguard Worker ctx.glGetnUniformuiv(program.getProgram(), unif, -1, ¶ms[0]);
836*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
837*35238bceSAndroid Build Coastguard Worker ctx.endSection();
838*35238bceSAndroid Build Coastguard Worker
839*35238bceSAndroid Build Coastguard Worker ctx.glDeleteShader(shader);
840*35238bceSAndroid Build Coastguard Worker ctx.glDeleteProgram(programEmpty);
841*35238bceSAndroid Build Coastguard Worker }
842*35238bceSAndroid Build Coastguard Worker
get_active_uniform(NegativeTestContext & ctx)843*35238bceSAndroid Build Coastguard Worker void get_active_uniform(NegativeTestContext &ctx)
844*35238bceSAndroid Build Coastguard Worker {
845*35238bceSAndroid Build Coastguard Worker GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
846*35238bceSAndroid Build Coastguard Worker glu::ShaderProgram program(ctx.getRenderContext(),
847*35238bceSAndroid Build Coastguard Worker glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx),
848*35238bceSAndroid Build Coastguard Worker getVtxFragVersionSources(uniformTestFragSource, ctx)));
849*35238bceSAndroid Build Coastguard Worker GLint numActiveUniforms = -1;
850*35238bceSAndroid Build Coastguard Worker
851*35238bceSAndroid Build Coastguard Worker ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_UNIFORMS, &numActiveUniforms);
852*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORMS = " << numActiveUniforms << " (expected 4)."
853*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
854*35238bceSAndroid Build Coastguard Worker
855*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
856*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveUniform(-1, 0, 0, 0, 0, 0, 0);
857*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
858*35238bceSAndroid Build Coastguard Worker ctx.endSection();
859*35238bceSAndroid Build Coastguard Worker
860*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
861*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveUniform(shader, 0, 0, 0, 0, 0, 0);
862*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
863*35238bceSAndroid Build Coastguard Worker ctx.endSection();
864*35238bceSAndroid Build Coastguard Worker
865*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to the number of active uniform "
866*35238bceSAndroid Build Coastguard Worker "variables in program.");
867*35238bceSAndroid Build Coastguard Worker ctx.glUseProgram(program.getProgram());
868*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveUniform(program.getProgram(), numActiveUniforms, 0, 0, 0, 0, 0);
869*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
870*35238bceSAndroid Build Coastguard Worker ctx.endSection();
871*35238bceSAndroid Build Coastguard Worker
872*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is less than 0.");
873*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveUniform(program.getProgram(), 0, -1, 0, 0, 0, 0);
874*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
875*35238bceSAndroid Build Coastguard Worker ctx.endSection();
876*35238bceSAndroid Build Coastguard Worker
877*35238bceSAndroid Build Coastguard Worker ctx.glUseProgram(0);
878*35238bceSAndroid Build Coastguard Worker ctx.glDeleteShader(shader);
879*35238bceSAndroid Build Coastguard Worker }
880*35238bceSAndroid Build Coastguard Worker
get_active_uniformsiv(NegativeTestContext & ctx)881*35238bceSAndroid Build Coastguard Worker void get_active_uniformsiv(NegativeTestContext &ctx)
882*35238bceSAndroid Build Coastguard Worker {
883*35238bceSAndroid Build Coastguard Worker GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
884*35238bceSAndroid Build Coastguard Worker glu::ShaderProgram program(ctx.getRenderContext(),
885*35238bceSAndroid Build Coastguard Worker glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx),
886*35238bceSAndroid Build Coastguard Worker getVtxFragVersionSources(uniformTestFragSource, ctx)));
887*35238bceSAndroid Build Coastguard Worker GLuint unusedUniformIndex = 1;
888*35238bceSAndroid Build Coastguard Worker GLint unusedParamDst = -1;
889*35238bceSAndroid Build Coastguard Worker GLint numActiveUniforms = -1;
890*35238bceSAndroid Build Coastguard Worker
891*35238bceSAndroid Build Coastguard Worker ctx.glUseProgram(program.getProgram());
892*35238bceSAndroid Build Coastguard Worker
893*35238bceSAndroid Build Coastguard Worker ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_UNIFORMS, &numActiveUniforms);
894*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORMS = " << numActiveUniforms << " (expected 4)."
895*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
896*35238bceSAndroid Build Coastguard Worker
897*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
898*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveUniformsiv(-1, 1, &unusedUniformIndex, GL_UNIFORM_TYPE, &unusedParamDst);
899*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
900*35238bceSAndroid Build Coastguard Worker ctx.endSection();
901*35238bceSAndroid Build Coastguard Worker
902*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
903*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveUniformsiv(shader, 1, &unusedUniformIndex, GL_UNIFORM_TYPE, &unusedParamDst);
904*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
905*35238bceSAndroid Build Coastguard Worker ctx.endSection();
906*35238bceSAndroid Build Coastguard Worker
907*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if any value in uniformIndices is greater than or equal to the "
908*35238bceSAndroid Build Coastguard Worker "value of GL_ACTIVE_UNIFORMS for program.");
909*35238bceSAndroid Build Coastguard Worker for (int excess = 0; excess <= 2; excess++)
910*35238bceSAndroid Build Coastguard Worker {
911*35238bceSAndroid Build Coastguard Worker std::vector<GLuint> invalidUniformIndices;
912*35238bceSAndroid Build Coastguard Worker invalidUniformIndices.push_back(1);
913*35238bceSAndroid Build Coastguard Worker invalidUniformIndices.push_back(numActiveUniforms - 1 + excess);
914*35238bceSAndroid Build Coastguard Worker invalidUniformIndices.push_back(1);
915*35238bceSAndroid Build Coastguard Worker
916*35238bceSAndroid Build Coastguard Worker std::vector<GLint> unusedParamsDst(invalidUniformIndices.size());
917*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveUniformsiv(program.getProgram(), (GLsizei)invalidUniformIndices.size(),
918*35238bceSAndroid Build Coastguard Worker &invalidUniformIndices[0], GL_UNIFORM_TYPE, &unusedParamsDst[0]);
919*35238bceSAndroid Build Coastguard Worker ctx.expectError(excess == 0 ? GL_NO_ERROR : GL_INVALID_VALUE);
920*35238bceSAndroid Build Coastguard Worker }
921*35238bceSAndroid Build Coastguard Worker ctx.endSection();
922*35238bceSAndroid Build Coastguard Worker
923*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted token.");
924*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveUniformsiv(program.getProgram(), 1, &unusedUniformIndex, -1, &unusedParamDst);
925*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
926*35238bceSAndroid Build Coastguard Worker ctx.endSection();
927*35238bceSAndroid Build Coastguard Worker
928*35238bceSAndroid Build Coastguard Worker ctx.glUseProgram(0);
929*35238bceSAndroid Build Coastguard Worker ctx.glDeleteShader(shader);
930*35238bceSAndroid Build Coastguard Worker }
931*35238bceSAndroid Build Coastguard Worker
get_active_uniform_blockiv(NegativeTestContext & ctx)932*35238bceSAndroid Build Coastguard Worker void get_active_uniform_blockiv(NegativeTestContext &ctx)
933*35238bceSAndroid Build Coastguard Worker {
934*35238bceSAndroid Build Coastguard Worker glu::ShaderProgram program(ctx.getRenderContext(),
935*35238bceSAndroid Build Coastguard Worker glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx),
936*35238bceSAndroid Build Coastguard Worker getVtxFragVersionSources(uniformTestFragSource, ctx)));
937*35238bceSAndroid Build Coastguard Worker GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
938*35238bceSAndroid Build Coastguard Worker GLint params = -1;
939*35238bceSAndroid Build Coastguard Worker GLint numActiveBlocks = -1;
940*35238bceSAndroid Build Coastguard Worker
941*35238bceSAndroid Build Coastguard Worker ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_UNIFORM_BLOCKS, &numActiveBlocks);
942*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORM_BLOCKS = " << numActiveBlocks << " (expected 1)."
943*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
944*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
945*35238bceSAndroid Build Coastguard Worker
946*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of either a program or shader object.");
947*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveUniformBlockiv(-1, 0, GL_UNIFORM_BLOCK_BINDING, ¶ms);
948*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
949*35238bceSAndroid Build Coastguard Worker ctx.endSection();
950*35238bceSAndroid Build Coastguard Worker
951*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object");
952*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveUniformBlockiv(shader, 0, GL_UNIFORM_BLOCK_BINDING, ¶ms);
953*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
954*35238bceSAndroid Build Coastguard Worker ctx.endSection();
955*35238bceSAndroid Build Coastguard Worker
956*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if uniformBlockIndex is greater than or equal to the value of "
957*35238bceSAndroid Build Coastguard Worker "GL_ACTIVE_UNIFORM_BLOCKS or is not the index of an active uniform block in program.");
958*35238bceSAndroid Build Coastguard Worker ctx.glUseProgram(program.getProgram());
959*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
960*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveUniformBlockiv(program.getProgram(), numActiveBlocks, GL_UNIFORM_BLOCK_BINDING, ¶ms);
961*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
962*35238bceSAndroid Build Coastguard Worker ctx.endSection();
963*35238bceSAndroid Build Coastguard Worker
964*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the accepted tokens.");
965*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveUniformBlockiv(program.getProgram(), 0, -1, ¶ms);
966*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
967*35238bceSAndroid Build Coastguard Worker ctx.endSection();
968*35238bceSAndroid Build Coastguard Worker
969*35238bceSAndroid Build Coastguard Worker ctx.glUseProgram(0);
970*35238bceSAndroid Build Coastguard Worker }
971*35238bceSAndroid Build Coastguard Worker
get_active_uniform_block_name(NegativeTestContext & ctx)972*35238bceSAndroid Build Coastguard Worker void get_active_uniform_block_name(NegativeTestContext &ctx)
973*35238bceSAndroid Build Coastguard Worker {
974*35238bceSAndroid Build Coastguard Worker glu::ShaderProgram program(ctx.getRenderContext(),
975*35238bceSAndroid Build Coastguard Worker glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx),
976*35238bceSAndroid Build Coastguard Worker getVtxFragVersionSources(uniformTestFragSource, ctx)));
977*35238bceSAndroid Build Coastguard Worker GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
978*35238bceSAndroid Build Coastguard Worker GLsizei length = -1;
979*35238bceSAndroid Build Coastguard Worker GLint numActiveBlocks = -1;
980*35238bceSAndroid Build Coastguard Worker GLchar uniformBlockName[128];
981*35238bceSAndroid Build Coastguard Worker
982*35238bceSAndroid Build Coastguard Worker deMemset(&uniformBlockName[0], 0, sizeof(uniformBlockName));
983*35238bceSAndroid Build Coastguard Worker
984*35238bceSAndroid Build Coastguard Worker ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_UNIFORM_BLOCKS, &numActiveBlocks);
985*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORM_BLOCKS = " << numActiveBlocks << " (expected 1)."
986*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
987*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
988*35238bceSAndroid Build Coastguard Worker
989*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object.");
990*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveUniformBlockName(shader, numActiveBlocks, GL_UNIFORM_BLOCK_BINDING, &length, &uniformBlockName[0]);
991*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
992*35238bceSAndroid Build Coastguard Worker ctx.endSection();
993*35238bceSAndroid Build Coastguard Worker
994*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of either a program or shader object.");
995*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveUniformBlockName(-1, numActiveBlocks, GL_UNIFORM_BLOCK_BINDING, &length, &uniformBlockName[0]);
996*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
997*35238bceSAndroid Build Coastguard Worker ctx.endSection();
998*35238bceSAndroid Build Coastguard Worker
999*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if uniformBlockIndex is greater than or equal to the value of "
1000*35238bceSAndroid Build Coastguard Worker "GL_ACTIVE_UNIFORM_BLOCKS or is not the index of an active uniform block in program.");
1001*35238bceSAndroid Build Coastguard Worker ctx.glUseProgram(program.getProgram());
1002*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1003*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveUniformBlockName(program.getProgram(), numActiveBlocks, (int)sizeof(uniformBlockName), &length,
1004*35238bceSAndroid Build Coastguard Worker &uniformBlockName[0]);
1005*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1006*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1007*35238bceSAndroid Build Coastguard Worker
1008*35238bceSAndroid Build Coastguard Worker ctx.glUseProgram(0);
1009*35238bceSAndroid Build Coastguard Worker }
1010*35238bceSAndroid Build Coastguard Worker
get_active_attrib(NegativeTestContext & ctx)1011*35238bceSAndroid Build Coastguard Worker void get_active_attrib(NegativeTestContext &ctx)
1012*35238bceSAndroid Build Coastguard Worker {
1013*35238bceSAndroid Build Coastguard Worker GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
1014*35238bceSAndroid Build Coastguard Worker glu::ShaderProgram program(ctx.getRenderContext(),
1015*35238bceSAndroid Build Coastguard Worker glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx),
1016*35238bceSAndroid Build Coastguard Worker getVtxFragVersionSources(uniformTestFragSource, ctx)));
1017*35238bceSAndroid Build Coastguard Worker GLint numActiveAttributes = -1;
1018*35238bceSAndroid Build Coastguard Worker GLsizei length = -1;
1019*35238bceSAndroid Build Coastguard Worker GLint size = -1;
1020*35238bceSAndroid Build Coastguard Worker GLenum type = -1;
1021*35238bceSAndroid Build Coastguard Worker GLchar name[32];
1022*35238bceSAndroid Build Coastguard Worker
1023*35238bceSAndroid Build Coastguard Worker deMemset(&name[0], 0, sizeof(name));
1024*35238bceSAndroid Build Coastguard Worker
1025*35238bceSAndroid Build Coastguard Worker ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_ATTRIBUTES, &numActiveAttributes);
1026*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// GL_ACTIVE_ATTRIBUTES = " << numActiveAttributes << " (expected 1)."
1027*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
1028*35238bceSAndroid Build Coastguard Worker
1029*35238bceSAndroid Build Coastguard Worker ctx.glUseProgram(program.getProgram());
1030*35238bceSAndroid Build Coastguard Worker
1031*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
1032*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveAttrib(-1, 0, 32, &length, &size, &type, &name[0]);
1033*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1034*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1035*35238bceSAndroid Build Coastguard Worker
1036*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
1037*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveAttrib(shader, 0, 32, &length, &size, &type, &name[0]);
1038*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1039*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1040*35238bceSAndroid Build Coastguard Worker
1041*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_ACTIVE_ATTRIBUTES.");
1042*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveAttrib(program.getProgram(), numActiveAttributes, (int)sizeof(name), &length, &size, &type,
1043*35238bceSAndroid Build Coastguard Worker &name[0]);
1044*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1045*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1046*35238bceSAndroid Build Coastguard Worker
1047*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is less than 0.");
1048*35238bceSAndroid Build Coastguard Worker ctx.glGetActiveAttrib(program.getProgram(), 0, -1, &length, &size, &type, &name[0]);
1049*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1050*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1051*35238bceSAndroid Build Coastguard Worker
1052*35238bceSAndroid Build Coastguard Worker ctx.glUseProgram(0);
1053*35238bceSAndroid Build Coastguard Worker ctx.glDeleteShader(shader);
1054*35238bceSAndroid Build Coastguard Worker }
1055*35238bceSAndroid Build Coastguard Worker
get_uniform_indices(NegativeTestContext & ctx)1056*35238bceSAndroid Build Coastguard Worker void get_uniform_indices(NegativeTestContext &ctx)
1057*35238bceSAndroid Build Coastguard Worker {
1058*35238bceSAndroid Build Coastguard Worker GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
1059*35238bceSAndroid Build Coastguard Worker glu::ShaderProgram program(ctx.getRenderContext(),
1060*35238bceSAndroid Build Coastguard Worker glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx),
1061*35238bceSAndroid Build Coastguard Worker getVtxFragVersionSources(uniformTestFragSource, ctx)));
1062*35238bceSAndroid Build Coastguard Worker GLint numActiveBlocks = -1;
1063*35238bceSAndroid Build Coastguard Worker const GLchar *uniformName = "Block.blockVar";
1064*35238bceSAndroid Build Coastguard Worker GLuint uniformIndices = -1;
1065*35238bceSAndroid Build Coastguard Worker GLuint invalid = -1;
1066*35238bceSAndroid Build Coastguard Worker
1067*35238bceSAndroid Build Coastguard Worker ctx.glGetProgramiv(program.getProgram(), GL_ACTIVE_UNIFORM_BLOCKS, &numActiveBlocks);
1068*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORM_BLOCKS = " << numActiveBlocks << TestLog::EndMessage;
1069*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1070*35238bceSAndroid Build Coastguard Worker
1071*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program is a name of shader object.");
1072*35238bceSAndroid Build Coastguard Worker ctx.glGetUniformIndices(shader, 1, &uniformName, &uniformIndices);
1073*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1074*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1075*35238bceSAndroid Build Coastguard Worker
1076*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if program is not name of program or shader object.");
1077*35238bceSAndroid Build Coastguard Worker ctx.glGetUniformIndices(invalid, 1, &uniformName, &uniformIndices);
1078*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1079*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1080*35238bceSAndroid Build Coastguard Worker
1081*35238bceSAndroid Build Coastguard Worker ctx.glUseProgram(0);
1082*35238bceSAndroid Build Coastguard Worker ctx.glDeleteShader(shader);
1083*35238bceSAndroid Build Coastguard Worker }
1084*35238bceSAndroid Build Coastguard Worker
get_vertex_attribfv(NegativeTestContext & ctx)1085*35238bceSAndroid Build Coastguard Worker void get_vertex_attribfv(NegativeTestContext &ctx)
1086*35238bceSAndroid Build Coastguard Worker {
1087*35238bceSAndroid Build Coastguard Worker GLfloat params = 0.0f;
1088*35238bceSAndroid Build Coastguard Worker GLint maxVertexAttribs;
1089*35238bceSAndroid Build Coastguard Worker VAOHelper vao(ctx);
1090*35238bceSAndroid Build Coastguard Worker
1091*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1092*35238bceSAndroid Build Coastguard Worker ctx.glGetVertexAttribfv(0, -1, ¶ms);
1093*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1094*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1095*35238bceSAndroid Build Coastguard Worker
1096*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
1097*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
1098*35238bceSAndroid Build Coastguard Worker ctx.glGetVertexAttribfv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_ENABLED, ¶ms);
1099*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1100*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1101*35238bceSAndroid Build Coastguard Worker }
1102*35238bceSAndroid Build Coastguard Worker
get_vertex_attribiv(NegativeTestContext & ctx)1103*35238bceSAndroid Build Coastguard Worker void get_vertex_attribiv(NegativeTestContext &ctx)
1104*35238bceSAndroid Build Coastguard Worker {
1105*35238bceSAndroid Build Coastguard Worker GLint params = -1;
1106*35238bceSAndroid Build Coastguard Worker GLint maxVertexAttribs;
1107*35238bceSAndroid Build Coastguard Worker VAOHelper vao(ctx);
1108*35238bceSAndroid Build Coastguard Worker
1109*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1110*35238bceSAndroid Build Coastguard Worker ctx.glGetVertexAttribiv(0, -1, ¶ms);
1111*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1112*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1113*35238bceSAndroid Build Coastguard Worker
1114*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
1115*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
1116*35238bceSAndroid Build Coastguard Worker ctx.glGetVertexAttribiv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_ENABLED, ¶ms);
1117*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1118*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1119*35238bceSAndroid Build Coastguard Worker }
1120*35238bceSAndroid Build Coastguard Worker
get_vertex_attribi_iv(NegativeTestContext & ctx)1121*35238bceSAndroid Build Coastguard Worker void get_vertex_attribi_iv(NegativeTestContext &ctx)
1122*35238bceSAndroid Build Coastguard Worker {
1123*35238bceSAndroid Build Coastguard Worker GLint params = -1;
1124*35238bceSAndroid Build Coastguard Worker GLint maxVertexAttribs;
1125*35238bceSAndroid Build Coastguard Worker VAOHelper vao(ctx);
1126*35238bceSAndroid Build Coastguard Worker
1127*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1128*35238bceSAndroid Build Coastguard Worker ctx.glGetVertexAttribIiv(0, -1, ¶ms);
1129*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1130*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1131*35238bceSAndroid Build Coastguard Worker
1132*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
1133*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
1134*35238bceSAndroid Build Coastguard Worker ctx.glGetVertexAttribIiv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_ENABLED, ¶ms);
1135*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1136*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1137*35238bceSAndroid Build Coastguard Worker }
1138*35238bceSAndroid Build Coastguard Worker
get_vertex_attribi_uiv(NegativeTestContext & ctx)1139*35238bceSAndroid Build Coastguard Worker void get_vertex_attribi_uiv(NegativeTestContext &ctx)
1140*35238bceSAndroid Build Coastguard Worker {
1141*35238bceSAndroid Build Coastguard Worker GLuint params = (GLuint)-1;
1142*35238bceSAndroid Build Coastguard Worker GLint maxVertexAttribs;
1143*35238bceSAndroid Build Coastguard Worker VAOHelper vao(ctx);
1144*35238bceSAndroid Build Coastguard Worker
1145*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1146*35238bceSAndroid Build Coastguard Worker ctx.glGetVertexAttribIuiv(0, -1, ¶ms);
1147*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1148*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1149*35238bceSAndroid Build Coastguard Worker
1150*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
1151*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
1152*35238bceSAndroid Build Coastguard Worker ctx.glGetVertexAttribIuiv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_ENABLED, ¶ms);
1153*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1154*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1155*35238bceSAndroid Build Coastguard Worker }
1156*35238bceSAndroid Build Coastguard Worker
get_vertex_attrib_pointerv(NegativeTestContext & ctx)1157*35238bceSAndroid Build Coastguard Worker void get_vertex_attrib_pointerv(NegativeTestContext &ctx)
1158*35238bceSAndroid Build Coastguard Worker {
1159*35238bceSAndroid Build Coastguard Worker GLvoid *ptr[1] = {DE_NULL};
1160*35238bceSAndroid Build Coastguard Worker GLint maxVertexAttribs;
1161*35238bceSAndroid Build Coastguard Worker
1162*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1163*35238bceSAndroid Build Coastguard Worker ctx.glGetVertexAttribPointerv(0, -1, &ptr[0]);
1164*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1165*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1166*35238bceSAndroid Build Coastguard Worker
1167*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.");
1168*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
1169*35238bceSAndroid Build Coastguard Worker ctx.glGetVertexAttribPointerv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_POINTER, &ptr[0]);
1170*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1171*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1172*35238bceSAndroid Build Coastguard Worker }
1173*35238bceSAndroid Build Coastguard Worker
get_frag_data_location(NegativeTestContext & ctx)1174*35238bceSAndroid Build Coastguard Worker void get_frag_data_location(NegativeTestContext &ctx)
1175*35238bceSAndroid Build Coastguard Worker {
1176*35238bceSAndroid Build Coastguard Worker GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
1177*35238bceSAndroid Build Coastguard Worker GLuint program = ctx.glCreateProgram();
1178*35238bceSAndroid Build Coastguard Worker
1179*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object.");
1180*35238bceSAndroid Build Coastguard Worker ctx.glGetFragDataLocation(shader, "gl_FragColor");
1181*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1182*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1183*35238bceSAndroid Build Coastguard Worker
1184*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been linked.");
1185*35238bceSAndroid Build Coastguard Worker ctx.glGetFragDataLocation(program, "gl_FragColor");
1186*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1187*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1188*35238bceSAndroid Build Coastguard Worker
1189*35238bceSAndroid Build Coastguard Worker ctx.glDeleteProgram(program);
1190*35238bceSAndroid Build Coastguard Worker ctx.glDeleteShader(shader);
1191*35238bceSAndroid Build Coastguard Worker }
1192*35238bceSAndroid Build Coastguard Worker
1193*35238bceSAndroid Build Coastguard Worker // Enumerated state queries: Buffers
1194*35238bceSAndroid Build Coastguard Worker
get_buffer_parameteriv(NegativeTestContext & ctx)1195*35238bceSAndroid Build Coastguard Worker void get_buffer_parameteriv(NegativeTestContext &ctx)
1196*35238bceSAndroid Build Coastguard Worker {
1197*35238bceSAndroid Build Coastguard Worker GLint params = -1;
1198*35238bceSAndroid Build Coastguard Worker GLuint buf;
1199*35238bceSAndroid Build Coastguard Worker ctx.glGenBuffers(1, &buf);
1200*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ARRAY_BUFFER, buf);
1201*35238bceSAndroid Build Coastguard Worker
1202*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target or value is not an accepted value.");
1203*35238bceSAndroid Build Coastguard Worker ctx.glGetBufferParameteriv(-1, GL_BUFFER_SIZE, ¶ms);
1204*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1205*35238bceSAndroid Build Coastguard Worker ctx.glGetBufferParameteriv(GL_ARRAY_BUFFER, -1, ¶ms);
1206*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1207*35238bceSAndroid Build Coastguard Worker ctx.glGetBufferParameteriv(-1, -1, ¶ms);
1208*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1209*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1210*35238bceSAndroid Build Coastguard Worker
1211*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target.");
1212*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
1213*35238bceSAndroid Build Coastguard Worker ctx.glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, ¶ms);
1214*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1215*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1216*35238bceSAndroid Build Coastguard Worker
1217*35238bceSAndroid Build Coastguard Worker ctx.glDeleteBuffers(1, &buf);
1218*35238bceSAndroid Build Coastguard Worker }
1219*35238bceSAndroid Build Coastguard Worker
get_buffer_parameteri64v(NegativeTestContext & ctx)1220*35238bceSAndroid Build Coastguard Worker void get_buffer_parameteri64v(NegativeTestContext &ctx)
1221*35238bceSAndroid Build Coastguard Worker {
1222*35238bceSAndroid Build Coastguard Worker GLint64 params = -1;
1223*35238bceSAndroid Build Coastguard Worker GLuint buf;
1224*35238bceSAndroid Build Coastguard Worker ctx.glGenBuffers(1, &buf);
1225*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ARRAY_BUFFER, buf);
1226*35238bceSAndroid Build Coastguard Worker
1227*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target or value is not an accepted value.");
1228*35238bceSAndroid Build Coastguard Worker ctx.glGetBufferParameteri64v(-1, GL_BUFFER_SIZE, ¶ms);
1229*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1230*35238bceSAndroid Build Coastguard Worker ctx.glGetBufferParameteri64v(GL_ARRAY_BUFFER, -1, ¶ms);
1231*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1232*35238bceSAndroid Build Coastguard Worker ctx.glGetBufferParameteri64v(-1, -1, ¶ms);
1233*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1234*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1235*35238bceSAndroid Build Coastguard Worker
1236*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target.");
1237*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
1238*35238bceSAndroid Build Coastguard Worker ctx.glGetBufferParameteri64v(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, ¶ms);
1239*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1240*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1241*35238bceSAndroid Build Coastguard Worker
1242*35238bceSAndroid Build Coastguard Worker ctx.glDeleteBuffers(1, &buf);
1243*35238bceSAndroid Build Coastguard Worker }
1244*35238bceSAndroid Build Coastguard Worker
get_buffer_pointerv(NegativeTestContext & ctx)1245*35238bceSAndroid Build Coastguard Worker void get_buffer_pointerv(NegativeTestContext &ctx)
1246*35238bceSAndroid Build Coastguard Worker {
1247*35238bceSAndroid Build Coastguard Worker GLvoid *params = DE_NULL;
1248*35238bceSAndroid Build Coastguard Worker GLuint buf;
1249*35238bceSAndroid Build Coastguard Worker ctx.glGenBuffers(1, &buf);
1250*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ARRAY_BUFFER, buf);
1251*35238bceSAndroid Build Coastguard Worker
1252*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
1253*35238bceSAndroid Build Coastguard Worker ctx.glGetBufferPointerv(GL_ARRAY_BUFFER, -1, ¶ms);
1254*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1255*35238bceSAndroid Build Coastguard Worker ctx.glGetBufferPointerv(-1, GL_BUFFER_MAP_POINTER, ¶ms);
1256*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1257*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1258*35238bceSAndroid Build Coastguard Worker
1259*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target.");
1260*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
1261*35238bceSAndroid Build Coastguard Worker ctx.glGetBufferPointerv(GL_ARRAY_BUFFER, GL_BUFFER_MAP_POINTER, ¶ms);
1262*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1263*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1264*35238bceSAndroid Build Coastguard Worker
1265*35238bceSAndroid Build Coastguard Worker ctx.glDeleteBuffers(1, &buf);
1266*35238bceSAndroid Build Coastguard Worker }
1267*35238bceSAndroid Build Coastguard Worker
get_framebuffer_attachment_parameteriv(NegativeTestContext & ctx)1268*35238bceSAndroid Build Coastguard Worker void get_framebuffer_attachment_parameteriv(NegativeTestContext &ctx)
1269*35238bceSAndroid Build Coastguard Worker {
1270*35238bceSAndroid Build Coastguard Worker GLint params[1] = {-1};
1271*35238bceSAndroid Build Coastguard Worker GLuint fbo;
1272*35238bceSAndroid Build Coastguard Worker GLuint rbo[2];
1273*35238bceSAndroid Build Coastguard Worker
1274*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(1, &fbo);
1275*35238bceSAndroid Build Coastguard Worker ctx.glGenRenderbuffers(2, rbo);
1276*35238bceSAndroid Build Coastguard Worker
1277*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1278*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo[0]);
1279*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, 16, 16);
1280*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rbo[0]);
1281*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo[1]);
1282*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, 16, 16);
1283*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo[1]);
1284*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
1285*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1286*35238bceSAndroid Build Coastguard Worker
1287*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
1288*35238bceSAndroid Build Coastguard Worker ctx.glGetFramebufferAttachmentParameteriv(-1, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE,
1289*35238bceSAndroid Build Coastguard Worker ¶ms[0]); // TYPE is GL_RENDERBUFFER
1290*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1291*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1292*35238bceSAndroid Build Coastguard Worker
1293*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
1294*35238bceSAndroid Build Coastguard Worker "GL_INVALID_ENUM is generated if pname is not valid for the value of GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE.");
1295*35238bceSAndroid Build Coastguard Worker ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
1296*35238bceSAndroid Build Coastguard Worker GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL,
1297*35238bceSAndroid Build Coastguard Worker ¶ms[0]); // TYPE is GL_RENDERBUFFER
1298*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1299*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1300*35238bceSAndroid Build Coastguard Worker
1301*35238bceSAndroid Build Coastguard Worker ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME,
1302*35238bceSAndroid Build Coastguard Worker ¶ms[0]); // TYPE is GL_FRAMEBUFFER_DEFAULT
1303*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1304*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1305*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1306*35238bceSAndroid Build Coastguard Worker
1307*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if attachment is GL_DEPTH_STENCIL_ATTACHMENT and different "
1308*35238bceSAndroid Build Coastguard Worker "objects are bound to the depth and stencil attachment points of target.");
1309*35238bceSAndroid Build Coastguard Worker ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
1310*35238bceSAndroid Build Coastguard Worker GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]);
1311*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1312*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1313*35238bceSAndroid Build Coastguard Worker
1314*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the value of GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is "
1315*35238bceSAndroid Build Coastguard Worker "GL_NONE and pname is not GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME.");
1316*35238bceSAndroid Build Coastguard Worker ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
1317*35238bceSAndroid Build Coastguard Worker GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]); // TYPE is GL_NONE
1318*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1319*35238bceSAndroid Build Coastguard Worker ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
1320*35238bceSAndroid Build Coastguard Worker GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE, ¶ms[0]); // TYPE is GL_NONE
1321*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1322*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1323*35238bceSAndroid Build Coastguard Worker
1324*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION or GL_INVALID_ENUM is generated if attachment is not one of the accepted "
1325*35238bceSAndroid Build Coastguard Worker "values for the current binding of target.");
1326*35238bceSAndroid Build Coastguard Worker ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME,
1327*35238bceSAndroid Build Coastguard Worker ¶ms[0]); // A FBO is bound so GL_BACK is invalid
1328*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION, GL_INVALID_ENUM);
1329*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1330*35238bceSAndroid Build Coastguard Worker ctx.glGetFramebufferAttachmentParameteriv(
1331*35238bceSAndroid Build Coastguard Worker GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME,
1332*35238bceSAndroid Build Coastguard Worker ¶ms[0]); // Default framebuffer is bound so GL_COLOR_ATTACHMENT0 is invalid
1333*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION, GL_INVALID_ENUM);
1334*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1335*35238bceSAndroid Build Coastguard Worker
1336*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(1, &fbo);
1337*35238bceSAndroid Build Coastguard Worker }
1338*35238bceSAndroid Build Coastguard Worker
get_renderbuffer_parameteriv(NegativeTestContext & ctx)1339*35238bceSAndroid Build Coastguard Worker void get_renderbuffer_parameteriv(NegativeTestContext &ctx)
1340*35238bceSAndroid Build Coastguard Worker {
1341*35238bceSAndroid Build Coastguard Worker GLint params[1] = {-1};
1342*35238bceSAndroid Build Coastguard Worker GLuint rbo;
1343*35238bceSAndroid Build Coastguard Worker ctx.glGenRenderbuffers(1, &rbo);
1344*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo);
1345*35238bceSAndroid Build Coastguard Worker
1346*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER.");
1347*35238bceSAndroid Build Coastguard Worker ctx.glGetRenderbufferParameteriv(-1, GL_RENDERBUFFER_WIDTH, ¶ms[0]);
1348*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1349*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1350*35238bceSAndroid Build Coastguard Worker
1351*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the accepted tokens.");
1352*35238bceSAndroid Build Coastguard Worker ctx.glGetRenderbufferParameteriv(GL_RENDERBUFFER, -1, ¶ms[0]);
1353*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1354*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1355*35238bceSAndroid Build Coastguard Worker
1356*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the renderbuffer currently bound to target is zero.");
1357*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, 0);
1358*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1359*35238bceSAndroid Build Coastguard Worker ctx.glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, ¶ms[0]);
1360*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1361*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1362*35238bceSAndroid Build Coastguard Worker
1363*35238bceSAndroid Build Coastguard Worker ctx.glDeleteRenderbuffers(1, &rbo);
1364*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, 0);
1365*35238bceSAndroid Build Coastguard Worker }
1366*35238bceSAndroid Build Coastguard Worker
get_internalformativ(NegativeTestContext & ctx)1367*35238bceSAndroid Build Coastguard Worker void get_internalformativ(NegativeTestContext &ctx)
1368*35238bceSAndroid Build Coastguard Worker {
1369*35238bceSAndroid Build Coastguard Worker const bool isES = glu::isContextTypeES(ctx.getRenderContext().getType());
1370*35238bceSAndroid Build Coastguard Worker GLint params[16];
1371*35238bceSAndroid Build Coastguard Worker
1372*35238bceSAndroid Build Coastguard Worker deMemset(¶ms[0], 0xcd, sizeof(params));
1373*35238bceSAndroid Build Coastguard Worker
1374*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is negative.");
1375*35238bceSAndroid Build Coastguard Worker ctx.glGetInternalformativ(GL_RENDERBUFFER, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, -1, ¶ms[0]);
1376*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1377*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1378*35238bceSAndroid Build Coastguard Worker
1379*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if pname is not GL_SAMPLES or GL_NUM_SAMPLE_COUNTS.");
1380*35238bceSAndroid Build Coastguard Worker ctx.glGetInternalformativ(GL_RENDERBUFFER, GL_RGBA8, -1, 16, ¶ms[0]);
1381*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1382*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1383*35238bceSAndroid Build Coastguard Worker
1384*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if internalformat is not color-, depth-, or stencil-renderable.");
1385*35238bceSAndroid Build Coastguard Worker
1386*35238bceSAndroid Build Coastguard Worker if (isES)
1387*35238bceSAndroid Build Coastguard Worker {
1388*35238bceSAndroid Build Coastguard Worker if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_render_snorm"))
1389*35238bceSAndroid Build Coastguard Worker {
1390*35238bceSAndroid Build Coastguard Worker ctx.glGetInternalformativ(GL_RENDERBUFFER, GL_RG8_SNORM, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]);
1391*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1392*35238bceSAndroid Build Coastguard Worker }
1393*35238bceSAndroid Build Coastguard Worker
1394*35238bceSAndroid Build Coastguard Worker ctx.glGetInternalformativ(GL_RENDERBUFFER, GL_COMPRESSED_RGB8_ETC2, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]);
1395*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1396*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1397*35238bceSAndroid Build Coastguard Worker }
1398*35238bceSAndroid Build Coastguard Worker
1399*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER.");
1400*35238bceSAndroid Build Coastguard Worker ctx.glGetInternalformativ(-1, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]);
1401*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1402*35238bceSAndroid Build Coastguard Worker ctx.glGetInternalformativ(GL_FRAMEBUFFER, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]);
1403*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1404*35238bceSAndroid Build Coastguard Worker
1405*35238bceSAndroid Build Coastguard Worker if (isES && !ctx.getContextInfo().isExtensionSupported("GL_EXT_sparse_texture"))
1406*35238bceSAndroid Build Coastguard Worker {
1407*35238bceSAndroid Build Coastguard Worker ctx.glGetInternalformativ(GL_TEXTURE_2D, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]);
1408*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1409*35238bceSAndroid Build Coastguard Worker }
1410*35238bceSAndroid Build Coastguard Worker
1411*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1412*35238bceSAndroid Build Coastguard Worker }
1413*35238bceSAndroid Build Coastguard Worker
1414*35238bceSAndroid Build Coastguard Worker // Query object queries
1415*35238bceSAndroid Build Coastguard Worker
get_queryiv(NegativeTestContext & ctx)1416*35238bceSAndroid Build Coastguard Worker void get_queryiv(NegativeTestContext &ctx)
1417*35238bceSAndroid Build Coastguard Worker {
1418*35238bceSAndroid Build Coastguard Worker GLint params = -1;
1419*35238bceSAndroid Build Coastguard Worker
1420*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value.");
1421*35238bceSAndroid Build Coastguard Worker ctx.glGetQueryiv(GL_ANY_SAMPLES_PASSED, -1, ¶ms);
1422*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1423*35238bceSAndroid Build Coastguard Worker ctx.glGetQueryiv(-1, GL_CURRENT_QUERY, ¶ms);
1424*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1425*35238bceSAndroid Build Coastguard Worker ctx.glGetQueryiv(-1, -1, ¶ms);
1426*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1427*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1428*35238bceSAndroid Build Coastguard Worker }
1429*35238bceSAndroid Build Coastguard Worker
get_query_objectuiv(NegativeTestContext & ctx)1430*35238bceSAndroid Build Coastguard Worker void get_query_objectuiv(NegativeTestContext &ctx)
1431*35238bceSAndroid Build Coastguard Worker {
1432*35238bceSAndroid Build Coastguard Worker GLuint params = -1;
1433*35238bceSAndroid Build Coastguard Worker GLuint id;
1434*35238bceSAndroid Build Coastguard Worker ctx.glGenQueries(1, &id);
1435*35238bceSAndroid Build Coastguard Worker
1436*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if id is not the name of a query object.");
1437*35238bceSAndroid Build Coastguard Worker ctx.glGetQueryObjectuiv(-1, GL_QUERY_RESULT_AVAILABLE, ¶ms);
1438*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1439*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// Note: " << id
1440*35238bceSAndroid Build Coastguard Worker << " is not a query object yet, since it hasn't been used by glBeginQuery" << TestLog::EndMessage;
1441*35238bceSAndroid Build Coastguard Worker ctx.glGetQueryObjectuiv(id, GL_QUERY_RESULT_AVAILABLE, ¶ms);
1442*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1443*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1444*35238bceSAndroid Build Coastguard Worker
1445*35238bceSAndroid Build Coastguard Worker ctx.glBeginQuery(GL_ANY_SAMPLES_PASSED, id);
1446*35238bceSAndroid Build Coastguard Worker ctx.glEndQuery(GL_ANY_SAMPLES_PASSED);
1447*35238bceSAndroid Build Coastguard Worker
1448*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value.");
1449*35238bceSAndroid Build Coastguard Worker ctx.glGetQueryObjectuiv(id, -1, ¶ms);
1450*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1451*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1452*35238bceSAndroid Build Coastguard Worker
1453*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if id is the name of a currently active query object.");
1454*35238bceSAndroid Build Coastguard Worker ctx.glBeginQuery(GL_ANY_SAMPLES_PASSED, id);
1455*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1456*35238bceSAndroid Build Coastguard Worker ctx.glGetQueryObjectuiv(id, GL_QUERY_RESULT_AVAILABLE, ¶ms);
1457*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1458*35238bceSAndroid Build Coastguard Worker ctx.glEndQuery(GL_ANY_SAMPLES_PASSED);
1459*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1460*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1461*35238bceSAndroid Build Coastguard Worker
1462*35238bceSAndroid Build Coastguard Worker ctx.glDeleteQueries(1, &id);
1463*35238bceSAndroid Build Coastguard Worker }
1464*35238bceSAndroid Build Coastguard Worker
1465*35238bceSAndroid Build Coastguard Worker // Sync object queries
1466*35238bceSAndroid Build Coastguard Worker
get_synciv(NegativeTestContext & ctx)1467*35238bceSAndroid Build Coastguard Worker void get_synciv(NegativeTestContext &ctx)
1468*35238bceSAndroid Build Coastguard Worker {
1469*35238bceSAndroid Build Coastguard Worker GLsizei length = -1;
1470*35238bceSAndroid Build Coastguard Worker GLint values[32];
1471*35238bceSAndroid Build Coastguard Worker GLsync sync;
1472*35238bceSAndroid Build Coastguard Worker
1473*35238bceSAndroid Build Coastguard Worker deMemset(&values[0], 0xcd, sizeof(values));
1474*35238bceSAndroid Build Coastguard Worker
1475*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if sync is not the name of a sync object.");
1476*35238bceSAndroid Build Coastguard Worker ctx.glGetSynciv(0, GL_OBJECT_TYPE, 32, &length, &values[0]);
1477*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1478*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1479*35238bceSAndroid Build Coastguard Worker
1480*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the accepted tokens.");
1481*35238bceSAndroid Build Coastguard Worker sync = ctx.glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
1482*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1483*35238bceSAndroid Build Coastguard Worker ctx.glGetSynciv(sync, -1, 32, &length, &values[0]);
1484*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1485*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1486*35238bceSAndroid Build Coastguard Worker
1487*35238bceSAndroid Build Coastguard Worker ctx.glDeleteSync(sync);
1488*35238bceSAndroid Build Coastguard Worker
1489*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is negative.");
1490*35238bceSAndroid Build Coastguard Worker sync = ctx.glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
1491*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1492*35238bceSAndroid Build Coastguard Worker ctx.glGetSynciv(sync, GL_OBJECT_TYPE, -1, &length, &values[0]);
1493*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1494*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1495*35238bceSAndroid Build Coastguard Worker
1496*35238bceSAndroid Build Coastguard Worker ctx.glDeleteSync(sync);
1497*35238bceSAndroid Build Coastguard Worker }
1498*35238bceSAndroid Build Coastguard Worker
1499*35238bceSAndroid Build Coastguard Worker // Enumerated boolean state queries
1500*35238bceSAndroid Build Coastguard Worker
is_enabled(NegativeTestContext & ctx)1501*35238bceSAndroid Build Coastguard Worker void is_enabled(NegativeTestContext &ctx)
1502*35238bceSAndroid Build Coastguard Worker {
1503*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if cap is not an accepted value.");
1504*35238bceSAndroid Build Coastguard Worker ctx.glIsEnabled(-1);
1505*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1506*35238bceSAndroid Build Coastguard Worker ctx.glIsEnabled(GL_TRIANGLES);
1507*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1508*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1509*35238bceSAndroid Build Coastguard Worker }
1510*35238bceSAndroid Build Coastguard Worker
is_enabledi(NegativeTestContext & ctx)1511*35238bceSAndroid Build Coastguard Worker void is_enabledi(NegativeTestContext &ctx)
1512*35238bceSAndroid Build Coastguard Worker {
1513*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version.");
1514*35238bceSAndroid Build Coastguard Worker
1515*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if cap is not an accepted value.");
1516*35238bceSAndroid Build Coastguard Worker ctx.glIsEnabledi(-1, 1);
1517*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1518*35238bceSAndroid Build Coastguard Worker ctx.glIsEnabledi(GL_TRIANGLES, 1);
1519*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1520*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1521*35238bceSAndroid Build Coastguard Worker
1522*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if index is outside the valid range for the indexed state cap.");
1523*35238bceSAndroid Build Coastguard Worker ctx.glIsEnabledi(GL_BLEND, -1);
1524*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1525*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1526*35238bceSAndroid Build Coastguard Worker }
1527*35238bceSAndroid Build Coastguard Worker
1528*35238bceSAndroid Build Coastguard Worker // Hints
1529*35238bceSAndroid Build Coastguard Worker
hint(NegativeTestContext & ctx)1530*35238bceSAndroid Build Coastguard Worker void hint(NegativeTestContext &ctx)
1531*35238bceSAndroid Build Coastguard Worker {
1532*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if either target or mode is not an accepted value.");
1533*35238bceSAndroid Build Coastguard Worker ctx.glHint(GL_GENERATE_MIPMAP_HINT, -1);
1534*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1535*35238bceSAndroid Build Coastguard Worker ctx.glHint(-1, GL_FASTEST);
1536*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1537*35238bceSAndroid Build Coastguard Worker ctx.glHint(-1, -1);
1538*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1539*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1540*35238bceSAndroid Build Coastguard Worker }
1541*35238bceSAndroid Build Coastguard Worker
getNegativeStateApiTestFunctions()1542*35238bceSAndroid Build Coastguard Worker std::vector<FunctionContainer> getNegativeStateApiTestFunctions()
1543*35238bceSAndroid Build Coastguard Worker {
1544*35238bceSAndroid Build Coastguard Worker const FunctionContainer funcs[] = {
1545*35238bceSAndroid Build Coastguard Worker {enable, "enable", "Invalid glEnable() usage"},
1546*35238bceSAndroid Build Coastguard Worker {disable, "disable", "Invalid glDisable() usage"},
1547*35238bceSAndroid Build Coastguard Worker {get_booleanv, "get_booleanv", "Invalid glGetBooleanv() usage"},
1548*35238bceSAndroid Build Coastguard Worker {get_floatv, "get_floatv", "Invalid glGetFloatv() usage"},
1549*35238bceSAndroid Build Coastguard Worker {get_integerv, "get_integerv", "Invalid glGetIntegerv() usage"},
1550*35238bceSAndroid Build Coastguard Worker {get_integer64v, "get_integer64v", "Invalid glGetInteger64v() usage"},
1551*35238bceSAndroid Build Coastguard Worker {get_integeri_v, "get_integeri_v", "Invalid glGetIntegeri_v() usage"},
1552*35238bceSAndroid Build Coastguard Worker {get_booleani_v, "get_booleani_v", "Invalid glGetBooleani_v() usage"},
1553*35238bceSAndroid Build Coastguard Worker {get_integer64i_v, "get_integer64i_v", "Invalid glGetInteger64i_v() usage"},
1554*35238bceSAndroid Build Coastguard Worker {get_string, "get_string", "Invalid glGetString() usage"},
1555*35238bceSAndroid Build Coastguard Worker {get_stringi, "get_stringi", "Invalid glGetStringi() usage"},
1556*35238bceSAndroid Build Coastguard Worker {get_attached_shaders, "get_attached_shaders", "Invalid glGetAttachedShaders() usage"},
1557*35238bceSAndroid Build Coastguard Worker {get_shaderiv, "get_shaderiv", "Invalid glGetShaderiv() usage"},
1558*35238bceSAndroid Build Coastguard Worker {get_shader_info_log, "get_shader_info_log", "Invalid glGetShaderInfoLog() usage"},
1559*35238bceSAndroid Build Coastguard Worker {get_shader_precision_format, "get_shader_precision_format", "Invalid glGetShaderPrecisionFormat() usage"},
1560*35238bceSAndroid Build Coastguard Worker {get_shader_source, "get_shader_source", "Invalid glGetShaderSource() usage"},
1561*35238bceSAndroid Build Coastguard Worker {get_programiv, "get_programiv", "Invalid glGetProgramiv() usage"},
1562*35238bceSAndroid Build Coastguard Worker {get_program_info_log, "get_program_info_log", "Invalid glGetProgramInfoLog() usage"},
1563*35238bceSAndroid Build Coastguard Worker {get_tex_parameterfv, "get_tex_parameterfv", "Invalid glGetTexParameterfv() usage"},
1564*35238bceSAndroid Build Coastguard Worker {get_tex_parameteriv, "get_tex_parameteriv", "Invalid glGetTexParameteriv() usage"},
1565*35238bceSAndroid Build Coastguard Worker {get_uniformfv, "get_uniformfv", "Invalid glGetUniformfv() usage"},
1566*35238bceSAndroid Build Coastguard Worker {get_uniformiv, "get_uniformiv", "Invalid glGetUniformiv() usage"},
1567*35238bceSAndroid Build Coastguard Worker {get_uniformuiv, "get_uniformuiv", "Invalid glGetUniformuiv() usage"},
1568*35238bceSAndroid Build Coastguard Worker {get_active_uniform, "get_active_uniform", "Invalid glGetActiveUniform() usage"},
1569*35238bceSAndroid Build Coastguard Worker {get_active_uniformsiv, "get_active_uniformsiv", "Invalid glGetActiveUniformsiv() usage"},
1570*35238bceSAndroid Build Coastguard Worker {get_active_uniform_blockiv, "get_active_uniform_blockiv", "Invalid glGetActiveUniformBlockiv() usage"},
1571*35238bceSAndroid Build Coastguard Worker {get_active_uniform_block_name, "get_active_uniform_block_name", "Invalid glGetActiveUniformBlockName() usage"},
1572*35238bceSAndroid Build Coastguard Worker {get_active_attrib, "get_active_attrib", "Invalid glGetActiveAttrib() usage"},
1573*35238bceSAndroid Build Coastguard Worker {get_uniform_indices, "get_uniform_indices", "Invalid glGetUniformIndices() usage"},
1574*35238bceSAndroid Build Coastguard Worker {get_vertex_attribfv, "get_vertex_attribfv", "Invalid glGetVertexAttribfv() usage"},
1575*35238bceSAndroid Build Coastguard Worker {get_vertex_attribiv, "get_vertex_attribiv", "Invalid glGetVertexAttribiv() usage"},
1576*35238bceSAndroid Build Coastguard Worker {get_vertex_attribi_iv, "get_vertex_attribi_iv", "Invalid glGetVertexAttribIiv() usage"},
1577*35238bceSAndroid Build Coastguard Worker {get_vertex_attribi_uiv, "get_vertex_attribi_uiv", "Invalid glGetVertexAttribIuiv() usage"},
1578*35238bceSAndroid Build Coastguard Worker {get_vertex_attrib_pointerv, "get_vertex_attrib_pointerv", "Invalid glGetVertexAttribPointerv() usage"},
1579*35238bceSAndroid Build Coastguard Worker {get_frag_data_location, "get_frag_data_location", "Invalid glGetFragDataLocation() usage"},
1580*35238bceSAndroid Build Coastguard Worker {get_buffer_parameteriv, "get_buffer_parameteriv", "Invalid glGetBufferParameteriv() usage"},
1581*35238bceSAndroid Build Coastguard Worker {get_buffer_parameteri64v, "get_buffer_parameteri64v", "Invalid glGetBufferParameteri64v() usage"},
1582*35238bceSAndroid Build Coastguard Worker {get_buffer_pointerv, "get_buffer_pointerv", "Invalid glGetBufferPointerv() usage"},
1583*35238bceSAndroid Build Coastguard Worker {get_framebuffer_attachment_parameteriv, "get_framebuffer_attachment_parameteriv",
1584*35238bceSAndroid Build Coastguard Worker "Invalid glGetFramebufferAttachmentParameteriv() usage"},
1585*35238bceSAndroid Build Coastguard Worker {get_renderbuffer_parameteriv, "get_renderbuffer_parameteriv", "Invalid glGetRenderbufferParameteriv() usage"},
1586*35238bceSAndroid Build Coastguard Worker {get_internalformativ, "get_internalformativ", "Invalid glGetInternalformativ() usage"},
1587*35238bceSAndroid Build Coastguard Worker {get_queryiv, "get_queryiv", "Invalid glGetQueryiv() usage"},
1588*35238bceSAndroid Build Coastguard Worker {get_query_objectuiv, "get_query_objectuiv", "Invalid glGetQueryObjectuiv() usage"},
1589*35238bceSAndroid Build Coastguard Worker {get_synciv, "get_synciv", "Invalid glGetSynciv() usage"},
1590*35238bceSAndroid Build Coastguard Worker {is_enabled, "is_enabled", "Invalid glIsEnabled() usage"},
1591*35238bceSAndroid Build Coastguard Worker {hint, "hint", "Invalid glHint() usage"},
1592*35238bceSAndroid Build Coastguard Worker {enablei, "enablei", "Invalid glEnablei() usage"},
1593*35238bceSAndroid Build Coastguard Worker {disablei, "disablei", "Invalid glDisablei() usage"},
1594*35238bceSAndroid Build Coastguard Worker {get_tex_parameteriiv, "get_tex_parameteriiv", "Invalid glGetTexParameterIiv() usage"},
1595*35238bceSAndroid Build Coastguard Worker {get_tex_parameteriuiv, "get_tex_parameteriuiv", "Invalid glGetTexParameterIuiv() usage"},
1596*35238bceSAndroid Build Coastguard Worker {get_nuniformfv, "get_nuniformfv", "Invalid glGetnUniformfv() usage"},
1597*35238bceSAndroid Build Coastguard Worker {get_nuniformiv, "get_nuniformiv", "Invalid glGetnUniformiv() usage"},
1598*35238bceSAndroid Build Coastguard Worker {get_nuniformuiv, "get_nuniformuiv", "Invalid glGetnUniformuiv() usage"},
1599*35238bceSAndroid Build Coastguard Worker {is_enabledi, "is_enabledi", "Invalid glIsEnabledi() usage"},
1600*35238bceSAndroid Build Coastguard Worker };
1601*35238bceSAndroid Build Coastguard Worker
1602*35238bceSAndroid Build Coastguard Worker return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
1603*35238bceSAndroid Build Coastguard Worker }
1604*35238bceSAndroid Build Coastguard Worker
1605*35238bceSAndroid Build Coastguard Worker } // namespace NegativeTestShared
1606*35238bceSAndroid Build Coastguard Worker } // namespace Functional
1607*35238bceSAndroid Build Coastguard Worker } // namespace gles31
1608*35238bceSAndroid Build Coastguard Worker } // namespace deqp
1609