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