1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program OpenGL ES 3.1 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 Buffer API tests.
22*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker
24*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeBufferApiTests.hpp"
25*35238bceSAndroid Build Coastguard Worker
26*35238bceSAndroid Build Coastguard Worker #include "gluCallLogWrapper.hpp"
27*35238bceSAndroid Build Coastguard Worker
28*35238bceSAndroid Build Coastguard Worker #include "glwDefs.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "glwEnums.hpp"
30*35238bceSAndroid Build Coastguard Worker
31*35238bceSAndroid Build Coastguard Worker namespace deqp
32*35238bceSAndroid Build Coastguard Worker {
33*35238bceSAndroid Build Coastguard Worker namespace gles31
34*35238bceSAndroid Build Coastguard Worker {
35*35238bceSAndroid Build Coastguard Worker namespace Functional
36*35238bceSAndroid Build Coastguard Worker {
37*35238bceSAndroid Build Coastguard Worker namespace NegativeTestShared
38*35238bceSAndroid Build Coastguard Worker {
39*35238bceSAndroid Build Coastguard Worker
40*35238bceSAndroid Build Coastguard Worker using glu::CallLogWrapper;
41*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
42*35238bceSAndroid Build Coastguard Worker using namespace glw;
43*35238bceSAndroid Build Coastguard Worker
44*35238bceSAndroid Build Coastguard Worker // Buffers
bind_buffer(NegativeTestContext & ctx)45*35238bceSAndroid Build Coastguard Worker void bind_buffer(NegativeTestContext &ctx)
46*35238bceSAndroid Build Coastguard Worker {
47*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the allowable values.");
48*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(-1, 0);
49*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
50*35238bceSAndroid Build Coastguard Worker ctx.endSection();
51*35238bceSAndroid Build Coastguard Worker }
52*35238bceSAndroid Build Coastguard Worker
delete_buffers(NegativeTestContext & ctx)53*35238bceSAndroid Build Coastguard Worker void delete_buffers(NegativeTestContext &ctx)
54*35238bceSAndroid Build Coastguard Worker {
55*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
56*35238bceSAndroid Build Coastguard Worker ctx.glDeleteBuffers(-1, 0);
57*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
58*35238bceSAndroid Build Coastguard Worker ctx.endSection();
59*35238bceSAndroid Build Coastguard Worker }
60*35238bceSAndroid Build Coastguard Worker
gen_buffers(NegativeTestContext & ctx)61*35238bceSAndroid Build Coastguard Worker void gen_buffers(NegativeTestContext &ctx)
62*35238bceSAndroid Build Coastguard Worker {
63*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
64*35238bceSAndroid Build Coastguard Worker ctx.glGenBuffers(-1, 0);
65*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
66*35238bceSAndroid Build Coastguard Worker ctx.endSection();
67*35238bceSAndroid Build Coastguard Worker }
68*35238bceSAndroid Build Coastguard Worker
buffer_data(NegativeTestContext & ctx)69*35238bceSAndroid Build Coastguard Worker void buffer_data(NegativeTestContext &ctx)
70*35238bceSAndroid Build Coastguard Worker {
71*35238bceSAndroid Build Coastguard Worker GLuint buffer = 0x1234;
72*35238bceSAndroid Build Coastguard Worker ctx.glGenBuffers(1, &buffer);
73*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ARRAY_BUFFER, buffer);
74*35238bceSAndroid Build Coastguard Worker
75*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER.");
76*35238bceSAndroid Build Coastguard Worker ctx.glBufferData(-1, 0, NULL, GL_STREAM_DRAW);
77*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
78*35238bceSAndroid Build Coastguard Worker ctx.endSection();
79*35238bceSAndroid Build Coastguard Worker
80*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
81*35238bceSAndroid Build Coastguard Worker "GL_INVALID_ENUM is generated if usage is not GL_STREAM_DRAW, GL_STATIC_DRAW, or GL_DYNAMIC_DRAW.");
82*35238bceSAndroid Build Coastguard Worker ctx.glBufferData(GL_ARRAY_BUFFER, 0, NULL, -1);
83*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
84*35238bceSAndroid Build Coastguard Worker ctx.endSection();
85*35238bceSAndroid Build Coastguard Worker
86*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if size is negative.");
87*35238bceSAndroid Build Coastguard Worker ctx.glBufferData(GL_ARRAY_BUFFER, -1, NULL, GL_STREAM_DRAW);
88*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
89*35238bceSAndroid Build Coastguard Worker ctx.endSection();
90*35238bceSAndroid Build Coastguard Worker
91*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target.");
92*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
93*35238bceSAndroid Build Coastguard Worker ctx.glBufferData(GL_ARRAY_BUFFER, 0, NULL, GL_STREAM_DRAW);
94*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
95*35238bceSAndroid Build Coastguard Worker ctx.endSection();
96*35238bceSAndroid Build Coastguard Worker
97*35238bceSAndroid Build Coastguard Worker ctx.glDeleteBuffers(1, &buffer);
98*35238bceSAndroid Build Coastguard Worker }
99*35238bceSAndroid Build Coastguard Worker
buffer_sub_data(NegativeTestContext & ctx)100*35238bceSAndroid Build Coastguard Worker void buffer_sub_data(NegativeTestContext &ctx)
101*35238bceSAndroid Build Coastguard Worker {
102*35238bceSAndroid Build Coastguard Worker GLuint buffer = 0x1234;
103*35238bceSAndroid Build Coastguard Worker ctx.glGenBuffers(1, &buffer);
104*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ARRAY_BUFFER, buffer);
105*35238bceSAndroid Build Coastguard Worker ctx.glBufferData(GL_ARRAY_BUFFER, 10, 0, GL_STREAM_DRAW);
106*35238bceSAndroid Build Coastguard Worker
107*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER.");
108*35238bceSAndroid Build Coastguard Worker ctx.glBufferSubData(-1, 1, 1, 0);
109*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
110*35238bceSAndroid Build Coastguard Worker ctx.endSection();
111*35238bceSAndroid Build Coastguard Worker
112*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target.");
113*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
114*35238bceSAndroid Build Coastguard Worker ctx.glBufferSubData(GL_ARRAY_BUFFER, 1, 1, 0);
115*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
116*35238bceSAndroid Build Coastguard Worker ctx.endSection();
117*35238bceSAndroid Build Coastguard Worker
118*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer object being updated is mapped.");
119*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ARRAY_BUFFER, buffer);
120*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, 0, 5, GL_MAP_READ_BIT);
121*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
122*35238bceSAndroid Build Coastguard Worker ctx.glBufferSubData(GL_ARRAY_BUFFER, 1, 1, 0);
123*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
124*35238bceSAndroid Build Coastguard Worker ctx.endSection();
125*35238bceSAndroid Build Coastguard Worker
126*35238bceSAndroid Build Coastguard Worker ctx.glDeleteBuffers(1, &buffer);
127*35238bceSAndroid Build Coastguard Worker }
128*35238bceSAndroid Build Coastguard Worker
buffer_sub_data_size_offset(NegativeTestContext & ctx)129*35238bceSAndroid Build Coastguard Worker void buffer_sub_data_size_offset(NegativeTestContext &ctx)
130*35238bceSAndroid Build Coastguard Worker {
131*35238bceSAndroid Build Coastguard Worker GLuint buffer = 0x1234;
132*35238bceSAndroid Build Coastguard Worker ctx.glGenBuffers(1, &buffer);
133*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ARRAY_BUFFER, buffer);
134*35238bceSAndroid Build Coastguard Worker ctx.glBufferData(GL_ARRAY_BUFFER, 10, 0, GL_STREAM_DRAW);
135*35238bceSAndroid Build Coastguard Worker
136*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if offset or size is negative, or if together they define a region "
137*35238bceSAndroid Build Coastguard Worker "of memory that extends beyond the buffer object's allocated data store.");
138*35238bceSAndroid Build Coastguard Worker ctx.glBufferSubData(GL_ARRAY_BUFFER, -1, 1, 0);
139*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
140*35238bceSAndroid Build Coastguard Worker ctx.glBufferSubData(GL_ARRAY_BUFFER, -1, -1, 0);
141*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
142*35238bceSAndroid Build Coastguard Worker ctx.glBufferSubData(GL_ARRAY_BUFFER, 1, -1, 0);
143*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
144*35238bceSAndroid Build Coastguard Worker ctx.glBufferSubData(GL_ARRAY_BUFFER, 15, 1, 0);
145*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
146*35238bceSAndroid Build Coastguard Worker ctx.glBufferSubData(GL_ARRAY_BUFFER, 1, 15, 0);
147*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
148*35238bceSAndroid Build Coastguard Worker ctx.glBufferSubData(GL_ARRAY_BUFFER, 8, 8, 0);
149*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
150*35238bceSAndroid Build Coastguard Worker ctx.endSection();
151*35238bceSAndroid Build Coastguard Worker
152*35238bceSAndroid Build Coastguard Worker ctx.glDeleteBuffers(1, &buffer);
153*35238bceSAndroid Build Coastguard Worker }
154*35238bceSAndroid Build Coastguard Worker
clear(NegativeTestContext & ctx)155*35238bceSAndroid Build Coastguard Worker void clear(NegativeTestContext &ctx)
156*35238bceSAndroid Build Coastguard Worker {
157*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if any bit other than the three defined bits is set in mask.");
158*35238bceSAndroid Build Coastguard Worker ctx.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
159*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
160*35238bceSAndroid Build Coastguard Worker ctx.glClear(0x00000200);
161*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
162*35238bceSAndroid Build Coastguard Worker ctx.glClear(0x00001000);
163*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
164*35238bceSAndroid Build Coastguard Worker ctx.glClear(0x00000010);
165*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
166*35238bceSAndroid Build Coastguard Worker ctx.endSection();
167*35238bceSAndroid Build Coastguard Worker }
168*35238bceSAndroid Build Coastguard Worker
read_pixels(NegativeTestContext & ctx)169*35238bceSAndroid Build Coastguard Worker void read_pixels(NegativeTestContext &ctx)
170*35238bceSAndroid Build Coastguard Worker {
171*35238bceSAndroid Build Coastguard Worker std::vector<GLubyte> ubyteData(4);
172*35238bceSAndroid Build Coastguard Worker GLuint fbo = 0x1234;
173*35238bceSAndroid Build Coastguard Worker
174*35238bceSAndroid Build Coastguard Worker ctx.beginSection("Unsupported combinations of format and type will generate an GL_INVALID_OPERATION error.");
175*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, 1, 1, GL_LUMINANCE_ALPHA, GL_UNSIGNED_SHORT_4_4_4_4, &ubyteData[0]);
176*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
177*35238bceSAndroid Build Coastguard Worker ctx.endSection();
178*35238bceSAndroid Build Coastguard Worker
179*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if either width or height is negative.");
180*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, -1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &ubyteData[0]);
181*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
182*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, 1, -1, GL_RGBA, GL_UNSIGNED_BYTE, &ubyteData[0]);
183*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
184*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, -1, -1, GL_RGBA, GL_UNSIGNED_BYTE, &ubyteData[0]);
185*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
186*35238bceSAndroid Build Coastguard Worker ctx.endSection();
187*35238bceSAndroid Build Coastguard Worker
188*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not "
189*35238bceSAndroid Build Coastguard Worker "framebuffer complete.");
190*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(1, &fbo);
191*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
192*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
193*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &ubyteData[0]);
194*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
195*35238bceSAndroid Build Coastguard Worker ctx.endSection();
196*35238bceSAndroid Build Coastguard Worker
197*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(1, &fbo);
198*35238bceSAndroid Build Coastguard Worker }
199*35238bceSAndroid Build Coastguard Worker
readn_pixels(NegativeTestContext & ctx)200*35238bceSAndroid Build Coastguard Worker void readn_pixels(NegativeTestContext &ctx)
201*35238bceSAndroid Build Coastguard Worker {
202*35238bceSAndroid Build Coastguard Worker std::vector<GLfloat> floatData(4);
203*35238bceSAndroid Build Coastguard Worker std::vector<GLubyte> ubyteData(4);
204*35238bceSAndroid Build Coastguard Worker GLuint fbo = 0x1234;
205*35238bceSAndroid Build Coastguard Worker
206*35238bceSAndroid Build Coastguard Worker if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) &&
207*35238bceSAndroid Build Coastguard Worker !contextSupports(ctx.getRenderContext().getType(), glu::ApiType::core(4, 5)) &&
208*35238bceSAndroid Build Coastguard Worker !ctx.isExtensionSupported("GL_KHR_robustness") && !ctx.isExtensionSupported("GL_EXT_robustness"))
209*35238bceSAndroid Build Coastguard Worker {
210*35238bceSAndroid Build Coastguard Worker TCU_THROW(NotSupportedError, "GLES 3.2 or robustness extension not supported");
211*35238bceSAndroid Build Coastguard Worker }
212*35238bceSAndroid Build Coastguard Worker
213*35238bceSAndroid Build Coastguard Worker ctx.beginSection("Unsupported combinations of format and type will generate an GL_INVALID_OPERATION error.");
214*35238bceSAndroid Build Coastguard Worker ctx.glReadnPixels(0, 0, 1, 1, GL_LUMINANCE_ALPHA, GL_UNSIGNED_SHORT_4_4_4_4, (int)ubyteData.size(), &ubyteData[0]);
215*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
216*35238bceSAndroid Build Coastguard Worker ctx.endSection();
217*35238bceSAndroid Build Coastguard Worker
218*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if either width or height is negative.");
219*35238bceSAndroid Build Coastguard Worker ctx.glReadnPixels(0, 0, -1, 1, GL_RGBA, GL_UNSIGNED_BYTE, (int)ubyteData.size(), &ubyteData[0]);
220*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
221*35238bceSAndroid Build Coastguard Worker ctx.glReadnPixels(0, 0, 1, -1, GL_RGBA, GL_UNSIGNED_BYTE, (int)ubyteData.size(), &ubyteData[0]);
222*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
223*35238bceSAndroid Build Coastguard Worker ctx.glReadnPixels(0, 0, -1, -1, GL_RGBA, GL_UNSIGNED_BYTE, (int)ubyteData.size(), &ubyteData[0]);
224*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
225*35238bceSAndroid Build Coastguard Worker ctx.endSection();
226*35238bceSAndroid Build Coastguard Worker
227*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated by ReadnPixels if the buffer size required to store the "
228*35238bceSAndroid Build Coastguard Worker "requested data is larger than bufSize.");
229*35238bceSAndroid Build Coastguard Worker ctx.glReadnPixels(0, 0, 0x1234, 0x1234, GL_RGBA, GL_UNSIGNED_BYTE, (int)ubyteData.size(), &ubyteData[0]);
230*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
231*35238bceSAndroid Build Coastguard Worker ctx.glReadnPixels(0, 0, 1, 1, GL_RGBA, GL_FLOAT, (int)floatData.size(), &floatData[0]);
232*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
233*35238bceSAndroid Build Coastguard Worker ctx.endSection();
234*35238bceSAndroid Build Coastguard Worker
235*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not "
236*35238bceSAndroid Build Coastguard Worker "framebuffer complete.");
237*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(1, &fbo);
238*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
239*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
240*35238bceSAndroid Build Coastguard Worker ctx.glReadnPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, (int)ubyteData.size(), &ubyteData[0]);
241*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
242*35238bceSAndroid Build Coastguard Worker ctx.endSection();
243*35238bceSAndroid Build Coastguard Worker
244*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(1, &fbo);
245*35238bceSAndroid Build Coastguard Worker }
246*35238bceSAndroid Build Coastguard Worker
read_pixels_format_mismatch(NegativeTestContext & ctx)247*35238bceSAndroid Build Coastguard Worker void read_pixels_format_mismatch(NegativeTestContext &ctx)
248*35238bceSAndroid Build Coastguard Worker {
249*35238bceSAndroid Build Coastguard Worker std::vector<GLubyte> ubyteData(4);
250*35238bceSAndroid Build Coastguard Worker std::vector<GLushort> ushortData(4);
251*35238bceSAndroid Build Coastguard Worker GLint readFormat = 0x1234;
252*35238bceSAndroid Build Coastguard Worker GLint readType = 0x1234;
253*35238bceSAndroid Build Coastguard Worker
254*35238bceSAndroid Build Coastguard Worker ctx.beginSection("Unsupported combinations of format and type will generate an GL_INVALID_OPERATION error.");
255*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, 1, 1, GL_ALPHA, GL_UNSIGNED_SHORT_5_6_5, &ushortData[0]);
256*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
257*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, 1, 1, GL_ALPHA, GL_UNSIGNED_SHORT_4_4_4_4, &ushortData[0]);
258*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
259*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, 1, 1, GL_ALPHA, GL_UNSIGNED_SHORT_5_5_5_1, &ushortData[0]);
260*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
261*35238bceSAndroid Build Coastguard Worker ctx.endSection();
262*35238bceSAndroid Build Coastguard Worker
263*35238bceSAndroid Build Coastguard Worker ctx.beginSection("Unsupported combinations of format and type will generate an GL_INVALID_OPERATION error.");
264*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_SHORT_5_6_5, &ushortData[0]);
265*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
266*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, 1, 1, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, &ushortData[0]);
267*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
268*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, 1, 1, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, &ushortData[0]);
269*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
270*35238bceSAndroid Build Coastguard Worker ctx.endSection();
271*35238bceSAndroid Build Coastguard Worker
272*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_RGBA/GL_UNSIGNED_BYTE is always accepted and the other acceptable pair can be discovered by "
273*35238bceSAndroid Build Coastguard Worker "querying GL_IMPLEMENTATION_COLOR_READ_FORMAT and GL_IMPLEMENTATION_COLOR_READ_TYPE.");
274*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &ubyteData[0]);
275*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
276*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &readFormat);
277*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &readType);
278*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, 1, 1, readFormat, readType, &ubyteData[0]);
279*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
280*35238bceSAndroid Build Coastguard Worker ctx.endSection();
281*35238bceSAndroid Build Coastguard Worker }
282*35238bceSAndroid Build Coastguard Worker
read_pixels_fbo_format_mismatch(NegativeTestContext & ctx)283*35238bceSAndroid Build Coastguard Worker void read_pixels_fbo_format_mismatch(NegativeTestContext &ctx)
284*35238bceSAndroid Build Coastguard Worker {
285*35238bceSAndroid Build Coastguard Worker std::vector<GLubyte> ubyteData(4);
286*35238bceSAndroid Build Coastguard Worker std::vector<float> floatData(4);
287*35238bceSAndroid Build Coastguard Worker uint32_t fbo = 0x1234;
288*35238bceSAndroid Build Coastguard Worker uint32_t texture = 0x1234;
289*35238bceSAndroid Build Coastguard Worker bool isES = glu::isContextTypeES(ctx.getRenderContext().getType());
290*35238bceSAndroid Build Coastguard Worker
291*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &texture);
292*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, texture);
293*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
294*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(1, &fbo);
295*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
296*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
297*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
298*35238bceSAndroid Build Coastguard Worker
299*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if currently bound framebuffer format is incompatible with "
300*35238bceSAndroid Build Coastguard Worker "format and type.");
301*35238bceSAndroid Build Coastguard Worker
302*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
303*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
304*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
305*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
306*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, 1, 1, GL_RGBA, GL_FLOAT, &floatData[0]);
307*35238bceSAndroid Build Coastguard Worker ctx.expectError(isES ? GL_INVALID_OPERATION : GL_NO_ERROR);
308*35238bceSAndroid Build Coastguard Worker
309*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32I, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, NULL);
310*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
311*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
312*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
313*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, 1, 1, GL_RGBA, GL_FLOAT, &floatData[0]);
314*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
315*35238bceSAndroid Build Coastguard Worker
316*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32UI, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, NULL);
317*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
318*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
319*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
320*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, 1, 1, GL_RGBA, GL_FLOAT, &floatData[0]);
321*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
322*35238bceSAndroid Build Coastguard Worker
323*35238bceSAndroid Build Coastguard Worker if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) ||
324*35238bceSAndroid Build Coastguard Worker ctx.isExtensionSupported("GL_EXT_color_buffer_float"))
325*35238bceSAndroid Build Coastguard Worker {
326*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 32, 32, 0, GL_RGBA, GL_FLOAT, NULL);
327*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
328*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
329*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
330*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
331*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, 1, 1, GL_RGBA, GL_INT, &floatData[0]);
332*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
333*35238bceSAndroid Build Coastguard Worker }
334*35238bceSAndroid Build Coastguard Worker
335*35238bceSAndroid Build Coastguard Worker ctx.endSection();
336*35238bceSAndroid Build Coastguard Worker
337*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
338*35238bceSAndroid Build Coastguard Worker "GL_INVALID_OPERATION is generated if GL_READ_FRAMEBUFFER_BINDING is non-zero, the read framebuffer is "
339*35238bceSAndroid Build Coastguard Worker "complete, and the value of GL_SAMPLE_BUFFERS for the read framebuffer is greater than zero.");
340*35238bceSAndroid Build Coastguard Worker
341*35238bceSAndroid Build Coastguard Worker int binding = -1;
342*35238bceSAndroid Build Coastguard Worker int sampleBuffers = 0x1234;
343*35238bceSAndroid Build Coastguard Worker uint32_t rbo = 0x1234;
344*35238bceSAndroid Build Coastguard Worker
345*35238bceSAndroid Build Coastguard Worker ctx.glGenRenderbuffers(1, &rbo);
346*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo);
347*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, 32, 32);
348*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo);
349*35238bceSAndroid Build Coastguard Worker
350*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &binding);
351*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// GL_READ_FRAMEBUFFER_BINDING: " << binding << TestLog::EndMessage;
352*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
353*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_SAMPLE_BUFFERS, &sampleBuffers);
354*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// GL_SAMPLE_BUFFERS: " << sampleBuffers << TestLog::EndMessage;
355*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
356*35238bceSAndroid Build Coastguard Worker
357*35238bceSAndroid Build Coastguard Worker if (binding == 0 || sampleBuffers <= 0)
358*35238bceSAndroid Build Coastguard Worker {
359*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message
360*35238bceSAndroid Build Coastguard Worker << "// ERROR: expected GL_READ_FRAMEBUFFER_BINDING to be non-zero and GL_SAMPLE_BUFFERS to be "
361*35238bceSAndroid Build Coastguard Worker "greater than zero"
362*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
363*35238bceSAndroid Build Coastguard Worker ctx.fail("Got invalid value");
364*35238bceSAndroid Build Coastguard Worker }
365*35238bceSAndroid Build Coastguard Worker else
366*35238bceSAndroid Build Coastguard Worker {
367*35238bceSAndroid Build Coastguard Worker ctx.glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &ubyteData[0]);
368*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
369*35238bceSAndroid Build Coastguard Worker }
370*35238bceSAndroid Build Coastguard Worker
371*35238bceSAndroid Build Coastguard Worker ctx.endSection();
372*35238bceSAndroid Build Coastguard Worker
373*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, 0);
374*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, 0);
375*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
376*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(1, &fbo);
377*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(1, &texture);
378*35238bceSAndroid Build Coastguard Worker ctx.glDeleteRenderbuffers(1, &rbo);
379*35238bceSAndroid Build Coastguard Worker }
380*35238bceSAndroid Build Coastguard Worker
bind_buffer_range(NegativeTestContext & ctx)381*35238bceSAndroid Build Coastguard Worker void bind_buffer_range(NegativeTestContext &ctx)
382*35238bceSAndroid Build Coastguard Worker {
383*35238bceSAndroid Build Coastguard Worker uint32_t bufAC = 0x1234;
384*35238bceSAndroid Build Coastguard Worker uint32_t bufU = 0x1234;
385*35238bceSAndroid Build Coastguard Worker uint32_t bufTF = 0x1234;
386*35238bceSAndroid Build Coastguard Worker int maxTFSize = 0x1234;
387*35238bceSAndroid Build Coastguard Worker int maxUSize = 0x1234;
388*35238bceSAndroid Build Coastguard Worker int uAlignment = 0x1234;
389*35238bceSAndroid Build Coastguard Worker
390*35238bceSAndroid Build Coastguard Worker ctx.glGenBuffers(1, &bufU);
391*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_UNIFORM_BUFFER, bufU);
392*35238bceSAndroid Build Coastguard Worker ctx.glBufferData(GL_UNIFORM_BUFFER, 16, NULL, GL_STREAM_DRAW);
393*35238bceSAndroid Build Coastguard Worker
394*35238bceSAndroid Build Coastguard Worker ctx.glGenBuffers(1, &bufTF);
395*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, bufTF);
396*35238bceSAndroid Build Coastguard Worker ctx.glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 16, NULL, GL_STREAM_DRAW);
397*35238bceSAndroid Build Coastguard Worker
398*35238bceSAndroid Build Coastguard Worker ctx.glGenBuffers(1, &bufAC);
399*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, bufAC);
400*35238bceSAndroid Build Coastguard Worker ctx.glBufferData(GL_ATOMIC_COUNTER_BUFFER, 16, NULL, GL_STREAM_DRAW);
401*35238bceSAndroid Build Coastguard Worker
402*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_ATOMIC_COUNTER_BUFFER, "
403*35238bceSAndroid Build Coastguard Worker "GL_SHADER_STORAGE_BUFFER, GL_TRANSFORM_FEEDBACK_BUFFER or GL_UNIFORM_BUFFER.");
404*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferRange(GL_ARRAY_BUFFER, 0, bufU, 0, 4);
405*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
406*35238bceSAndroid Build Coastguard Worker ctx.endSection();
407*35238bceSAndroid Build Coastguard Worker
408*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_TRANSFORM_FEEDBACK_BUFFER and index is greater "
409*35238bceSAndroid Build Coastguard Worker "than or equal to GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS.");
410*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &maxTFSize);
411*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, maxTFSize, bufTF, 0, 4);
412*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
413*35238bceSAndroid Build Coastguard Worker ctx.endSection();
414*35238bceSAndroid Build Coastguard Worker
415*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_UNIFORM_BUFFER and index is greater than or equal "
416*35238bceSAndroid Build Coastguard Worker "to GL_MAX_UNIFORM_BUFFER_BINDINGS.");
417*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUSize);
418*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferRange(GL_UNIFORM_BUFFER, maxUSize, bufU, 0, 4);
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_VALUE is generated if size is less than or equal to zero.");
423*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferRange(GL_UNIFORM_BUFFER, 0, bufU, 0, -1);
424*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
425*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferRange(GL_UNIFORM_BUFFER, 0, bufU, 0, 0);
426*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
427*35238bceSAndroid Build Coastguard Worker ctx.endSection();
428*35238bceSAndroid Build Coastguard Worker
429*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if offset is less than zero.");
430*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferRange(GL_UNIFORM_BUFFER, 0, bufU, -1, 0);
431*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
432*35238bceSAndroid Build Coastguard Worker ctx.endSection();
433*35238bceSAndroid Build Coastguard Worker
434*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_TRANSFORM_FEEDBACK_BUFFER and size or offset are "
435*35238bceSAndroid Build Coastguard Worker "not multiples of 4.");
436*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, bufTF, 4, 5);
437*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
438*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, bufTF, 5, 4);
439*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
440*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, bufTF, 5, 7);
441*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
442*35238bceSAndroid Build Coastguard Worker ctx.endSection();
443*35238bceSAndroid Build Coastguard Worker
444*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_UNIFORM_BUFFER and offset is not a multiple of "
445*35238bceSAndroid Build Coastguard Worker "GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT.");
446*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &uAlignment);
447*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferRange(GL_UNIFORM_BUFFER, 0, bufU, uAlignment + 1, 4);
448*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
449*35238bceSAndroid Build Coastguard Worker ctx.endSection();
450*35238bceSAndroid Build Coastguard Worker
451*35238bceSAndroid Build Coastguard Worker int maxACize = 0x1234;
452*35238bceSAndroid Build Coastguard Worker int maxSSize = 0x1234;
453*35238bceSAndroid Build Coastguard Worker int ssAlignment = 0x1234;
454*35238bceSAndroid Build Coastguard Worker
455*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_ATOMIC_COUNTER_BUFFER and index is greater than or "
456*35238bceSAndroid Build Coastguard Worker "equal to GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS.");
457*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS, &maxACize);
458*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferRange(GL_ATOMIC_COUNTER_BUFFER, maxACize, bufU, 0, 4);
459*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
460*35238bceSAndroid Build Coastguard Worker ctx.endSection();
461*35238bceSAndroid Build Coastguard Worker
462*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_SHADER_STORAGE_BUFFER and index is greater than or "
463*35238bceSAndroid Build Coastguard Worker "equal to GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS.");
464*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, &maxSSize);
465*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferRange(GL_SHADER_STORAGE_BUFFER, maxSSize, bufU, 0, 4);
466*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
467*35238bceSAndroid Build Coastguard Worker ctx.endSection();
468*35238bceSAndroid Build Coastguard Worker
469*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
470*35238bceSAndroid Build Coastguard Worker "GL_INVALID_VALUE is generated if target is GL_ATOMIC_COUNTER_BUFFER and offset is not multiples of 4.");
471*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferRange(GL_ATOMIC_COUNTER_BUFFER, 0, bufTF, 5, 4);
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.glGetIntegerv(GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT, &ssAlignment);
476*35238bceSAndroid Build Coastguard Worker
477*35238bceSAndroid Build Coastguard Worker if (ssAlignment != 1)
478*35238bceSAndroid Build Coastguard Worker {
479*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_SHADER_STORAGE_BUFFER and offset is not a "
480*35238bceSAndroid Build Coastguard Worker "multiple of the value of GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT.");
481*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferRange(GL_SHADER_STORAGE_BUFFER, 0, bufTF, ssAlignment + 1, 4);
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
486*35238bceSAndroid Build Coastguard Worker ctx.glDeleteBuffers(1, &bufU);
487*35238bceSAndroid Build Coastguard Worker ctx.glDeleteBuffers(1, &bufTF);
488*35238bceSAndroid Build Coastguard Worker ctx.glDeleteBuffers(1, &bufAC);
489*35238bceSAndroid Build Coastguard Worker }
490*35238bceSAndroid Build Coastguard Worker
bind_buffer_base(NegativeTestContext & ctx)491*35238bceSAndroid Build Coastguard Worker void bind_buffer_base(NegativeTestContext &ctx)
492*35238bceSAndroid Build Coastguard Worker {
493*35238bceSAndroid Build Coastguard Worker uint32_t bufU = 0x1234;
494*35238bceSAndroid Build Coastguard Worker uint32_t bufTF = 0x1234;
495*35238bceSAndroid Build Coastguard Worker int maxUSize = 0x1234;
496*35238bceSAndroid Build Coastguard Worker int maxTFSize = 0x1234;
497*35238bceSAndroid Build Coastguard Worker
498*35238bceSAndroid Build Coastguard Worker ctx.glGenBuffers(1, &bufU);
499*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_UNIFORM_BUFFER, bufU);
500*35238bceSAndroid Build Coastguard Worker ctx.glBufferData(GL_UNIFORM_BUFFER, 16, NULL, GL_STREAM_DRAW);
501*35238bceSAndroid Build Coastguard Worker
502*35238bceSAndroid Build Coastguard Worker ctx.glGenBuffers(1, &bufTF);
503*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, bufTF);
504*35238bceSAndroid Build Coastguard Worker ctx.glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 16, NULL, GL_STREAM_DRAW);
505*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
506*35238bceSAndroid Build Coastguard Worker
507*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_ATOMIC_COUNTER_BUFFER, "
508*35238bceSAndroid Build Coastguard Worker "GL_SHADER_STORAGE_BUFFER, GL_TRANSFORM_FEEDBACK_BUFFER or GL_UNIFORM_BUFFER.");
509*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferBase(-1, 0, bufU);
510*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
511*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferBase(GL_ARRAY_BUFFER, 0, bufU);
512*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
513*35238bceSAndroid Build Coastguard Worker ctx.endSection();
514*35238bceSAndroid Build Coastguard Worker
515*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_UNIFORM_BUFFER and index is greater than or equal "
516*35238bceSAndroid Build Coastguard Worker "to GL_MAX_UNIFORM_BUFFER_BINDINGS.");
517*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUSize);
518*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferBase(GL_UNIFORM_BUFFER, maxUSize, bufU);
519*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
520*35238bceSAndroid Build Coastguard Worker ctx.endSection();
521*35238bceSAndroid Build Coastguard Worker
522*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_TRANSFORM_FEEDBACK_BUFFER andindex is greater than "
523*35238bceSAndroid Build Coastguard Worker "or equal to GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS.");
524*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &maxTFSize);
525*35238bceSAndroid Build Coastguard Worker ctx.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, maxTFSize, bufTF);
526*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
527*35238bceSAndroid Build Coastguard Worker ctx.endSection();
528*35238bceSAndroid Build Coastguard Worker
529*35238bceSAndroid Build Coastguard Worker ctx.glDeleteBuffers(1, &bufU);
530*35238bceSAndroid Build Coastguard Worker ctx.glDeleteBuffers(1, &bufTF);
531*35238bceSAndroid Build Coastguard Worker }
532*35238bceSAndroid Build Coastguard Worker
clear_bufferiv(NegativeTestContext & ctx)533*35238bceSAndroid Build Coastguard Worker void clear_bufferiv(NegativeTestContext &ctx)
534*35238bceSAndroid Build Coastguard Worker {
535*35238bceSAndroid Build Coastguard Worker std::vector<int> data(32 * 32);
536*35238bceSAndroid Build Coastguard Worker uint32_t fbo = 0x1234;
537*35238bceSAndroid Build Coastguard Worker uint32_t texture = 0x1234;
538*35238bceSAndroid Build Coastguard Worker int maxDrawBuffers = 0x1234;
539*35238bceSAndroid Build Coastguard Worker
540*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &texture);
541*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, texture);
542*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32I, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, NULL);
543*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(1, &fbo);
544*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
545*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
546*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
547*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
548*35238bceSAndroid Build Coastguard Worker
549*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if buffer is not an accepted value.");
550*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferiv(-1, 0, &data[0]);
551*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
552*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferiv(GL_FRAMEBUFFER, 0, &data[0]);
553*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
554*35238bceSAndroid Build Coastguard Worker ctx.endSection();
555*35238bceSAndroid Build Coastguard Worker
556*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if buffer is GL_DEPTH or GL_DEPTH_STENCIL.");
557*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferiv(GL_DEPTH, 1, &data[0]);
558*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
559*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferiv(GL_DEPTH_STENCIL, 1, &data[0]);
560*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
561*35238bceSAndroid Build Coastguard Worker ctx.endSection();
562*35238bceSAndroid Build Coastguard Worker
563*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_COLOR or GL_STENCIL and drawBuffer is greater than "
564*35238bceSAndroid Build Coastguard Worker "or equal to GL_MAX_DRAW_BUFFERS.");
565*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
566*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferiv(GL_COLOR, maxDrawBuffers, &data[0]);
567*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
568*35238bceSAndroid Build Coastguard Worker ctx.endSection();
569*35238bceSAndroid Build Coastguard Worker
570*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_COLOR or GL_STENCIL and drawBuffer is negative.");
571*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferiv(GL_COLOR, -1, &data[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_VALUE is generated if buffer is GL_STENCIL and drawBuffer is not zero.");
576*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferiv(GL_STENCIL, 1, &data[0]);
577*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
578*35238bceSAndroid Build Coastguard Worker ctx.endSection();
579*35238bceSAndroid Build Coastguard Worker
580*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(1, &fbo);
581*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(1, &texture);
582*35238bceSAndroid Build Coastguard Worker }
583*35238bceSAndroid Build Coastguard Worker
clear_bufferuiv(NegativeTestContext & ctx)584*35238bceSAndroid Build Coastguard Worker void clear_bufferuiv(NegativeTestContext &ctx)
585*35238bceSAndroid Build Coastguard Worker {
586*35238bceSAndroid Build Coastguard Worker std::vector<uint32_t> data(32 * 32);
587*35238bceSAndroid Build Coastguard Worker uint32_t fbo = 0x1234;
588*35238bceSAndroid Build Coastguard Worker uint32_t texture = 0x1234;
589*35238bceSAndroid Build Coastguard Worker int maxDrawBuffers = 0x1234;
590*35238bceSAndroid Build Coastguard Worker
591*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &texture);
592*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, texture);
593*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32UI, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, NULL);
594*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(1, &fbo);
595*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
596*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
597*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
598*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
599*35238bceSAndroid Build Coastguard Worker
600*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if buffer is not GL_COLOR.");
601*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferuiv(-1, 0, &data[0]);
602*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
603*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferuiv(GL_FRAMEBUFFER, 0, &data[0]);
604*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
605*35238bceSAndroid Build Coastguard Worker ctx.endSection();
606*35238bceSAndroid Build Coastguard Worker
607*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if buffer is GL_DEPTH, GL_STENCIL, or GL_DEPTH_STENCIL.");
608*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferuiv(GL_DEPTH, 0, &data[0]);
609*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
610*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferuiv(GL_STENCIL, 0, &data[0]);
611*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
612*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferuiv(GL_DEPTH_STENCIL, 0, &data[0]);
613*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
614*35238bceSAndroid Build Coastguard Worker ctx.endSection();
615*35238bceSAndroid Build Coastguard Worker
616*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_COLOR and drawBuffer is greater than or equal to "
617*35238bceSAndroid Build Coastguard Worker "GL_MAX_DRAW_BUFFERS.");
618*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
619*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferuiv(GL_COLOR, maxDrawBuffers, &data[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_VALUE is generated if buffer is GL_COLOR and drawBuffer is negative.");
624*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferuiv(GL_COLOR, -1, &data[0]);
625*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
626*35238bceSAndroid Build Coastguard Worker ctx.endSection();
627*35238bceSAndroid Build Coastguard Worker
628*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(1, &fbo);
629*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(1, &texture);
630*35238bceSAndroid Build Coastguard Worker }
631*35238bceSAndroid Build Coastguard Worker
clear_bufferfv(NegativeTestContext & ctx)632*35238bceSAndroid Build Coastguard Worker void clear_bufferfv(NegativeTestContext &ctx)
633*35238bceSAndroid Build Coastguard Worker {
634*35238bceSAndroid Build Coastguard Worker std::vector<float> data(32 * 32);
635*35238bceSAndroid Build Coastguard Worker uint32_t fbo = 0x1234;
636*35238bceSAndroid Build Coastguard Worker uint32_t texture = 0x1234;
637*35238bceSAndroid Build Coastguard Worker int maxDrawBuffers = 0x1234;
638*35238bceSAndroid Build Coastguard Worker
639*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &texture);
640*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, texture);
641*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 32, 32, 0, GL_RGBA, GL_FLOAT, NULL);
642*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(1, &fbo);
643*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
644*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
645*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
646*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
647*35238bceSAndroid Build Coastguard Worker
648*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if buffer is not GL_COLOR or GL_DEPTH.");
649*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferfv(-1, 0, &data[0]);
650*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
651*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferfv(GL_FRAMEBUFFER, 0, &data[0]);
652*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
653*35238bceSAndroid Build Coastguard Worker ctx.endSection();
654*35238bceSAndroid Build Coastguard Worker
655*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if buffer is GL_STENCIL or GL_DEPTH_STENCIL.");
656*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferfv(GL_STENCIL, 1, &data[0]);
657*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
658*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferfv(GL_DEPTH_STENCIL, 1, &data[0]);
659*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
660*35238bceSAndroid Build Coastguard Worker ctx.endSection();
661*35238bceSAndroid Build Coastguard Worker
662*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_COLOR and drawBuffer is greater than or equal to "
663*35238bceSAndroid Build Coastguard Worker "GL_MAX_DRAW_BUFFERS.");
664*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
665*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferfv(GL_COLOR, maxDrawBuffers, &data[0]);
666*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
667*35238bceSAndroid Build Coastguard Worker ctx.endSection();
668*35238bceSAndroid Build Coastguard Worker
669*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_COLOR and drawBuffer is negative.");
670*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferfv(GL_COLOR, -1, &data[0]);
671*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
672*35238bceSAndroid Build Coastguard Worker ctx.endSection();
673*35238bceSAndroid Build Coastguard Worker
674*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_DEPTH and drawBuffer is not zero.");
675*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferfv(GL_DEPTH, 1, &data[0]);
676*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
677*35238bceSAndroid Build Coastguard Worker ctx.endSection();
678*35238bceSAndroid Build Coastguard Worker
679*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(1, &fbo);
680*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(1, &texture);
681*35238bceSAndroid Build Coastguard Worker }
682*35238bceSAndroid Build Coastguard Worker
clear_bufferfi(NegativeTestContext & ctx)683*35238bceSAndroid Build Coastguard Worker void clear_bufferfi(NegativeTestContext &ctx)
684*35238bceSAndroid Build Coastguard Worker {
685*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if buffer is not GL_DEPTH_STENCIL.");
686*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferfi(-1, 0, 1.0f, 1);
687*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
688*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferfi(GL_FRAMEBUFFER, 0, 1.0f, 1);
689*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
690*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferfi(GL_DEPTH, 0, 1.0f, 1);
691*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
692*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferfi(GL_STENCIL, 0, 1.0f, 1);
693*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
694*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferfi(GL_COLOR, 0, 1.0f, 1);
695*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
696*35238bceSAndroid Build Coastguard Worker ctx.endSection();
697*35238bceSAndroid Build Coastguard Worker
698*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if buffer is GL_DEPTH_STENCIL and drawBuffer is not zero.");
699*35238bceSAndroid Build Coastguard Worker ctx.glClearBufferfi(GL_DEPTH_STENCIL, 1, 1.0f, 1);
700*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
701*35238bceSAndroid Build Coastguard Worker ctx.endSection();
702*35238bceSAndroid Build Coastguard Worker }
703*35238bceSAndroid Build Coastguard Worker
copy_buffer_sub_data(NegativeTestContext & ctx)704*35238bceSAndroid Build Coastguard Worker void copy_buffer_sub_data(NegativeTestContext &ctx)
705*35238bceSAndroid Build Coastguard Worker {
706*35238bceSAndroid Build Coastguard Worker uint32_t buf[2];
707*35238bceSAndroid Build Coastguard Worker std::vector<float> data(32 * 32);
708*35238bceSAndroid Build Coastguard Worker
709*35238bceSAndroid Build Coastguard Worker ctx.glGenBuffers(2, buf);
710*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_COPY_READ_BUFFER, buf[0]);
711*35238bceSAndroid Build Coastguard Worker ctx.glBufferData(GL_COPY_READ_BUFFER, 32, &data[0], GL_DYNAMIC_COPY);
712*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_COPY_WRITE_BUFFER, buf[1]);
713*35238bceSAndroid Build Coastguard Worker ctx.glBufferData(GL_COPY_WRITE_BUFFER, 32, &data[0], GL_DYNAMIC_COPY);
714*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
715*35238bceSAndroid Build Coastguard Worker
716*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if any of readoffset, writeoffset or size is negative.");
717*35238bceSAndroid Build Coastguard Worker ctx.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, -4);
718*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
719*35238bceSAndroid Build Coastguard Worker ctx.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, -1, 0, 4);
720*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
721*35238bceSAndroid Build Coastguard Worker ctx.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, -1, 4);
722*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
723*35238bceSAndroid Build Coastguard Worker ctx.endSection();
724*35238bceSAndroid Build Coastguard Worker
725*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if readoffset + size exceeds the size of the buffer object bound "
726*35238bceSAndroid Build Coastguard Worker "to readtarget.");
727*35238bceSAndroid Build Coastguard Worker ctx.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 36);
728*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
729*35238bceSAndroid Build Coastguard Worker ctx.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 24, 0, 16);
730*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
731*35238bceSAndroid Build Coastguard Worker ctx.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 36, 0, 4);
732*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
733*35238bceSAndroid Build Coastguard Worker ctx.endSection();
734*35238bceSAndroid Build Coastguard Worker
735*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if writeoffset + size exceeds the size of the buffer object bound "
736*35238bceSAndroid Build Coastguard Worker "to writetarget.");
737*35238bceSAndroid Build Coastguard Worker ctx.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 36);
738*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
739*35238bceSAndroid Build Coastguard Worker ctx.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 24, 16);
740*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
741*35238bceSAndroid Build Coastguard Worker ctx.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 36, 4);
742*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
743*35238bceSAndroid Build Coastguard Worker ctx.endSection();
744*35238bceSAndroid Build Coastguard Worker
745*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
746*35238bceSAndroid Build Coastguard Worker "GL_INVALID_VALUE is generated if the same buffer object is bound to both readtarget and writetarget and the "
747*35238bceSAndroid Build Coastguard Worker "ranges [readoffset, readoffset + size) and [writeoffset, writeoffset + size) overlap.");
748*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_COPY_WRITE_BUFFER, buf[0]);
749*35238bceSAndroid Build Coastguard Worker ctx.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 16, 4);
750*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
751*35238bceSAndroid Build Coastguard Worker ctx.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 4);
752*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
753*35238bceSAndroid Build Coastguard Worker ctx.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 16, 18);
754*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
755*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_COPY_WRITE_BUFFER, buf[1]);
756*35238bceSAndroid Build Coastguard Worker ctx.endSection();
757*35238bceSAndroid Build Coastguard Worker
758*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if zero is bound to readtarget or writetarget.");
759*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_COPY_READ_BUFFER, 0);
760*35238bceSAndroid Build Coastguard Worker ctx.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 16);
761*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
762*35238bceSAndroid Build Coastguard Worker
763*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_COPY_READ_BUFFER, buf[0]);
764*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_COPY_WRITE_BUFFER, 0);
765*35238bceSAndroid Build Coastguard Worker ctx.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 16);
766*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
767*35238bceSAndroid Build Coastguard Worker
768*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_COPY_WRITE_BUFFER, buf[1]);
769*35238bceSAndroid Build Coastguard Worker ctx.endSection();
770*35238bceSAndroid Build Coastguard Worker
771*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
772*35238bceSAndroid Build Coastguard Worker "GL_INVALID_OPERATION is generated if the buffer object bound to either readtarget or writetarget is mapped.");
773*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_COPY_READ_BUFFER, 0, 4, GL_MAP_READ_BIT);
774*35238bceSAndroid Build Coastguard Worker ctx.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 16);
775*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
776*35238bceSAndroid Build Coastguard Worker ctx.glUnmapBuffer(GL_COPY_READ_BUFFER);
777*35238bceSAndroid Build Coastguard Worker
778*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_COPY_WRITE_BUFFER, 0, 4, GL_MAP_READ_BIT);
779*35238bceSAndroid Build Coastguard Worker ctx.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, 16);
780*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
781*35238bceSAndroid Build Coastguard Worker ctx.glUnmapBuffer(GL_COPY_WRITE_BUFFER);
782*35238bceSAndroid Build Coastguard Worker ctx.endSection();
783*35238bceSAndroid Build Coastguard Worker
784*35238bceSAndroid Build Coastguard Worker ctx.glDeleteBuffers(2, buf);
785*35238bceSAndroid Build Coastguard Worker }
786*35238bceSAndroid Build Coastguard Worker
draw_buffers(NegativeTestContext & ctx)787*35238bceSAndroid Build Coastguard Worker void draw_buffers(NegativeTestContext &ctx)
788*35238bceSAndroid Build Coastguard Worker {
789*35238bceSAndroid Build Coastguard Worker uint32_t fbo = 0x1234;
790*35238bceSAndroid Build Coastguard Worker uint32_t texture = 0x1234;
791*35238bceSAndroid Build Coastguard Worker int maxDrawBuffers = 0x1234;
792*35238bceSAndroid Build Coastguard Worker int maxColorAttachments = -1;
793*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &maxColorAttachments);
794*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
795*35238bceSAndroid Build Coastguard Worker std::vector<uint32_t> values(maxDrawBuffers + 1);
796*35238bceSAndroid Build Coastguard Worker std::vector<uint32_t> attachments(4);
797*35238bceSAndroid Build Coastguard Worker std::vector<GLfloat> data(32 * 32);
798*35238bceSAndroid Build Coastguard Worker bool isES = glu::isContextTypeES(ctx.getRenderContext().getType());
799*35238bceSAndroid Build Coastguard Worker values[0] = GL_NONE;
800*35238bceSAndroid Build Coastguard Worker values[1] = GL_BACK;
801*35238bceSAndroid Build Coastguard Worker values[2] = GL_COLOR_ATTACHMENT0;
802*35238bceSAndroid Build Coastguard Worker values[3] = GL_DEPTH_ATTACHMENT;
803*35238bceSAndroid Build Coastguard Worker attachments[0] = (glw::GLenum)(GL_COLOR_ATTACHMENT0 + maxColorAttachments);
804*35238bceSAndroid Build Coastguard Worker attachments[1] = GL_COLOR_ATTACHMENT0;
805*35238bceSAndroid Build Coastguard Worker attachments[2] = GL_COLOR_ATTACHMENT1;
806*35238bceSAndroid Build Coastguard Worker attachments[3] = GL_NONE;
807*35238bceSAndroid Build Coastguard Worker
808*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &texture);
809*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, texture);
810*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
811*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(1, &fbo);
812*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
813*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
814*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
815*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
816*35238bceSAndroid Build Coastguard Worker
817*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if one of the values in bufs is not an accepted value.");
818*35238bceSAndroid Build Coastguard Worker ctx.glDrawBuffers(2, &values[2]);
819*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
820*35238bceSAndroid Build Coastguard Worker ctx.endSection();
821*35238bceSAndroid Build Coastguard Worker
822*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
823*35238bceSAndroid Build Coastguard Worker "GL_INVALID_OPERATION is generated if the GL is bound to a draw framebuffer and DrawBuffers is supplied with "
824*35238bceSAndroid Build Coastguard Worker "BACK or COLOR_ATTACHMENTm where m is greater than or equal to the value of MAX_COLOR_ATTACHMENTS.");
825*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
826*35238bceSAndroid Build Coastguard Worker ctx.glDrawBuffers(1, &values[1]);
827*35238bceSAndroid Build Coastguard Worker ctx.expectError(isES ? GL_INVALID_OPERATION : GL_INVALID_ENUM);
828*35238bceSAndroid Build Coastguard Worker ctx.glDrawBuffers(4, &attachments[0]);
829*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
830*35238bceSAndroid Build Coastguard Worker ctx.endSection();
831*35238bceSAndroid Build Coastguard Worker
832*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the GL is bound to the default framebuffer and n is not 1.");
833*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
834*35238bceSAndroid Build Coastguard Worker ctx.glDrawBuffers(2, &values[0]);
835*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
836*35238bceSAndroid Build Coastguard Worker ctx.endSection();
837*35238bceSAndroid Build Coastguard Worker
838*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the GL is bound to the default framebuffer and the value in "
839*35238bceSAndroid Build Coastguard Worker "bufs is one of the GL_COLOR_ATTACHMENTn tokens.");
840*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
841*35238bceSAndroid Build Coastguard Worker ctx.glDrawBuffers(1, &values[2]);
842*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
843*35238bceSAndroid Build Coastguard Worker ctx.endSection();
844*35238bceSAndroid Build Coastguard Worker
845*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the GL is bound to a framebuffer object and the ith buffer "
846*35238bceSAndroid Build Coastguard Worker "listed in bufs is anything other than GL_NONE or GL_COLOR_ATTACHMENTSi.");
847*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
848*35238bceSAndroid Build Coastguard Worker ctx.glDrawBuffers(1, &values[1]);
849*35238bceSAndroid Build Coastguard Worker ctx.expectError(isES ? GL_INVALID_OPERATION : GL_INVALID_ENUM);
850*35238bceSAndroid Build Coastguard Worker ctx.glDrawBuffers(4, &attachments[0]);
851*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
852*35238bceSAndroid Build Coastguard Worker
853*35238bceSAndroid Build Coastguard Worker ctx.endSection();
854*35238bceSAndroid Build Coastguard Worker
855*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if n is less than 0 or greater than GL_MAX_DRAW_BUFFERS.");
856*35238bceSAndroid Build Coastguard Worker ctx.glDrawBuffers(-1, &values[1]);
857*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
858*35238bceSAndroid Build Coastguard Worker ctx.glDrawBuffers(maxDrawBuffers + 1, &values[0]);
859*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
860*35238bceSAndroid Build Coastguard Worker ctx.endSection();
861*35238bceSAndroid Build Coastguard Worker
862*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(1, &texture);
863*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(1, &fbo);
864*35238bceSAndroid Build Coastguard Worker }
865*35238bceSAndroid Build Coastguard Worker
flush_mapped_buffer_range(NegativeTestContext & ctx)866*35238bceSAndroid Build Coastguard Worker void flush_mapped_buffer_range(NegativeTestContext &ctx)
867*35238bceSAndroid Build Coastguard Worker {
868*35238bceSAndroid Build Coastguard Worker uint32_t buf = 0x1234;
869*35238bceSAndroid Build Coastguard Worker std::vector<GLfloat> data(32);
870*35238bceSAndroid Build Coastguard Worker
871*35238bceSAndroid Build Coastguard Worker ctx.glGenBuffers(1, &buf);
872*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ARRAY_BUFFER, buf);
873*35238bceSAndroid Build Coastguard Worker ctx.glBufferData(GL_ARRAY_BUFFER, 32, &data[0], GL_STATIC_READ);
874*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, 0, 16, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT);
875*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
876*35238bceSAndroid Build Coastguard Worker
877*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted values.");
878*35238bceSAndroid Build Coastguard Worker ctx.glFlushMappedBufferRange(-1, 0, 16);
879*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
880*35238bceSAndroid Build Coastguard Worker ctx.endSection();
881*35238bceSAndroid Build Coastguard Worker
882*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if offset or length is negative, or if offset + length exceeds the "
883*35238bceSAndroid Build Coastguard Worker "size of the mapping.");
884*35238bceSAndroid Build Coastguard Worker ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, -1, 1);
885*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
886*35238bceSAndroid Build Coastguard Worker ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, -1);
887*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
888*35238bceSAndroid Build Coastguard Worker ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 12, 8);
889*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
890*35238bceSAndroid Build Coastguard Worker ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 24, 4);
891*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
892*35238bceSAndroid Build Coastguard Worker ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, 24);
893*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
894*35238bceSAndroid Build Coastguard Worker ctx.endSection();
895*35238bceSAndroid Build Coastguard Worker
896*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if zero is bound to target.");
897*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ARRAY_BUFFER, 0);
898*35238bceSAndroid Build Coastguard Worker ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, 8);
899*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
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 the buffer bound to target is not mapped, or is mapped "
903*35238bceSAndroid Build Coastguard Worker "without the GL_MAP_FLUSH_EXPLICIT flag.");
904*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ARRAY_BUFFER, buf);
905*35238bceSAndroid Build Coastguard Worker ctx.glUnmapBuffer(GL_ARRAY_BUFFER);
906*35238bceSAndroid Build Coastguard Worker ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, 8);
907*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
908*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, 0, 16, GL_MAP_WRITE_BIT);
909*35238bceSAndroid Build Coastguard Worker ctx.glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, 8);
910*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
911*35238bceSAndroid Build Coastguard Worker ctx.endSection();
912*35238bceSAndroid Build Coastguard Worker
913*35238bceSAndroid Build Coastguard Worker ctx.glUnmapBuffer(GL_ARRAY_BUFFER);
914*35238bceSAndroid Build Coastguard Worker ctx.glDeleteBuffers(1, &buf);
915*35238bceSAndroid Build Coastguard Worker }
916*35238bceSAndroid Build Coastguard Worker
map_buffer_range(NegativeTestContext & ctx)917*35238bceSAndroid Build Coastguard Worker void map_buffer_range(NegativeTestContext &ctx)
918*35238bceSAndroid Build Coastguard Worker {
919*35238bceSAndroid Build Coastguard Worker uint32_t buf = 0x1234;
920*35238bceSAndroid Build Coastguard Worker std::vector<GLfloat> data(32);
921*35238bceSAndroid Build Coastguard Worker
922*35238bceSAndroid Build Coastguard Worker ctx.glGenBuffers(1, &buf);
923*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ARRAY_BUFFER, buf);
924*35238bceSAndroid Build Coastguard Worker ctx.glBufferData(GL_ARRAY_BUFFER, 32, &data[0], GL_DYNAMIC_COPY);
925*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
926*35238bceSAndroid Build Coastguard Worker
927*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if either of offset or length is negative.");
928*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, -1, 1, GL_MAP_READ_BIT);
929*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
930*35238bceSAndroid Build Coastguard Worker
931*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, 1, -1, GL_MAP_READ_BIT);
932*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
933*35238bceSAndroid Build Coastguard Worker ctx.endSection();
934*35238bceSAndroid Build Coastguard Worker
935*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if offset + length is greater than the value of GL_BUFFER_SIZE.");
936*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, 0, 33, GL_MAP_READ_BIT);
937*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
938*35238bceSAndroid Build Coastguard Worker
939*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, 32, 1, GL_MAP_READ_BIT);
940*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
941*35238bceSAndroid Build Coastguard Worker
942*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, 16, 17, GL_MAP_READ_BIT);
943*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
944*35238bceSAndroid Build Coastguard Worker ctx.endSection();
945*35238bceSAndroid Build Coastguard Worker
946*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if access has any bits set other than those accepted.");
947*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, 0, 16, GL_MAP_READ_BIT | 0x1000);
948*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
949*35238bceSAndroid Build Coastguard Worker
950*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, 0, 16, GL_MAP_WRITE_BIT | 0x1000);
951*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
952*35238bceSAndroid Build Coastguard Worker ctx.endSection();
953*35238bceSAndroid Build Coastguard Worker
954*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer is already in a mapped state.");
955*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, 0, 16, GL_MAP_WRITE_BIT);
956*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
957*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, 16, 8, GL_MAP_READ_BIT);
958*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
959*35238bceSAndroid Build Coastguard Worker ctx.glUnmapBuffer(GL_ARRAY_BUFFER);
960*35238bceSAndroid Build Coastguard Worker ctx.endSection();
961*35238bceSAndroid Build Coastguard Worker
962*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if neither GL_MAP_READ_BIT or GL_MAP_WRITE_BIT is set.");
963*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, 0, 16, GL_MAP_INVALIDATE_RANGE_BIT);
964*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
965*35238bceSAndroid Build Coastguard Worker ctx.endSection();
966*35238bceSAndroid Build Coastguard Worker
967*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if length is 0");
968*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, 0, 0, GL_MAP_READ_BIT);
969*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
970*35238bceSAndroid Build Coastguard Worker ctx.endSection();
971*35238bceSAndroid Build Coastguard Worker
972*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if GL_MAP_READ_BIT is set and any of "
973*35238bceSAndroid Build Coastguard Worker "GL_MAP_INVALIDATE_RANGE_BIT, GL_MAP_INVALIDATE_BUFFER_BIT, or GL_MAP_UNSYNCHRONIZED_BIT is set.");
974*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, 0, 16, GL_MAP_READ_BIT | GL_MAP_INVALIDATE_RANGE_BIT);
975*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
976*35238bceSAndroid Build Coastguard Worker
977*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, 0, 16, GL_MAP_READ_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
978*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
979*35238bceSAndroid Build Coastguard Worker
980*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, 0, 16, GL_MAP_READ_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
981*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
982*35238bceSAndroid Build Coastguard Worker ctx.endSection();
983*35238bceSAndroid Build Coastguard Worker
984*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
985*35238bceSAndroid Build Coastguard Worker "GL_INVALID_OPERATION is generated if GL_MAP_FLUSH_EXPLICIT_BIT is set and GL_MAP_WRITE_BIT is not set.");
986*35238bceSAndroid Build Coastguard Worker ctx.glMapBufferRange(GL_ARRAY_BUFFER, 0, 16, GL_MAP_READ_BIT | GL_MAP_FLUSH_EXPLICIT_BIT);
987*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
988*35238bceSAndroid Build Coastguard Worker ctx.endSection();
989*35238bceSAndroid Build Coastguard Worker
990*35238bceSAndroid Build Coastguard Worker ctx.glDeleteBuffers(1, &buf);
991*35238bceSAndroid Build Coastguard Worker }
992*35238bceSAndroid Build Coastguard Worker
read_buffer(NegativeTestContext & ctx)993*35238bceSAndroid Build Coastguard Worker void read_buffer(NegativeTestContext &ctx)
994*35238bceSAndroid Build Coastguard Worker {
995*35238bceSAndroid Build Coastguard Worker uint32_t fbo = 0x1234;
996*35238bceSAndroid Build Coastguard Worker uint32_t texture = 0x1234;
997*35238bceSAndroid Build Coastguard Worker int maxColorAttachments = 0x1234;
998*35238bceSAndroid Build Coastguard Worker bool isES = glu::isContextTypeES(ctx.getRenderContext().getType());
999*35238bceSAndroid Build Coastguard Worker
1000*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &maxColorAttachments);
1001*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &texture);
1002*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, texture);
1003*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1004*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(1, &fbo);
1005*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1006*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
1007*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
1008*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1009*35238bceSAndroid Build Coastguard Worker
1010*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if mode is not GL_BACK, GL_NONE, or GL_COLOR_ATTACHMENTi.");
1011*35238bceSAndroid Build Coastguard Worker ctx.glReadBuffer(GL_NONE);
1012*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1013*35238bceSAndroid Build Coastguard Worker ctx.glReadBuffer(1);
1014*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1015*35238bceSAndroid Build Coastguard Worker ctx.glReadBuffer(GL_FRAMEBUFFER);
1016*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1017*35238bceSAndroid Build Coastguard Worker ctx.glReadBuffer(GL_COLOR_ATTACHMENT0 - 1);
1018*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1019*35238bceSAndroid Build Coastguard Worker ctx.glReadBuffer(GL_FRONT);
1020*35238bceSAndroid Build Coastguard Worker ctx.expectError(isES ? GL_INVALID_ENUM : GL_INVALID_OPERATION);
1021*35238bceSAndroid Build Coastguard Worker
1022*35238bceSAndroid Build Coastguard Worker // \ note Spec isn't actually clear here, but it is safe to assume that
1023*35238bceSAndroid Build Coastguard Worker // GL_DEPTH_ATTACHMENT can't be interpreted as GL_COLOR_ATTACHMENTm
1024*35238bceSAndroid Build Coastguard Worker // where m = (GL_DEPTH_ATTACHMENT - GL_COLOR_ATTACHMENT0).
1025*35238bceSAndroid Build Coastguard Worker ctx.glReadBuffer(GL_DEPTH_ATTACHMENT);
1026*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1027*35238bceSAndroid Build Coastguard Worker ctx.glReadBuffer(GL_STENCIL_ATTACHMENT);
1028*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1029*35238bceSAndroid Build Coastguard Worker ctx.glReadBuffer(GL_STENCIL_ATTACHMENT + 1);
1030*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1031*35238bceSAndroid Build Coastguard Worker ctx.glReadBuffer(0xffffffffu);
1032*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1033*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1034*35238bceSAndroid Build Coastguard Worker
1035*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION error is generated if src is GL_BACK or if src is GL_COLOR_ATTACHMENTm "
1036*35238bceSAndroid Build Coastguard Worker "where m is greater than or equal to the value of GL_MAX_COLOR_ATTACHMENTS.");
1037*35238bceSAndroid Build Coastguard Worker ctx.glReadBuffer(GL_BACK);
1038*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1039*35238bceSAndroid Build Coastguard Worker ctx.glReadBuffer(GL_COLOR_ATTACHMENT0 + maxColorAttachments);
1040*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1041*35238bceSAndroid Build Coastguard Worker
1042*35238bceSAndroid Build Coastguard Worker if (GL_COLOR_ATTACHMENT0 + maxColorAttachments < GL_DEPTH_ATTACHMENT - 1)
1043*35238bceSAndroid Build Coastguard Worker {
1044*35238bceSAndroid Build Coastguard Worker ctx.glReadBuffer(GL_DEPTH_ATTACHMENT - 1);
1045*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1046*35238bceSAndroid Build Coastguard Worker }
1047*35238bceSAndroid Build Coastguard Worker
1048*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1049*35238bceSAndroid Build Coastguard Worker
1050*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the current framebuffer is the default framebuffer and mode "
1051*35238bceSAndroid Build Coastguard Worker "is not GL_NONE or GL_BACK.");
1052*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1053*35238bceSAndroid Build Coastguard Worker ctx.glReadBuffer(GL_COLOR_ATTACHMENT0);
1054*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1055*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1056*35238bceSAndroid Build Coastguard Worker
1057*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the current framebuffer is a named framebuffer and mode is "
1058*35238bceSAndroid Build Coastguard Worker "not GL_NONE or GL_COLOR_ATTACHMENTi.");
1059*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1060*35238bceSAndroid Build Coastguard Worker ctx.glReadBuffer(GL_BACK);
1061*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1062*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1063*35238bceSAndroid Build Coastguard Worker
1064*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(1, &texture);
1065*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(1, &fbo);
1066*35238bceSAndroid Build Coastguard Worker }
1067*35238bceSAndroid Build Coastguard Worker
unmap_buffer(NegativeTestContext & ctx)1068*35238bceSAndroid Build Coastguard Worker void unmap_buffer(NegativeTestContext &ctx)
1069*35238bceSAndroid Build Coastguard Worker {
1070*35238bceSAndroid Build Coastguard Worker uint32_t buf = 0x1234;
1071*35238bceSAndroid Build Coastguard Worker std::vector<GLfloat> data(32);
1072*35238bceSAndroid Build Coastguard Worker
1073*35238bceSAndroid Build Coastguard Worker ctx.glGenBuffers(1, &buf);
1074*35238bceSAndroid Build Coastguard Worker ctx.glBindBuffer(GL_ARRAY_BUFFER, buf);
1075*35238bceSAndroid Build Coastguard Worker ctx.glBufferData(GL_ARRAY_BUFFER, 32, &data[0], GL_DYNAMIC_COPY);
1076*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1077*35238bceSAndroid Build Coastguard Worker
1078*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the buffer data store is already in an unmapped state.");
1079*35238bceSAndroid Build Coastguard Worker ctx.glUnmapBuffer(GL_ARRAY_BUFFER);
1080*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1081*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1082*35238bceSAndroid Build Coastguard Worker
1083*35238bceSAndroid Build Coastguard Worker ctx.glDeleteBuffers(1, &buf);
1084*35238bceSAndroid Build Coastguard Worker }
1085*35238bceSAndroid Build Coastguard Worker // Framebuffer Objects
1086*35238bceSAndroid Build Coastguard Worker
bind_framebuffer(NegativeTestContext & ctx)1087*35238bceSAndroid Build Coastguard Worker void bind_framebuffer(NegativeTestContext &ctx)
1088*35238bceSAndroid Build Coastguard Worker {
1089*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
1090*35238bceSAndroid Build Coastguard Worker "GL_INVALID_ENUM is generated if target is not GL_DRAW_FRAMEBUFFER, GL_READ_FRAMEBUFFER, or GL_FRAMEBUFFER.");
1091*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(-1, 0);
1092*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1093*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_RENDERBUFFER, 0);
1094*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1095*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1096*35238bceSAndroid Build Coastguard Worker }
1097*35238bceSAndroid Build Coastguard Worker
bind_renderbuffer(NegativeTestContext & ctx)1098*35238bceSAndroid Build Coastguard Worker void bind_renderbuffer(NegativeTestContext &ctx)
1099*35238bceSAndroid Build Coastguard Worker {
1100*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER.");
1101*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(-1, 0);
1102*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1103*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_FRAMEBUFFER, 0);
1104*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1105*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1106*35238bceSAndroid Build Coastguard Worker }
1107*35238bceSAndroid Build Coastguard Worker
check_framebuffer_status(NegativeTestContext & ctx)1108*35238bceSAndroid Build Coastguard Worker void check_framebuffer_status(NegativeTestContext &ctx)
1109*35238bceSAndroid Build Coastguard Worker {
1110*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
1111*35238bceSAndroid Build Coastguard Worker "GL_INVALID_ENUM is generated if target is not GL_DRAW_FRAMEBUFFER, GL_READ_FRAMEBUFFER, or GL_FRAMEBUFFER..");
1112*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(-1);
1113*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1114*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_RENDERBUFFER);
1115*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1116*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1117*35238bceSAndroid Build Coastguard Worker }
1118*35238bceSAndroid Build Coastguard Worker
gen_framebuffers(NegativeTestContext & ctx)1119*35238bceSAndroid Build Coastguard Worker void gen_framebuffers(NegativeTestContext &ctx)
1120*35238bceSAndroid Build Coastguard Worker {
1121*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
1122*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(-1, 0);
1123*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1124*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1125*35238bceSAndroid Build Coastguard Worker }
1126*35238bceSAndroid Build Coastguard Worker
gen_renderbuffers(NegativeTestContext & ctx)1127*35238bceSAndroid Build Coastguard Worker void gen_renderbuffers(NegativeTestContext &ctx)
1128*35238bceSAndroid Build Coastguard Worker {
1129*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
1130*35238bceSAndroid Build Coastguard Worker ctx.glGenRenderbuffers(-1, 0);
1131*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1132*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1133*35238bceSAndroid Build Coastguard Worker }
1134*35238bceSAndroid Build Coastguard Worker
delete_framebuffers(NegativeTestContext & ctx)1135*35238bceSAndroid Build Coastguard Worker void delete_framebuffers(NegativeTestContext &ctx)
1136*35238bceSAndroid Build Coastguard Worker {
1137*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
1138*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(-1, 0);
1139*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1140*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1141*35238bceSAndroid Build Coastguard Worker }
1142*35238bceSAndroid Build Coastguard Worker
delete_renderbuffers(NegativeTestContext & ctx)1143*35238bceSAndroid Build Coastguard Worker void delete_renderbuffers(NegativeTestContext &ctx)
1144*35238bceSAndroid Build Coastguard Worker {
1145*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
1146*35238bceSAndroid Build Coastguard Worker ctx.glDeleteRenderbuffers(-1, 0);
1147*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1148*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1149*35238bceSAndroid Build Coastguard Worker }
1150*35238bceSAndroid Build Coastguard Worker
framebuffer_renderbuffer(NegativeTestContext & ctx)1151*35238bceSAndroid Build Coastguard Worker void framebuffer_renderbuffer(NegativeTestContext &ctx)
1152*35238bceSAndroid Build Coastguard Worker {
1153*35238bceSAndroid Build Coastguard Worker GLuint fbo = 0x1234;
1154*35238bceSAndroid Build Coastguard Worker GLuint rbo = 0x1234;
1155*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(1, &fbo);
1156*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1157*35238bceSAndroid Build Coastguard Worker ctx.glGenRenderbuffers(1, &rbo);
1158*35238bceSAndroid Build Coastguard Worker
1159*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
1160*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferRenderbuffer(-1, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0);
1161*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1162*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1163*35238bceSAndroid Build Coastguard Worker
1164*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if attachment is not one of the accepted tokens.");
1165*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferRenderbuffer(GL_FRAMEBUFFER, -1, GL_RENDERBUFFER, 0);
1166*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1167*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1168*35238bceSAndroid Build Coastguard Worker
1169*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if renderbuffertarget is not GL_RENDERBUFFER.");
1170*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo);
1171*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, -1, rbo);
1172*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1173*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, 0);
1174*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1175*35238bceSAndroid Build Coastguard Worker
1176*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if renderbuffer is neither 0 nor the name of an existing "
1177*35238bceSAndroid Build Coastguard Worker "renderbuffer object.");
1178*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, -1);
1179*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1180*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1181*35238bceSAndroid Build Coastguard Worker
1182*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if zero is bound to target.");
1183*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1184*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0);
1185*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1186*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1187*35238bceSAndroid Build Coastguard Worker
1188*35238bceSAndroid Build Coastguard Worker ctx.glDeleteRenderbuffers(1, &rbo);
1189*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(1, &fbo);
1190*35238bceSAndroid Build Coastguard Worker }
1191*35238bceSAndroid Build Coastguard Worker
framebuffer_texture(NegativeTestContext & ctx)1192*35238bceSAndroid Build Coastguard Worker void framebuffer_texture(NegativeTestContext &ctx)
1193*35238bceSAndroid Build Coastguard Worker {
1194*35238bceSAndroid Build Coastguard Worker if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
1195*35238bceSAndroid Build Coastguard Worker {
1196*35238bceSAndroid Build Coastguard Worker GLuint fbo = 0x1234;
1197*35238bceSAndroid Build Coastguard Worker GLuint texture[] = {0x1234, 0x1234};
1198*35238bceSAndroid Build Coastguard Worker
1199*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(1, &fbo);
1200*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1201*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(2, texture);
1202*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, texture[0]);
1203*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_BUFFER, texture[1]);
1204*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1205*35238bceSAndroid Build Coastguard Worker
1206*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
1207*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture(-1, GL_COLOR_ATTACHMENT0, texture[0], 0);
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_ENUM is generated if attachment is not one of the accepted tokens.");
1212*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture(GL_FRAMEBUFFER, -1, texture[0], 0);
1213*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1214*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1215*35238bceSAndroid Build Coastguard Worker
1216*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
1217*35238bceSAndroid Build Coastguard Worker "GL_INVALID_OPERATION is generated if texture is neither 0 nor the name of an existing texture object.");
1218*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, -1, 0);
1219*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1220*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1221*35238bceSAndroid Build Coastguard Worker
1222*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if zero is bound to target.");
1223*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1224*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 0, 0);
1225*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1226*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1227*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1228*35238bceSAndroid Build Coastguard Worker
1229*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated by if texture is a buffer texture.");
1230*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture[1], 0);
1231*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1232*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1233*35238bceSAndroid Build Coastguard Worker
1234*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(1, &fbo);
1235*35238bceSAndroid Build Coastguard Worker ctx.glDeleteBuffers(2, texture);
1236*35238bceSAndroid Build Coastguard Worker }
1237*35238bceSAndroid Build Coastguard Worker }
1238*35238bceSAndroid Build Coastguard Worker
framebuffer_texture2d(NegativeTestContext & ctx)1239*35238bceSAndroid Build Coastguard Worker void framebuffer_texture2d(NegativeTestContext &ctx)
1240*35238bceSAndroid Build Coastguard Worker {
1241*35238bceSAndroid Build Coastguard Worker GLuint fbo = 0x1234;
1242*35238bceSAndroid Build Coastguard Worker GLuint tex2D = 0x1234;
1243*35238bceSAndroid Build Coastguard Worker GLuint texCube = 0x1234;
1244*35238bceSAndroid Build Coastguard Worker GLuint tex2DMS = 0x1234;
1245*35238bceSAndroid Build Coastguard Worker GLint maxTexSize = 0x1234;
1246*35238bceSAndroid Build Coastguard Worker GLint maxTexCubeSize = 0x1234;
1247*35238bceSAndroid Build Coastguard Worker int maxSize = 0x1234;
1248*35238bceSAndroid Build Coastguard Worker
1249*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(1, &fbo);
1250*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1251*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &tex2D);
1252*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, tex2D);
1253*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &texCube);
1254*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, texCube);
1255*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &tex2DMS);
1256*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, tex2DMS);
1257*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTexSize);
1258*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &maxTexCubeSize);
1259*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1260*35238bceSAndroid Build Coastguard Worker
1261*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
1262*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(-1, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
1263*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1264*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1265*35238bceSAndroid Build Coastguard Worker
1266*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if textarget is not an accepted texture target.");
1267*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, -1, tex2D, 0);
1268*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1269*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1270*35238bceSAndroid Build Coastguard Worker
1271*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if attachment is not an accepted token.");
1272*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, -1, GL_TEXTURE_2D, tex2D, 0);
1273*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1274*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1275*35238bceSAndroid Build Coastguard Worker
1276*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
1277*35238bceSAndroid Build Coastguard Worker "GL_INVALID_VALUE is generated if level is less than 0 or larger than log_2 of maximum texture size.");
1278*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2D, -1);
1279*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1280*35238bceSAndroid Build Coastguard Worker maxSize = deLog2Floor32(maxTexSize) + 1;
1281*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2D, maxSize);
1282*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1283*35238bceSAndroid Build Coastguard Worker maxSize = deLog2Floor32(maxTexCubeSize) + 1;
1284*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X, texCube, maxSize);
1285*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1286*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1287*35238bceSAndroid Build Coastguard Worker
1288*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if level is larger than maximum texture size.");
1289*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2D, maxTexSize + 1);
1290*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1291*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2D, -1);
1292*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1293*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, texCube,
1294*35238bceSAndroid Build Coastguard Worker maxTexCubeSize + 1);
1295*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1296*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, texCube, -1);
1297*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1298*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, tex2DMS, 1);
1299*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1300*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1301*35238bceSAndroid Build Coastguard Worker
1302*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
1303*35238bceSAndroid Build Coastguard Worker "GL_INVALID_OPERATION is generated if texture is neither 0 nor the name of an existing texture object.");
1304*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, -1, 0);
1305*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1306*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1307*35238bceSAndroid Build Coastguard Worker
1308*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if textarget and texture are not compatible.");
1309*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X, tex2D, 0);
1310*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1311*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, tex2D, 0);
1312*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1313*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texCube, 0);
1314*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1315*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2DMS, 0);
1316*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1317*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(1, &tex2D);
1318*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(1, &texCube);
1319*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(1, &tex2DMS);
1320*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1321*35238bceSAndroid Build Coastguard Worker
1322*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if zero is bound to target.");
1323*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1324*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
1325*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1326*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1327*35238bceSAndroid Build Coastguard Worker
1328*35238bceSAndroid Build Coastguard Worker if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
1329*35238bceSAndroid Build Coastguard Worker {
1330*35238bceSAndroid Build Coastguard Worker GLuint texBuf = 0x1234;
1331*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION error is generated if texture is the name of a buffer texture.");
1332*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &texBuf);
1333*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_BUFFER, texBuf);
1334*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1335*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1336*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texBuf, 0);
1337*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1338*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1339*35238bceSAndroid Build Coastguard Worker }
1340*35238bceSAndroid Build Coastguard Worker
1341*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(1, &fbo);
1342*35238bceSAndroid Build Coastguard Worker }
1343*35238bceSAndroid Build Coastguard Worker
renderbuffer_storage(NegativeTestContext & ctx)1344*35238bceSAndroid Build Coastguard Worker void renderbuffer_storage(NegativeTestContext &ctx)
1345*35238bceSAndroid Build Coastguard Worker {
1346*35238bceSAndroid Build Coastguard Worker uint32_t rbo = 0x1234;
1347*35238bceSAndroid Build Coastguard Worker GLint maxSize = 0x1234;
1348*35238bceSAndroid Build Coastguard Worker bool isES = glu::isContextTypeES(ctx.getRenderContext().getType());
1349*35238bceSAndroid Build Coastguard Worker
1350*35238bceSAndroid Build Coastguard Worker ctx.glGenRenderbuffers(1, &rbo);
1351*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo);
1352*35238bceSAndroid Build Coastguard Worker
1353*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER.");
1354*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(-1, GL_RGBA4, 1, 1);
1355*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1356*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_FRAMEBUFFER, GL_RGBA4, 1, 1);
1357*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1358*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1359*35238bceSAndroid Build Coastguard Worker
1360*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if internalformat is not a color-renderable, depth-renderable, or "
1361*35238bceSAndroid Build Coastguard Worker "stencil-renderable format.");
1362*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_RENDERBUFFER, -1, 1, 1);
1363*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1364*35238bceSAndroid Build Coastguard Worker
1365*35238bceSAndroid Build Coastguard Worker if (!ctx.isExtensionSupported("GL_EXT_color_buffer_half_float")) // GL_EXT_color_buffer_half_float disables error
1366*35238bceSAndroid Build Coastguard Worker {
1367*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB16F, 1, 1);
1368*35238bceSAndroid Build Coastguard Worker ctx.expectError(isES ? GL_INVALID_ENUM : GL_NO_ERROR);
1369*35238bceSAndroid Build Coastguard Worker }
1370*35238bceSAndroid Build Coastguard Worker
1371*35238bceSAndroid Build Coastguard Worker if (!ctx.isExtensionSupported("GL_EXT_render_snorm")) // GL_EXT_render_snorm disables error
1372*35238bceSAndroid Build Coastguard Worker {
1373*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8_SNORM, 1, 1);
1374*35238bceSAndroid Build Coastguard Worker ctx.expectError(isES ? GL_INVALID_ENUM : GL_NO_ERROR);
1375*35238bceSAndroid Build Coastguard Worker }
1376*35238bceSAndroid Build Coastguard Worker
1377*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1378*35238bceSAndroid Build Coastguard Worker
1379*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than zero.");
1380*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA4, -1, 1);
1381*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1382*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA4, 1, -1);
1383*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1384*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA4, -1, -1);
1385*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1386*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1387*35238bceSAndroid Build Coastguard Worker
1388*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_RENDERBUFFER_SIZE.");
1389*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &maxSize);
1390*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA4, 1, maxSize + 1);
1391*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1392*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA4, maxSize + 1, 1);
1393*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1394*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA4, maxSize + 1, maxSize + 1);
1395*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1396*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1397*35238bceSAndroid Build Coastguard Worker
1398*35238bceSAndroid Build Coastguard Worker ctx.glDeleteRenderbuffers(1, &rbo);
1399*35238bceSAndroid Build Coastguard Worker }
1400*35238bceSAndroid Build Coastguard Worker
blit_framebuffer(NegativeTestContext & ctx)1401*35238bceSAndroid Build Coastguard Worker void blit_framebuffer(NegativeTestContext &ctx)
1402*35238bceSAndroid Build Coastguard Worker {
1403*35238bceSAndroid Build Coastguard Worker uint32_t fbo[2];
1404*35238bceSAndroid Build Coastguard Worker uint32_t rbo[2];
1405*35238bceSAndroid Build Coastguard Worker uint32_t texture[2];
1406*35238bceSAndroid Build Coastguard Worker uint32_t blankFrameBuffer;
1407*35238bceSAndroid Build Coastguard Worker
1408*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(1, &blankFrameBuffer);
1409*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(2, fbo);
1410*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(2, texture);
1411*35238bceSAndroid Build Coastguard Worker ctx.glGenRenderbuffers(2, rbo);
1412*35238bceSAndroid Build Coastguard Worker
1413*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, texture[0]);
1414*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo[0]);
1415*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo[0]);
1416*35238bceSAndroid Build Coastguard Worker
1417*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1418*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 32, 32);
1419*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[0], 0);
1420*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo[0]);
1421*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
1422*35238bceSAndroid Build Coastguard Worker
1423*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, texture[1]);
1424*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo[1]);
1425*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo[1]);
1426*35238bceSAndroid Build Coastguard Worker
1427*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1428*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 32, 32);
1429*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[1], 0);
1430*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo[1]);
1431*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
1432*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1433*35238bceSAndroid Build Coastguard Worker
1434*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if mask contains any bits other than GL_COLOR_BUFFER_BIT, "
1435*35238bceSAndroid Build Coastguard Worker "GL_DEPTH_BUFFER_BIT, or GL_STENCIL_BUFFER_BIT.");
1436*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, 1, GL_NEAREST);
1437*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1438*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1439*35238bceSAndroid Build Coastguard Worker
1440*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if filter is not GL_LINEAR or GL_NEAREST.");
1441*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, 0);
1442*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1443*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1444*35238bceSAndroid Build Coastguard Worker
1445*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if mask contains any of the GL_DEPTH_BUFFER_BIT or "
1446*35238bceSAndroid Build Coastguard Worker "GL_STENCIL_BUFFER_BIT and filter is not GL_NEAREST.");
1447*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_LINEAR);
1448*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1449*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, GL_LINEAR);
1450*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1451*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_LINEAR);
1452*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1453*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1454*35238bceSAndroid Build Coastguard Worker
1455*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if mask contains GL_COLOR_BUFFER_BIT and read buffer format is "
1456*35238bceSAndroid Build Coastguard Worker "incompatible with draw buffer format.");
1457*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, texture[0]);
1458*35238bceSAndroid Build Coastguard Worker
1459*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32UI, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, NULL);
1460*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[0], 0);
1461*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// Read buffer: GL_RGBA32UI, draw buffer: GL_RGBA" << TestLog::EndMessage;
1462*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1463*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1464*35238bceSAndroid Build Coastguard Worker
1465*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32I, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, NULL);
1466*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[0], 0);
1467*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// Read buffer: GL_RGBA32I, draw buffer: GL_RGBA" << TestLog::EndMessage;
1468*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1469*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1470*35238bceSAndroid Build Coastguard Worker
1471*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1472*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[0], 0);
1473*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, texture[1]);
1474*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32I, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, NULL);
1475*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[1], 0);
1476*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// Read buffer: GL_RGBA8, draw buffer: GL_RGBA32I" << TestLog::EndMessage;
1477*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1478*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1479*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1480*35238bceSAndroid Build Coastguard Worker
1481*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
1482*35238bceSAndroid Build Coastguard Worker "GL_INVALID_OPERATION is generated if filter is GL_LINEAR and the read buffer contains integer data.");
1483*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, texture[0]);
1484*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32UI, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, NULL);
1485*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[0], 0);
1486*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1487*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture[1], 0);
1488*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// Read buffer: GL_RGBA32I, draw buffer: GL_RGBA8" << TestLog::EndMessage;
1489*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_LINEAR);
1490*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1491*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1492*35238bceSAndroid Build Coastguard Worker
1493*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if mask contains GL_DEPTH_BUFFER_BIT or GL_STENCIL_BUFFER_BIT "
1494*35238bceSAndroid Build Coastguard Worker "and the source and destination depth and stencil formats do not match.");
1495*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo[0]);
1496*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH32F_STENCIL8, 32, 32);
1497*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo[0]);
1498*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
1499*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1500*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, GL_STENCIL_BUFFER_BIT, GL_NEAREST);
1501*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1502*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1503*35238bceSAndroid Build Coastguard Worker
1504*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
1505*35238bceSAndroid Build Coastguard Worker "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the read or draw framebuffer is not framebuffer complete.");
1506*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
1507*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
1508*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, 0, GL_NEAREST);
1509*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1510*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// incomplete read framebuffer" << TestLog::EndMessage;
1511*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_READ_FRAMEBUFFER, blankFrameBuffer);
1512*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo[1]);
1513*35238bceSAndroid Build Coastguard Worker TCU_CHECK(ctx.glCheckFramebufferStatus(GL_READ_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE);
1514*35238bceSAndroid Build Coastguard Worker TCU_CHECK(ctx.glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);
1515*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, 0, GL_NEAREST);
1516*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1517*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// incomplete draw framebuffer" << TestLog::EndMessage;
1518*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo[1]);
1519*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, blankFrameBuffer);
1520*35238bceSAndroid Build Coastguard Worker TCU_CHECK(ctx.glCheckFramebufferStatus(GL_READ_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);
1521*35238bceSAndroid Build Coastguard Worker TCU_CHECK(ctx.glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE);
1522*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, 0, GL_NEAREST);
1523*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1524*35238bceSAndroid Build Coastguard Worker ctx.getLog() << TestLog::Message << "// incomplete read and draw framebuffer" << TestLog::EndMessage;
1525*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_READ_FRAMEBUFFER, blankFrameBuffer);
1526*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, blankFrameBuffer);
1527*35238bceSAndroid Build Coastguard Worker TCU_CHECK(ctx.glCheckFramebufferStatus(GL_READ_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE);
1528*35238bceSAndroid Build Coastguard Worker TCU_CHECK(ctx.glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE);
1529*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, 0, GL_NEAREST);
1530*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_FRAMEBUFFER_OPERATION);
1531*35238bceSAndroid Build Coastguard Worker // restore
1532*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo[0]);
1533*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
1534*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo[1]);
1535*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
1536*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1537*35238bceSAndroid Build Coastguard Worker
1538*35238bceSAndroid Build Coastguard Worker bool isES = glu::isContextTypeES(ctx.getRenderContext().getType());
1539*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the source and destination buffers are identical.");
1540*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo[0]);
1541*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1542*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
1543*35238bceSAndroid Build Coastguard Worker ctx.expectError(isES ? GL_INVALID_OPERATION : GL_NO_ERROR);
1544*35238bceSAndroid Build Coastguard Worker // restore
1545*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo[1]);
1546*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1547*35238bceSAndroid Build Coastguard Worker
1548*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1549*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, 0);
1550*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(2, fbo);
1551*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(1, &blankFrameBuffer);
1552*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(2, texture);
1553*35238bceSAndroid Build Coastguard Worker ctx.glDeleteRenderbuffers(2, rbo);
1554*35238bceSAndroid Build Coastguard Worker }
1555*35238bceSAndroid Build Coastguard Worker
blit_framebuffer_multisample(NegativeTestContext & ctx)1556*35238bceSAndroid Build Coastguard Worker void blit_framebuffer_multisample(NegativeTestContext &ctx)
1557*35238bceSAndroid Build Coastguard Worker {
1558*35238bceSAndroid Build Coastguard Worker uint32_t fbo[2];
1559*35238bceSAndroid Build Coastguard Worker uint32_t rbo[2];
1560*35238bceSAndroid Build Coastguard Worker
1561*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(2, fbo);
1562*35238bceSAndroid Build Coastguard Worker ctx.glGenRenderbuffers(2, rbo);
1563*35238bceSAndroid Build Coastguard Worker
1564*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo[0]);
1565*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo[0]);
1566*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, 32, 32);
1567*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[0]);
1568*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
1569*35238bceSAndroid Build Coastguard Worker
1570*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo[1]);
1571*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo[1]);
1572*35238bceSAndroid Build Coastguard Worker
1573*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1574*35238bceSAndroid Build Coastguard Worker
1575*35238bceSAndroid Build Coastguard Worker if (!ctx.isExtensionSupported("GL_NV_framebuffer_multisample"))
1576*35238bceSAndroid Build Coastguard Worker {
1577*35238bceSAndroid Build Coastguard Worker bool isES = glu::isContextTypeES(ctx.getRenderContext().getType());
1578*35238bceSAndroid Build Coastguard Worker
1579*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if the value of GL_SAMPLE_BUFFERS for the draw buffer is "
1580*35238bceSAndroid Build Coastguard Worker "greater than zero.");
1581*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, 32, 32);
1582*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
1583*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1584*35238bceSAndroid Build Coastguard Worker ctx.expectError(isES ? GL_INVALID_OPERATION : GL_NO_ERROR);
1585*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1586*35238bceSAndroid Build Coastguard Worker
1587*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if GL_SAMPLE_BUFFERS for the read buffer is greater than "
1588*35238bceSAndroid Build Coastguard Worker "zero and the formats of draw and read buffers are not identical.");
1589*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA4, 32, 32);
1590*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
1591*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1592*35238bceSAndroid Build Coastguard Worker ctx.expectError(isES ? GL_INVALID_OPERATION : GL_NO_ERROR);
1593*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1594*35238bceSAndroid Build Coastguard Worker
1595*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
1596*35238bceSAndroid Build Coastguard Worker "GL_INVALID_OPERATION is generated if GL_SAMPLE_BUFFERS for the read buffer is greater than zero and the "
1597*35238bceSAndroid Build Coastguard Worker "source and destination rectangles are not defined with the same (X0, Y0) and (X1, Y1) bounds.");
1598*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 32, 32);
1599*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]);
1600*35238bceSAndroid Build Coastguard Worker ctx.glBlitFramebuffer(0, 0, 16, 16, 2, 2, 18, 18, GL_COLOR_BUFFER_BIT, GL_NEAREST);
1601*35238bceSAndroid Build Coastguard Worker ctx.expectError(isES ? GL_INVALID_OPERATION : GL_NO_ERROR);
1602*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1603*35238bceSAndroid Build Coastguard Worker }
1604*35238bceSAndroid Build Coastguard Worker
1605*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1606*35238bceSAndroid Build Coastguard Worker ctx.glDeleteRenderbuffers(2, rbo);
1607*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(2, fbo);
1608*35238bceSAndroid Build Coastguard Worker }
1609*35238bceSAndroid Build Coastguard Worker
framebuffer_texture_layer(NegativeTestContext & ctx)1610*35238bceSAndroid Build Coastguard Worker void framebuffer_texture_layer(NegativeTestContext &ctx)
1611*35238bceSAndroid Build Coastguard Worker {
1612*35238bceSAndroid Build Coastguard Worker uint32_t fbo = 0x1234;
1613*35238bceSAndroid Build Coastguard Worker uint32_t tex3D = 0x1234;
1614*35238bceSAndroid Build Coastguard Worker uint32_t tex2DArray = 0x1234;
1615*35238bceSAndroid Build Coastguard Worker uint32_t tex2D = 0x1234;
1616*35238bceSAndroid Build Coastguard Worker uint32_t tex2DMSArray = 0x1234;
1617*35238bceSAndroid Build Coastguard Worker uint32_t texBuffer = 0x1234;
1618*35238bceSAndroid Build Coastguard Worker int max3DTexSize = 0x1234;
1619*35238bceSAndroid Build Coastguard Worker int maxTexSize = 0x1234;
1620*35238bceSAndroid Build Coastguard Worker int maxArrayTexLayers = 0x1234;
1621*35238bceSAndroid Build Coastguard Worker int log2Max3DTexSize = 0x1234;
1622*35238bceSAndroid Build Coastguard Worker int log2MaxTexSize = 0x1234;
1623*35238bceSAndroid Build Coastguard Worker
1624*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &max3DTexSize);
1625*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTexSize);
1626*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &maxArrayTexLayers);
1627*35238bceSAndroid Build Coastguard Worker
1628*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(1, &fbo);
1629*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &tex3D);
1630*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &tex2DArray);
1631*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &tex2D);
1632*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1633*35238bceSAndroid Build Coastguard Worker
1634*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_3D, tex3D);
1635*35238bceSAndroid Build Coastguard Worker ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1636*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D_ARRAY, tex2DArray);
1637*35238bceSAndroid Build Coastguard Worker ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1638*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, tex2D);
1639*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1640*35238bceSAndroid Build Coastguard Worker
1641*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1642*35238bceSAndroid Build Coastguard Worker
1643*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
1644*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(-1, GL_COLOR_ATTACHMENT0, tex3D, 0, 1);
1645*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1646*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(GL_RENDERBUFFER, GL_COLOR_ATTACHMENT0, tex3D, 0, 1);
1647*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1648*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1649*35238bceSAndroid Build Coastguard Worker
1650*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if attachment is not one of the accepted tokens.");
1651*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(GL_FRAMEBUFFER, -1, tex3D, 0, 1);
1652*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1653*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_BACK, tex3D, 0, 1);
1654*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1655*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1656*35238bceSAndroid Build Coastguard Worker
1657*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if texture is non-zero and not the name of a 3D texture or 2D "
1658*35238bceSAndroid Build Coastguard Worker "array texture, 2D multisample array texture or cube map array texture.");
1659*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, -1, 0, 0);
1660*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1661*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex2D, 0, 0);
1662*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1663*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1664*35238bceSAndroid Build Coastguard Worker
1665*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if texture is not zero and layer is negative.");
1666*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex3D, 0, -1);
1667*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1668*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1669*35238bceSAndroid Build Coastguard Worker
1670*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if texture is not zero and layer is greater than "
1671*35238bceSAndroid Build Coastguard Worker "GL_MAX_3D_TEXTURE_SIZE-1 for a 3D texture.");
1672*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex3D, 0, max3DTexSize);
1673*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1674*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1675*35238bceSAndroid Build Coastguard Worker
1676*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if texture is not zero and layer is greater than "
1677*35238bceSAndroid Build Coastguard Worker "GL_MAX_ARRAY_TEXTURE_LAYERS-1 for a 2D array texture.");
1678*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex2DArray, 0, maxArrayTexLayers);
1679*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1680*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1681*35238bceSAndroid Build Coastguard Worker
1682*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if zero is bound to target.");
1683*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1684*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex3D, 0, 1);
1685*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1686*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1687*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1688*35238bceSAndroid Build Coastguard Worker
1689*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if texture is a 3D texture and level is less than 0 or greater "
1690*35238bceSAndroid Build Coastguard Worker "than log2 of the value of GL_MAX_3D_TEXTURE_SIZE.");
1691*35238bceSAndroid Build Coastguard Worker log2Max3DTexSize = deLog2Floor32(max3DTexSize);
1692*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex3D, -1, max3DTexSize - 1);
1693*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1694*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex3D, log2Max3DTexSize + 1, max3DTexSize - 1);
1695*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1696*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1697*35238bceSAndroid Build Coastguard Worker
1698*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if texture is a 2D array texture and level is less than 0 or "
1699*35238bceSAndroid Build Coastguard Worker "greater than log2 of the value of GL_MAX_TEXTURE_SIZE.");
1700*35238bceSAndroid Build Coastguard Worker log2MaxTexSize = deLog2Floor32(maxTexSize);
1701*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex2DArray, -1, maxArrayTexLayers - 1);
1702*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1703*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex2DArray, log2MaxTexSize + 1,
1704*35238bceSAndroid Build Coastguard Worker maxArrayTexLayers - 1);
1705*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1706*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1707*35238bceSAndroid Build Coastguard Worker
1708*35238bceSAndroid Build Coastguard Worker if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
1709*35238bceSAndroid Build Coastguard Worker {
1710*35238bceSAndroid Build Coastguard Worker uint32_t texCubeArray = 0x1234;
1711*35238bceSAndroid Build Coastguard Worker int maxCubeTexSize = 0x1234;
1712*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &maxCubeTexSize);
1713*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &tex2DMSArray);
1714*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &texCubeArray);
1715*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &texBuffer);
1716*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, tex2DMSArray);
1717*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, texCubeArray);
1718*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_BUFFER, texBuffer);
1719*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1720*35238bceSAndroid Build Coastguard Worker
1721*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
1722*35238bceSAndroid Build Coastguard Worker "GL_INVALID_VALUE is generated if texture is a 2D multisample array texture and level is not 0.");
1723*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex2DMSArray, -1, 0);
1724*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1725*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex2DMSArray, 1, 0);
1726*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1727*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1728*35238bceSAndroid Build Coastguard Worker
1729*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if texture is a cube map array texture and layer is larger "
1730*35238bceSAndroid Build Coastguard Worker "than MAX_ARRAY_TEXTURE_LAYERS-1. (See Khronos bug 15968)");
1731*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texCubeArray, 0, maxArrayTexLayers);
1732*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1733*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1734*35238bceSAndroid Build Coastguard Worker
1735*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if texture is the name of a buffer texture.");
1736*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texBuffer, 0, 0);
1737*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1738*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1739*35238bceSAndroid Build Coastguard Worker
1740*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(1, &tex2DMSArray);
1741*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(1, &texCubeArray);
1742*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(1, &texBuffer);
1743*35238bceSAndroid Build Coastguard Worker }
1744*35238bceSAndroid Build Coastguard Worker
1745*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(1, &tex3D);
1746*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(1, &tex2DArray);
1747*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(1, &tex2D);
1748*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(1, &fbo);
1749*35238bceSAndroid Build Coastguard Worker }
1750*35238bceSAndroid Build Coastguard Worker
invalidate_framebuffer(NegativeTestContext & ctx)1751*35238bceSAndroid Build Coastguard Worker void invalidate_framebuffer(NegativeTestContext &ctx)
1752*35238bceSAndroid Build Coastguard Worker {
1753*35238bceSAndroid Build Coastguard Worker uint32_t attachments[3];
1754*35238bceSAndroid Build Coastguard Worker uint32_t fbo = 0x1234;
1755*35238bceSAndroid Build Coastguard Worker uint32_t texture = 0x1234;
1756*35238bceSAndroid Build Coastguard Worker int maxColorAttachments = 0x1234;
1757*35238bceSAndroid Build Coastguard Worker
1758*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &maxColorAttachments);
1759*35238bceSAndroid Build Coastguard Worker attachments[0] = GL_COLOR_ATTACHMENT0;
1760*35238bceSAndroid Build Coastguard Worker attachments[1] = GL_COLOR_ATTACHMENT0 + maxColorAttachments;
1761*35238bceSAndroid Build Coastguard Worker attachments[2] = GL_DEPTH_STENCIL_ATTACHMENT;
1762*35238bceSAndroid Build Coastguard Worker
1763*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(1, &fbo);
1764*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &texture);
1765*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1766*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, texture);
1767*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1768*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
1769*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
1770*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1771*35238bceSAndroid Build Coastguard Worker
1772*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
1773*35238bceSAndroid Build Coastguard Worker "GL_INVALID_ENUM is generated if target is not GL_FRAMEBUFFER, GL_READ_FRAMEBUFFER or GL_DRAW_FRAMEBUFFER.");
1774*35238bceSAndroid Build Coastguard Worker ctx.glInvalidateFramebuffer(-1, 1, &attachments[0]);
1775*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1776*35238bceSAndroid Build Coastguard Worker ctx.glInvalidateFramebuffer(GL_BACK, 1, &attachments[0]);
1777*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1778*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1779*35238bceSAndroid Build Coastguard Worker
1780*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if attachments contains GL_COLOR_ATTACHMENTm and m is greater "
1781*35238bceSAndroid Build Coastguard Worker "than or equal to the value of GL_MAX_COLOR_ATTACHMENTS.");
1782*35238bceSAndroid Build Coastguard Worker ctx.glInvalidateFramebuffer(GL_FRAMEBUFFER, 1, &attachments[1]);
1783*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1784*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1785*35238bceSAndroid Build Coastguard Worker
1786*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if numAttachments is negative.");
1787*35238bceSAndroid Build Coastguard Worker ctx.glInvalidateFramebuffer(GL_FRAMEBUFFER, -1, &attachments[0]);
1788*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1789*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1790*35238bceSAndroid Build Coastguard Worker
1791*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if the default framebuffer is bound to target and any elements of "
1792*35238bceSAndroid Build Coastguard Worker "attachments are not one of the accepted attachments.");
1793*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1794*35238bceSAndroid Build Coastguard Worker ctx.glInvalidateFramebuffer(GL_FRAMEBUFFER, 1, &attachments[2]);
1795*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1796*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1797*35238bceSAndroid Build Coastguard Worker
1798*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(1, &texture);
1799*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(1, &fbo);
1800*35238bceSAndroid Build Coastguard Worker }
1801*35238bceSAndroid Build Coastguard Worker
invalidate_sub_framebuffer(NegativeTestContext & ctx)1802*35238bceSAndroid Build Coastguard Worker void invalidate_sub_framebuffer(NegativeTestContext &ctx)
1803*35238bceSAndroid Build Coastguard Worker {
1804*35238bceSAndroid Build Coastguard Worker uint32_t attachments[3];
1805*35238bceSAndroid Build Coastguard Worker uint32_t fbo = 0x1234;
1806*35238bceSAndroid Build Coastguard Worker uint32_t texture = 0x1234;
1807*35238bceSAndroid Build Coastguard Worker int maxColorAttachments = 0x1234;
1808*35238bceSAndroid Build Coastguard Worker
1809*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &maxColorAttachments);
1810*35238bceSAndroid Build Coastguard Worker attachments[0] = GL_COLOR_ATTACHMENT0;
1811*35238bceSAndroid Build Coastguard Worker attachments[1] = GL_COLOR_ATTACHMENT0 + maxColorAttachments;
1812*35238bceSAndroid Build Coastguard Worker attachments[2] = GL_DEPTH_STENCIL_ATTACHMENT;
1813*35238bceSAndroid Build Coastguard Worker
1814*35238bceSAndroid Build Coastguard Worker ctx.glGenFramebuffers(1, &fbo);
1815*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(1, &texture);
1816*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
1817*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, texture);
1818*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1819*35238bceSAndroid Build Coastguard Worker ctx.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
1820*35238bceSAndroid Build Coastguard Worker ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER);
1821*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1822*35238bceSAndroid Build Coastguard Worker
1823*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
1824*35238bceSAndroid Build Coastguard Worker "GL_INVALID_ENUM is generated if target is not GL_FRAMEBUFFER, GL_READ_FRAMEBUFFER or GL_DRAW_FRAMEBUFFER.");
1825*35238bceSAndroid Build Coastguard Worker ctx.glInvalidateSubFramebuffer(-1, 1, &attachments[0], 0, 0, 16, 16);
1826*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1827*35238bceSAndroid Build Coastguard Worker ctx.glInvalidateSubFramebuffer(GL_BACK, 1, &attachments[0], 0, 0, 16, 16);
1828*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1829*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1830*35238bceSAndroid Build Coastguard Worker
1831*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if attachments contains GL_COLOR_ATTACHMENTm and m is greater "
1832*35238bceSAndroid Build Coastguard Worker "than or equal to the value of GL_MAX_COLOR_ATTACHMENTS.");
1833*35238bceSAndroid Build Coastguard Worker ctx.glInvalidateSubFramebuffer(GL_FRAMEBUFFER, 1, &attachments[1], 0, 0, 16, 16);
1834*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1835*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1836*35238bceSAndroid Build Coastguard Worker
1837*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if numAttachments, width, or heigh is negative.");
1838*35238bceSAndroid Build Coastguard Worker ctx.glInvalidateSubFramebuffer(GL_FRAMEBUFFER, -1, &attachments[0], 0, 0, 16, 16);
1839*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1840*35238bceSAndroid Build Coastguard Worker ctx.glInvalidateSubFramebuffer(GL_FRAMEBUFFER, -1, &attachments[0], 0, 0, -1, 16);
1841*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1842*35238bceSAndroid Build Coastguard Worker ctx.glInvalidateSubFramebuffer(GL_FRAMEBUFFER, -1, &attachments[0], 0, 0, 16, -1);
1843*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1844*35238bceSAndroid Build Coastguard Worker ctx.glInvalidateSubFramebuffer(GL_FRAMEBUFFER, -1, &attachments[0], 0, 0, -1, -1);
1845*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1846*35238bceSAndroid Build Coastguard Worker ctx.glInvalidateSubFramebuffer(GL_FRAMEBUFFER, 1, &attachments[0], 0, 0, -1, 16);
1847*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1848*35238bceSAndroid Build Coastguard Worker ctx.glInvalidateSubFramebuffer(GL_FRAMEBUFFER, 1, &attachments[0], 0, 0, 16, -1);
1849*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1850*35238bceSAndroid Build Coastguard Worker ctx.glInvalidateSubFramebuffer(GL_FRAMEBUFFER, 1, &attachments[0], 0, 0, -1, -1);
1851*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1852*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1853*35238bceSAndroid Build Coastguard Worker
1854*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if the default framebuffer is bound to target and any elements of "
1855*35238bceSAndroid Build Coastguard Worker "attachments are not one of the accepted attachments.");
1856*35238bceSAndroid Build Coastguard Worker ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1857*35238bceSAndroid Build Coastguard Worker ctx.glInvalidateSubFramebuffer(GL_FRAMEBUFFER, 1, &attachments[2], 0, 0, 16, 16);
1858*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1859*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1860*35238bceSAndroid Build Coastguard Worker
1861*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(1, &texture);
1862*35238bceSAndroid Build Coastguard Worker ctx.glDeleteFramebuffers(1, &fbo);
1863*35238bceSAndroid Build Coastguard Worker }
1864*35238bceSAndroid Build Coastguard Worker
renderbuffer_storage_multisample(NegativeTestContext & ctx)1865*35238bceSAndroid Build Coastguard Worker void renderbuffer_storage_multisample(NegativeTestContext &ctx)
1866*35238bceSAndroid Build Coastguard Worker {
1867*35238bceSAndroid Build Coastguard Worker uint32_t rbo = 0x1234;
1868*35238bceSAndroid Build Coastguard Worker int maxSamplesSupportedRGBA4 = -1;
1869*35238bceSAndroid Build Coastguard Worker int maxSamplesSupportedRGBA8UI = -1;
1870*35238bceSAndroid Build Coastguard Worker GLint maxSize = 0x1234;
1871*35238bceSAndroid Build Coastguard Worker bool isES = glu::isContextTypeES(ctx.getRenderContext().getType());
1872*35238bceSAndroid Build Coastguard Worker
1873*35238bceSAndroid Build Coastguard Worker ctx.glGetInternalformativ(GL_RENDERBUFFER, GL_RGBA4, GL_SAMPLES, 1, &maxSamplesSupportedRGBA4);
1874*35238bceSAndroid Build Coastguard Worker ctx.glGetInternalformativ(GL_RENDERBUFFER, GL_RGBA8UI, GL_SAMPLES, 1, &maxSamplesSupportedRGBA8UI);
1875*35238bceSAndroid Build Coastguard Worker
1876*35238bceSAndroid Build Coastguard Worker ctx.glGenRenderbuffers(1, &rbo);
1877*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo);
1878*35238bceSAndroid Build Coastguard Worker
1879*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER.");
1880*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(-1, 2, GL_RGBA4, 1, 1);
1881*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1882*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_FRAMEBUFFER, 2, GL_RGBA4, 1, 1);
1883*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1884*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1885*35238bceSAndroid Build Coastguard Worker
1886*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if samples is greater than the maximum number of samples "
1887*35238bceSAndroid Build Coastguard Worker "supported for internalformat.");
1888*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, maxSamplesSupportedRGBA4 + 1, GL_RGBA4, 1, 1);
1889*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1890*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1891*35238bceSAndroid Build Coastguard Worker
1892*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if internalformat is not a color-renderable, depth-renderable, or "
1893*35238bceSAndroid Build Coastguard Worker "stencil-renderable format.");
1894*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 2, -1, 1, 1);
1895*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
1896*35238bceSAndroid Build Coastguard Worker
1897*35238bceSAndroid Build Coastguard Worker if (!ctx.isExtensionSupported("GL_EXT_color_buffer_half_float")) // GL_EXT_color_buffer_half_float disables error
1898*35238bceSAndroid Build Coastguard Worker {
1899*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 2, GL_RGB16F, 1, 1);
1900*35238bceSAndroid Build Coastguard Worker ctx.expectError(isES ? GL_INVALID_ENUM : GL_NO_ERROR);
1901*35238bceSAndroid Build Coastguard Worker }
1902*35238bceSAndroid Build Coastguard Worker
1903*35238bceSAndroid Build Coastguard Worker if (!ctx.isExtensionSupported("GL_EXT_render_snorm")) // GL_EXT_render_snorm disables error
1904*35238bceSAndroid Build Coastguard Worker {
1905*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 2, GL_RGBA8_SNORM, 1, 1);
1906*35238bceSAndroid Build Coastguard Worker ctx.expectError(isES ? GL_INVALID_ENUM : GL_NO_ERROR);
1907*35238bceSAndroid Build Coastguard Worker }
1908*35238bceSAndroid Build Coastguard Worker
1909*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1910*35238bceSAndroid Build Coastguard Worker
1911*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION is generated if samples is greater than the maximum number of samples "
1912*35238bceSAndroid Build Coastguard Worker "supported for internalformat. (Unsigned integer format)");
1913*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, maxSamplesSupportedRGBA8UI + 1, GL_RGBA8UI, 1, 1);
1914*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
1915*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1916*35238bceSAndroid Build Coastguard Worker
1917*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if width or height is less than zero.");
1918*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 2, GL_RGBA4, -1, 1);
1919*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1920*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 2, GL_RGBA4, 1, -1);
1921*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1922*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 2, GL_RGBA4, -1, -1);
1923*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1924*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, -1, GL_RGBA4, 1, 1);
1925*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1926*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, -1, GL_RGBA4, -1, 1);
1927*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1928*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, -1, GL_RGBA4, 1, -1);
1929*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1930*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, -1, GL_RGBA4, -1, -1);
1931*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1932*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1933*35238bceSAndroid Build Coastguard Worker
1934*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if width or height is greater than GL_MAX_RENDERBUFFER_SIZE.");
1935*35238bceSAndroid Build Coastguard Worker ctx.glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &maxSize);
1936*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA4, 1, maxSize + 1);
1937*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1938*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA4, maxSize + 1, 1);
1939*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1940*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA4, maxSize + 1, maxSize + 1);
1941*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1942*35238bceSAndroid Build Coastguard Worker ctx.endSection();
1943*35238bceSAndroid Build Coastguard Worker
1944*35238bceSAndroid Build Coastguard Worker ctx.glDeleteRenderbuffers(1, &rbo);
1945*35238bceSAndroid Build Coastguard Worker }
1946*35238bceSAndroid Build Coastguard Worker
copy_image_sub_data(NegativeTestContext & ctx)1947*35238bceSAndroid Build Coastguard Worker void copy_image_sub_data(NegativeTestContext &ctx)
1948*35238bceSAndroid Build Coastguard Worker {
1949*35238bceSAndroid Build Coastguard Worker if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)))
1950*35238bceSAndroid Build Coastguard Worker {
1951*35238bceSAndroid Build Coastguard Worker uint32_t texture[5];
1952*35238bceSAndroid Build Coastguard Worker uint32_t rbo = 0x1234;
1953*35238bceSAndroid Build Coastguard Worker
1954*35238bceSAndroid Build Coastguard Worker ctx.glGenTextures(5, texture);
1955*35238bceSAndroid Build Coastguard Worker ctx.glGenRenderbuffers(1, &rbo);
1956*35238bceSAndroid Build Coastguard Worker ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo);
1957*35238bceSAndroid Build Coastguard Worker
1958*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, texture[0]);
1959*35238bceSAndroid Build Coastguard Worker ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1960*35238bceSAndroid Build Coastguard Worker ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1961*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1962*35238bceSAndroid Build Coastguard Worker ctx.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 32, 32);
1963*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, texture[1]);
1964*35238bceSAndroid Build Coastguard Worker ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1965*35238bceSAndroid Build Coastguard Worker ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1966*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1967*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1968*35238bceSAndroid Build Coastguard Worker
1969*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_3D, texture[2]);
1970*35238bceSAndroid Build Coastguard Worker ctx.glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1971*35238bceSAndroid Build Coastguard Worker ctx.glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1972*35238bceSAndroid Build Coastguard Worker ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA8, 32, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1973*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1974*35238bceSAndroid Build Coastguard Worker
1975*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_3D, texture[3]);
1976*35238bceSAndroid Build Coastguard Worker ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA8, 32, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1977*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1978*35238bceSAndroid Build Coastguard Worker
1979*35238bceSAndroid Build Coastguard Worker ctx.glBindTexture(GL_TEXTURE_2D, texture[4]);
1980*35238bceSAndroid Build Coastguard Worker ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1981*35238bceSAndroid Build Coastguard Worker ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1982*35238bceSAndroid Build Coastguard Worker ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 32, 32, 0, GL_RGBA, GL_FLOAT, NULL);
1983*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_NO_ERROR);
1984*35238bceSAndroid Build Coastguard Worker
1985*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if srcWidth, srcHeight, or srcDepth is negative.");
1986*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, -1, 1, 1);
1987*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1988*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 1, -1, 1);
1989*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1990*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 1, 1, -1);
1991*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1992*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, -1, -1, 1);
1993*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1994*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, -1, 1, -1);
1995*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1996*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 1, -1, -1);
1997*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
1998*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, -1, -1,
1999*35238bceSAndroid Build Coastguard Worker -1);
2000*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
2001*35238bceSAndroid Build Coastguard Worker ctx.endSection();
2002*35238bceSAndroid Build Coastguard Worker
2003*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if srcLevel and dstLevel are not valid levels for the "
2004*35238bceSAndroid Build Coastguard Worker "corresponding images.");
2005*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, 1, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
2006*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
2007*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 1, 0, 0, 0, 0, 0, 1);
2008*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
2009*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, 1, 0, 0, 0, texture[1], GL_TEXTURE_2D, 1, 0, 0, 0, 0, 0, 1);
2010*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
2011*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, -1, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
2012*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
2013*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, -1, 0, 0, 0, 0, 0, 1);
2014*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
2015*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, -1, 0, 0, 0, texture[1], GL_TEXTURE_2D, -1, 0, 0, 0, 0, 0, 1);
2016*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
2017*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(rbo, GL_RENDERBUFFER, -1, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
2018*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
2019*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(rbo, GL_RENDERBUFFER, 1, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
2020*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
2021*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, rbo, GL_RENDERBUFFER, -1, 0, 0, 0, 0, 0, 1);
2022*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
2023*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, rbo, GL_RENDERBUFFER, 1, 0, 0, 0, 0, 0, 1);
2024*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
2025*35238bceSAndroid Build Coastguard Worker ctx.endSection();
2026*35238bceSAndroid Build Coastguard Worker
2027*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_ENUM is generated if either target does not match the type of the object.");
2028*35238bceSAndroid Build Coastguard Worker // \note: This could be either:
2029*35238bceSAndroid Build Coastguard Worker // 1. GL_INVALID_ENUM is generated if either target does not match the type of the object.
2030*35238bceSAndroid Build Coastguard Worker // 2. GL_INVALID_VALUE is generated if either name does not correspond to a valid renderbuffer or texture object according to the corresponding target parameter.
2031*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, 1);
2032*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
2033*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[2], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
2034*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
2035*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_3D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
2036*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
2037*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[2], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
2038*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_ENUM);
2039*35238bceSAndroid Build Coastguard Worker ctx.endSection();
2040*35238bceSAndroid Build Coastguard Worker
2041*35238bceSAndroid Build Coastguard Worker ctx.beginSection(
2042*35238bceSAndroid Build Coastguard Worker "GL_INVALID_OPERATION is generated if either object is a texture and the texture is not complete.");
2043*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[3], GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, 1);
2044*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
2045*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[3], GL_TEXTURE_3D, 0, 0, 0, 0, texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
2046*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
2047*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[3], GL_TEXTURE_3D, 0, 0, 0, 0, texture[3], GL_TEXTURE_3D, 0, 0, 0, 0, 0, 0, 1);
2048*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
2049*35238bceSAndroid Build Coastguard Worker ctx.endSection();
2050*35238bceSAndroid Build Coastguard Worker
2051*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_VALUE is generated if the dimensions of either subregion exceeds the boundaries "
2052*35238bceSAndroid Build Coastguard Worker "of the corresponding image object.");
2053*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 33, 0, 1);
2054*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
2055*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[1], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 33, 1);
2056*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_VALUE);
2057*35238bceSAndroid Build Coastguard Worker ctx.endSection();
2058*35238bceSAndroid Build Coastguard Worker
2059*35238bceSAndroid Build Coastguard Worker ctx.beginSection("GL_INVALID_OPERATION error is generated if the source and destination internal formats are "
2060*35238bceSAndroid Build Coastguard Worker "not compatible.");
2061*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, texture[4], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
2062*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
2063*35238bceSAndroid Build Coastguard Worker ctx.glCopyImageSubData(texture[4], GL_TEXTURE_2D, 0, 0, 0, 0, texture[0], GL_TEXTURE_2D, 0, 0, 0, 0, 0, 0, 1);
2064*35238bceSAndroid Build Coastguard Worker ctx.expectError(GL_INVALID_OPERATION);
2065*35238bceSAndroid Build Coastguard Worker ctx.endSection();
2066*35238bceSAndroid Build Coastguard Worker
2067*35238bceSAndroid Build Coastguard Worker ctx.glDeleteTextures(5, texture);
2068*35238bceSAndroid Build Coastguard Worker ctx.glDeleteRenderbuffers(1, &rbo);
2069*35238bceSAndroid Build Coastguard Worker }
2070*35238bceSAndroid Build Coastguard Worker }
2071*35238bceSAndroid Build Coastguard Worker
getNegativeBufferApiTestFunctions()2072*35238bceSAndroid Build Coastguard Worker std::vector<FunctionContainer> getNegativeBufferApiTestFunctions()
2073*35238bceSAndroid Build Coastguard Worker {
2074*35238bceSAndroid Build Coastguard Worker const FunctionContainer funcs[] = {
2075*35238bceSAndroid Build Coastguard Worker {bind_buffer, "bind_buffer", "Invalid glBindBuffer() usage"},
2076*35238bceSAndroid Build Coastguard Worker {delete_buffers, "delete_buffers", "Invalid glDeleteBuffers() usage"},
2077*35238bceSAndroid Build Coastguard Worker {gen_buffers, "gen_buffers", "Invalid glGenBuffers() usage"},
2078*35238bceSAndroid Build Coastguard Worker {buffer_data, "buffer_data", "Invalid glBufferData() usage"},
2079*35238bceSAndroid Build Coastguard Worker {buffer_sub_data, "buffer_sub_data", "Invalid glBufferSubData() usage"},
2080*35238bceSAndroid Build Coastguard Worker {buffer_sub_data_size_offset, "buffer_sub_data_size_offset", "Invalid glBufferSubData() usage"},
2081*35238bceSAndroid Build Coastguard Worker {clear, "clear", "Invalid glClear() usage"},
2082*35238bceSAndroid Build Coastguard Worker {read_pixels, "read_pixels", "Invalid glReadPixels() usage"},
2083*35238bceSAndroid Build Coastguard Worker {readn_pixels, "readn_pixels", "Invalid glReadPixels() usage"},
2084*35238bceSAndroid Build Coastguard Worker {read_pixels_format_mismatch, "read_pixels_format_mismatch", "Invalid glReadPixels() usage"},
2085*35238bceSAndroid Build Coastguard Worker {read_pixels_fbo_format_mismatch, "read_pixels_fbo_format_mismatch", "Invalid glReadPixels() usage"},
2086*35238bceSAndroid Build Coastguard Worker {bind_buffer_range, "bind_buffer_range", "Invalid glBindBufferRange() usage"},
2087*35238bceSAndroid Build Coastguard Worker {bind_buffer_base, "bind_buffer_base", "Invalid glBindBufferBase() usage"},
2088*35238bceSAndroid Build Coastguard Worker {clear_bufferiv, "clear_bufferiv", "Invalid glClearBufferiv() usage"},
2089*35238bceSAndroid Build Coastguard Worker {clear_bufferuiv, "clear_bufferuiv", "Invalid glClearBufferuiv() usage"},
2090*35238bceSAndroid Build Coastguard Worker {clear_bufferfv, "clear_bufferfv", "Invalid glClearBufferfv() usage"},
2091*35238bceSAndroid Build Coastguard Worker {clear_bufferfi, "clear_bufferfi", "Invalid glClearBufferfi() usage"},
2092*35238bceSAndroid Build Coastguard Worker {copy_buffer_sub_data, "copy_buffer_sub_data", "Invalid glCopyBufferSubData() usage"},
2093*35238bceSAndroid Build Coastguard Worker {draw_buffers, "draw_buffers", "Invalid glDrawBuffers() usage"},
2094*35238bceSAndroid Build Coastguard Worker {flush_mapped_buffer_range, "flush_mapped_buffer_range", "Invalid glFlushMappedBufferRange() usage"},
2095*35238bceSAndroid Build Coastguard Worker {map_buffer_range, "map_buffer_range", "Invalid glMapBufferRange() usage"},
2096*35238bceSAndroid Build Coastguard Worker {read_buffer, "read_buffer", "Invalid glReadBuffer() usage"},
2097*35238bceSAndroid Build Coastguard Worker {unmap_buffer, "unmap_buffer", "Invalid glUnmapBuffer() usage"},
2098*35238bceSAndroid Build Coastguard Worker {bind_framebuffer, "bind_framebuffer", "Invalid glBindFramebuffer() usage"},
2099*35238bceSAndroid Build Coastguard Worker {bind_renderbuffer, "bind_renderbuffer", "Invalid glBindRenderbuffer() usage"},
2100*35238bceSAndroid Build Coastguard Worker {check_framebuffer_status, "check_framebuffer_status", "Invalid glCheckFramebufferStatus() usage"},
2101*35238bceSAndroid Build Coastguard Worker {gen_framebuffers, "gen_framebuffers", "Invalid glGenFramebuffers() usage"},
2102*35238bceSAndroid Build Coastguard Worker {gen_renderbuffers, "gen_renderbuffers", "Invalid glGenRenderbuffers() usage"},
2103*35238bceSAndroid Build Coastguard Worker {delete_framebuffers, "delete_framebuffers", "Invalid glDeleteFramebuffers() usage"},
2104*35238bceSAndroid Build Coastguard Worker {delete_renderbuffers, "delete_renderbuffers", "Invalid glDeleteRenderbuffers() usage"},
2105*35238bceSAndroid Build Coastguard Worker {framebuffer_renderbuffer, "framebuffer_renderbuffer", "Invalid glFramebufferRenderbuffer() usage"},
2106*35238bceSAndroid Build Coastguard Worker {framebuffer_texture, "framebuffer_texture", "Invalid glFramebufferTexture() usage"},
2107*35238bceSAndroid Build Coastguard Worker {framebuffer_texture2d, "framebuffer_texture2d", "Invalid glFramebufferTexture2D() usage"},
2108*35238bceSAndroid Build Coastguard Worker {renderbuffer_storage, "renderbuffer_storage", "Invalid glRenderbufferStorage() usage"},
2109*35238bceSAndroid Build Coastguard Worker {blit_framebuffer, "blit_framebuffer", "Invalid glBlitFramebuffer() usage"},
2110*35238bceSAndroid Build Coastguard Worker {blit_framebuffer_multisample, "blit_framebuffer_multisample", "Invalid glBlitFramebuffer() usage"},
2111*35238bceSAndroid Build Coastguard Worker {framebuffer_texture_layer, "framebuffer_texture_layer", "Invalid glFramebufferTextureLayer() usage"},
2112*35238bceSAndroid Build Coastguard Worker {invalidate_framebuffer, "invalidate_framebuffer", "Invalid glInvalidateFramebuffer() usage"},
2113*35238bceSAndroid Build Coastguard Worker {invalidate_sub_framebuffer, "invalidate_sub_framebuffer", "Invalid glInvalidateSubFramebuffer() usage"},
2114*35238bceSAndroid Build Coastguard Worker {renderbuffer_storage_multisample, "renderbuffer_storage_multisample",
2115*35238bceSAndroid Build Coastguard Worker "Invalid glRenderbufferStorageMultisample() usage"},
2116*35238bceSAndroid Build Coastguard Worker {copy_image_sub_data, "copy_image_sub_data", "Invalid glCopyImageSubData() usage"},
2117*35238bceSAndroid Build Coastguard Worker };
2118*35238bceSAndroid Build Coastguard Worker
2119*35238bceSAndroid Build Coastguard Worker return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
2120*35238bceSAndroid Build Coastguard Worker }
2121*35238bceSAndroid Build Coastguard Worker
2122*35238bceSAndroid Build Coastguard Worker } // namespace NegativeTestShared
2123*35238bceSAndroid Build Coastguard Worker } // namespace Functional
2124*35238bceSAndroid Build Coastguard Worker } // namespace gles31
2125*35238bceSAndroid Build Coastguard Worker } // namespace deqp
2126