xref: /aosp_15_r20/external/angle/src/libANGLE/validationES31.cpp (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker //
2*8975f5c5SAndroid Build Coastguard Worker // Copyright 2016 The ANGLE Project Authors. All rights reserved.
3*8975f5c5SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
4*8975f5c5SAndroid Build Coastguard Worker // found in the LICENSE file.
5*8975f5c5SAndroid Build Coastguard Worker //
6*8975f5c5SAndroid Build Coastguard Worker 
7*8975f5c5SAndroid Build Coastguard Worker // validationES31.cpp: Validation functions for OpenGL ES 3.1 entry point parameters
8*8975f5c5SAndroid Build Coastguard Worker 
9*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/validationES31_autogen.h"
10*8975f5c5SAndroid Build Coastguard Worker 
11*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/Context.h"
12*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/ErrorStrings.h"
13*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/Framebuffer.h"
14*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/ProgramExecutable.h"
15*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/VertexArray.h"
16*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/validationES.h"
17*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/validationES2_autogen.h"
18*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/validationES31.h"
19*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/validationES3_autogen.h"
20*8975f5c5SAndroid Build Coastguard Worker 
21*8975f5c5SAndroid Build Coastguard Worker #include "common/utilities.h"
22*8975f5c5SAndroid Build Coastguard Worker 
23*8975f5c5SAndroid Build Coastguard Worker using namespace angle;
24*8975f5c5SAndroid Build Coastguard Worker 
25*8975f5c5SAndroid Build Coastguard Worker namespace gl
26*8975f5c5SAndroid Build Coastguard Worker {
27*8975f5c5SAndroid Build Coastguard Worker using namespace err;
28*8975f5c5SAndroid Build Coastguard Worker 
29*8975f5c5SAndroid Build Coastguard Worker namespace
30*8975f5c5SAndroid Build Coastguard Worker {
31*8975f5c5SAndroid Build Coastguard Worker 
ValidateNamedProgramInterface(GLenum programInterface)32*8975f5c5SAndroid Build Coastguard Worker bool ValidateNamedProgramInterface(GLenum programInterface)
33*8975f5c5SAndroid Build Coastguard Worker {
34*8975f5c5SAndroid Build Coastguard Worker     switch (programInterface)
35*8975f5c5SAndroid Build Coastguard Worker     {
36*8975f5c5SAndroid Build Coastguard Worker         case GL_UNIFORM:
37*8975f5c5SAndroid Build Coastguard Worker         case GL_UNIFORM_BLOCK:
38*8975f5c5SAndroid Build Coastguard Worker         case GL_PROGRAM_INPUT:
39*8975f5c5SAndroid Build Coastguard Worker         case GL_PROGRAM_OUTPUT:
40*8975f5c5SAndroid Build Coastguard Worker         case GL_TRANSFORM_FEEDBACK_VARYING:
41*8975f5c5SAndroid Build Coastguard Worker         case GL_BUFFER_VARIABLE:
42*8975f5c5SAndroid Build Coastguard Worker         case GL_SHADER_STORAGE_BLOCK:
43*8975f5c5SAndroid Build Coastguard Worker             return true;
44*8975f5c5SAndroid Build Coastguard Worker         default:
45*8975f5c5SAndroid Build Coastguard Worker             return false;
46*8975f5c5SAndroid Build Coastguard Worker     }
47*8975f5c5SAndroid Build Coastguard Worker }
48*8975f5c5SAndroid Build Coastguard Worker 
ValidateLocationProgramInterface(GLenum programInterface)49*8975f5c5SAndroid Build Coastguard Worker bool ValidateLocationProgramInterface(GLenum programInterface)
50*8975f5c5SAndroid Build Coastguard Worker {
51*8975f5c5SAndroid Build Coastguard Worker     switch (programInterface)
52*8975f5c5SAndroid Build Coastguard Worker     {
53*8975f5c5SAndroid Build Coastguard Worker         case GL_UNIFORM:
54*8975f5c5SAndroid Build Coastguard Worker         case GL_PROGRAM_INPUT:
55*8975f5c5SAndroid Build Coastguard Worker         case GL_PROGRAM_OUTPUT:
56*8975f5c5SAndroid Build Coastguard Worker             return true;
57*8975f5c5SAndroid Build Coastguard Worker         default:
58*8975f5c5SAndroid Build Coastguard Worker             return false;
59*8975f5c5SAndroid Build Coastguard Worker     }
60*8975f5c5SAndroid Build Coastguard Worker }
61*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramInterface(GLenum programInterface)62*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramInterface(GLenum programInterface)
63*8975f5c5SAndroid Build Coastguard Worker {
64*8975f5c5SAndroid Build Coastguard Worker     return (programInterface == GL_ATOMIC_COUNTER_BUFFER ||
65*8975f5c5SAndroid Build Coastguard Worker             ValidateNamedProgramInterface(programInterface));
66*8975f5c5SAndroid Build Coastguard Worker }
67*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramResourceProperty(const Context * context,angle::EntryPoint entryPoint,GLenum prop)68*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramResourceProperty(const Context *context,
69*8975f5c5SAndroid Build Coastguard Worker                                      angle::EntryPoint entryPoint,
70*8975f5c5SAndroid Build Coastguard Worker                                      GLenum prop)
71*8975f5c5SAndroid Build Coastguard Worker {
72*8975f5c5SAndroid Build Coastguard Worker     ASSERT(context);
73*8975f5c5SAndroid Build Coastguard Worker     switch (prop)
74*8975f5c5SAndroid Build Coastguard Worker     {
75*8975f5c5SAndroid Build Coastguard Worker         case GL_ACTIVE_VARIABLES:
76*8975f5c5SAndroid Build Coastguard Worker         case GL_BUFFER_BINDING:
77*8975f5c5SAndroid Build Coastguard Worker         case GL_NUM_ACTIVE_VARIABLES:
78*8975f5c5SAndroid Build Coastguard Worker 
79*8975f5c5SAndroid Build Coastguard Worker         case GL_ARRAY_SIZE:
80*8975f5c5SAndroid Build Coastguard Worker 
81*8975f5c5SAndroid Build Coastguard Worker         case GL_ARRAY_STRIDE:
82*8975f5c5SAndroid Build Coastguard Worker         case GL_BLOCK_INDEX:
83*8975f5c5SAndroid Build Coastguard Worker         case GL_IS_ROW_MAJOR:
84*8975f5c5SAndroid Build Coastguard Worker         case GL_MATRIX_STRIDE:
85*8975f5c5SAndroid Build Coastguard Worker 
86*8975f5c5SAndroid Build Coastguard Worker         case GL_ATOMIC_COUNTER_BUFFER_INDEX:
87*8975f5c5SAndroid Build Coastguard Worker 
88*8975f5c5SAndroid Build Coastguard Worker         case GL_BUFFER_DATA_SIZE:
89*8975f5c5SAndroid Build Coastguard Worker 
90*8975f5c5SAndroid Build Coastguard Worker         case GL_LOCATION:
91*8975f5c5SAndroid Build Coastguard Worker 
92*8975f5c5SAndroid Build Coastguard Worker         case GL_NAME_LENGTH:
93*8975f5c5SAndroid Build Coastguard Worker 
94*8975f5c5SAndroid Build Coastguard Worker         case GL_OFFSET:
95*8975f5c5SAndroid Build Coastguard Worker 
96*8975f5c5SAndroid Build Coastguard Worker         case GL_REFERENCED_BY_VERTEX_SHADER:
97*8975f5c5SAndroid Build Coastguard Worker         case GL_REFERENCED_BY_FRAGMENT_SHADER:
98*8975f5c5SAndroid Build Coastguard Worker         case GL_REFERENCED_BY_COMPUTE_SHADER:
99*8975f5c5SAndroid Build Coastguard Worker 
100*8975f5c5SAndroid Build Coastguard Worker         case GL_TOP_LEVEL_ARRAY_SIZE:
101*8975f5c5SAndroid Build Coastguard Worker         case GL_TOP_LEVEL_ARRAY_STRIDE:
102*8975f5c5SAndroid Build Coastguard Worker 
103*8975f5c5SAndroid Build Coastguard Worker         case GL_TYPE:
104*8975f5c5SAndroid Build Coastguard Worker             return true;
105*8975f5c5SAndroid Build Coastguard Worker 
106*8975f5c5SAndroid Build Coastguard Worker         case GL_REFERENCED_BY_GEOMETRY_SHADER_EXT:
107*8975f5c5SAndroid Build Coastguard Worker             return context->getExtensions().geometryShaderAny() ||
108*8975f5c5SAndroid Build Coastguard Worker                    context->getClientVersion() >= ES_3_2;
109*8975f5c5SAndroid Build Coastguard Worker 
110*8975f5c5SAndroid Build Coastguard Worker         case GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT:
111*8975f5c5SAndroid Build Coastguard Worker         case GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT:
112*8975f5c5SAndroid Build Coastguard Worker         case GL_IS_PER_PATCH_EXT:
113*8975f5c5SAndroid Build Coastguard Worker             return context->getExtensions().tessellationShaderAny() ||
114*8975f5c5SAndroid Build Coastguard Worker                    context->getClientVersion() >= ES_3_2;
115*8975f5c5SAndroid Build Coastguard Worker 
116*8975f5c5SAndroid Build Coastguard Worker         case GL_LOCATION_INDEX_EXT:
117*8975f5c5SAndroid Build Coastguard Worker             return context->getExtensions().blendFuncExtendedEXT;
118*8975f5c5SAndroid Build Coastguard Worker 
119*8975f5c5SAndroid Build Coastguard Worker         default:
120*8975f5c5SAndroid Build Coastguard Worker             return false;
121*8975f5c5SAndroid Build Coastguard Worker     }
122*8975f5c5SAndroid Build Coastguard Worker }
123*8975f5c5SAndroid Build Coastguard Worker 
124*8975f5c5SAndroid Build Coastguard Worker // GLES 3.10 spec: Page 82 -- Table 7.2
ValidateProgramResourcePropertyByInterface(GLenum prop,GLenum programInterface)125*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramResourcePropertyByInterface(GLenum prop, GLenum programInterface)
126*8975f5c5SAndroid Build Coastguard Worker {
127*8975f5c5SAndroid Build Coastguard Worker     switch (prop)
128*8975f5c5SAndroid Build Coastguard Worker     {
129*8975f5c5SAndroid Build Coastguard Worker         case GL_ACTIVE_VARIABLES:
130*8975f5c5SAndroid Build Coastguard Worker         case GL_BUFFER_BINDING:
131*8975f5c5SAndroid Build Coastguard Worker         case GL_NUM_ACTIVE_VARIABLES:
132*8975f5c5SAndroid Build Coastguard Worker         {
133*8975f5c5SAndroid Build Coastguard Worker             switch (programInterface)
134*8975f5c5SAndroid Build Coastguard Worker             {
135*8975f5c5SAndroid Build Coastguard Worker                 case GL_ATOMIC_COUNTER_BUFFER:
136*8975f5c5SAndroid Build Coastguard Worker                 case GL_SHADER_STORAGE_BLOCK:
137*8975f5c5SAndroid Build Coastguard Worker                 case GL_UNIFORM_BLOCK:
138*8975f5c5SAndroid Build Coastguard Worker                     return true;
139*8975f5c5SAndroid Build Coastguard Worker                 default:
140*8975f5c5SAndroid Build Coastguard Worker                     return false;
141*8975f5c5SAndroid Build Coastguard Worker             }
142*8975f5c5SAndroid Build Coastguard Worker         }
143*8975f5c5SAndroid Build Coastguard Worker 
144*8975f5c5SAndroid Build Coastguard Worker         case GL_ARRAY_SIZE:
145*8975f5c5SAndroid Build Coastguard Worker         {
146*8975f5c5SAndroid Build Coastguard Worker             switch (programInterface)
147*8975f5c5SAndroid Build Coastguard Worker             {
148*8975f5c5SAndroid Build Coastguard Worker                 case GL_BUFFER_VARIABLE:
149*8975f5c5SAndroid Build Coastguard Worker                 case GL_PROGRAM_INPUT:
150*8975f5c5SAndroid Build Coastguard Worker                 case GL_PROGRAM_OUTPUT:
151*8975f5c5SAndroid Build Coastguard Worker                 case GL_TRANSFORM_FEEDBACK_VARYING:
152*8975f5c5SAndroid Build Coastguard Worker                 case GL_UNIFORM:
153*8975f5c5SAndroid Build Coastguard Worker                     return true;
154*8975f5c5SAndroid Build Coastguard Worker                 default:
155*8975f5c5SAndroid Build Coastguard Worker                     return false;
156*8975f5c5SAndroid Build Coastguard Worker             }
157*8975f5c5SAndroid Build Coastguard Worker         }
158*8975f5c5SAndroid Build Coastguard Worker 
159*8975f5c5SAndroid Build Coastguard Worker         case GL_ARRAY_STRIDE:
160*8975f5c5SAndroid Build Coastguard Worker         case GL_BLOCK_INDEX:
161*8975f5c5SAndroid Build Coastguard Worker         case GL_IS_ROW_MAJOR:
162*8975f5c5SAndroid Build Coastguard Worker         case GL_MATRIX_STRIDE:
163*8975f5c5SAndroid Build Coastguard Worker         {
164*8975f5c5SAndroid Build Coastguard Worker             switch (programInterface)
165*8975f5c5SAndroid Build Coastguard Worker             {
166*8975f5c5SAndroid Build Coastguard Worker                 case GL_BUFFER_VARIABLE:
167*8975f5c5SAndroid Build Coastguard Worker                 case GL_UNIFORM:
168*8975f5c5SAndroid Build Coastguard Worker                     return true;
169*8975f5c5SAndroid Build Coastguard Worker                 default:
170*8975f5c5SAndroid Build Coastguard Worker                     return false;
171*8975f5c5SAndroid Build Coastguard Worker             }
172*8975f5c5SAndroid Build Coastguard Worker         }
173*8975f5c5SAndroid Build Coastguard Worker 
174*8975f5c5SAndroid Build Coastguard Worker         case GL_ATOMIC_COUNTER_BUFFER_INDEX:
175*8975f5c5SAndroid Build Coastguard Worker         {
176*8975f5c5SAndroid Build Coastguard Worker             if (programInterface == GL_UNIFORM)
177*8975f5c5SAndroid Build Coastguard Worker             {
178*8975f5c5SAndroid Build Coastguard Worker                 return true;
179*8975f5c5SAndroid Build Coastguard Worker             }
180*8975f5c5SAndroid Build Coastguard Worker             return false;
181*8975f5c5SAndroid Build Coastguard Worker         }
182*8975f5c5SAndroid Build Coastguard Worker 
183*8975f5c5SAndroid Build Coastguard Worker         case GL_BUFFER_DATA_SIZE:
184*8975f5c5SAndroid Build Coastguard Worker         {
185*8975f5c5SAndroid Build Coastguard Worker             switch (programInterface)
186*8975f5c5SAndroid Build Coastguard Worker             {
187*8975f5c5SAndroid Build Coastguard Worker                 case GL_ATOMIC_COUNTER_BUFFER:
188*8975f5c5SAndroid Build Coastguard Worker                 case GL_SHADER_STORAGE_BLOCK:
189*8975f5c5SAndroid Build Coastguard Worker                 case GL_UNIFORM_BLOCK:
190*8975f5c5SAndroid Build Coastguard Worker                     return true;
191*8975f5c5SAndroid Build Coastguard Worker                 default:
192*8975f5c5SAndroid Build Coastguard Worker                     return false;
193*8975f5c5SAndroid Build Coastguard Worker             }
194*8975f5c5SAndroid Build Coastguard Worker         }
195*8975f5c5SAndroid Build Coastguard Worker 
196*8975f5c5SAndroid Build Coastguard Worker         case GL_LOCATION:
197*8975f5c5SAndroid Build Coastguard Worker         {
198*8975f5c5SAndroid Build Coastguard Worker             return ValidateLocationProgramInterface(programInterface);
199*8975f5c5SAndroid Build Coastguard Worker         }
200*8975f5c5SAndroid Build Coastguard Worker 
201*8975f5c5SAndroid Build Coastguard Worker         case GL_LOCATION_INDEX_EXT:
202*8975f5c5SAndroid Build Coastguard Worker         {
203*8975f5c5SAndroid Build Coastguard Worker             // EXT_blend_func_extended
204*8975f5c5SAndroid Build Coastguard Worker             return (programInterface == GL_PROGRAM_OUTPUT);
205*8975f5c5SAndroid Build Coastguard Worker         }
206*8975f5c5SAndroid Build Coastguard Worker 
207*8975f5c5SAndroid Build Coastguard Worker         case GL_NAME_LENGTH:
208*8975f5c5SAndroid Build Coastguard Worker         {
209*8975f5c5SAndroid Build Coastguard Worker             return ValidateNamedProgramInterface(programInterface);
210*8975f5c5SAndroid Build Coastguard Worker         }
211*8975f5c5SAndroid Build Coastguard Worker 
212*8975f5c5SAndroid Build Coastguard Worker         case GL_OFFSET:
213*8975f5c5SAndroid Build Coastguard Worker         {
214*8975f5c5SAndroid Build Coastguard Worker             switch (programInterface)
215*8975f5c5SAndroid Build Coastguard Worker             {
216*8975f5c5SAndroid Build Coastguard Worker                 case GL_BUFFER_VARIABLE:
217*8975f5c5SAndroid Build Coastguard Worker                 case GL_UNIFORM:
218*8975f5c5SAndroid Build Coastguard Worker                     return true;
219*8975f5c5SAndroid Build Coastguard Worker                 default:
220*8975f5c5SAndroid Build Coastguard Worker                     return false;
221*8975f5c5SAndroid Build Coastguard Worker             }
222*8975f5c5SAndroid Build Coastguard Worker         }
223*8975f5c5SAndroid Build Coastguard Worker 
224*8975f5c5SAndroid Build Coastguard Worker         case GL_REFERENCED_BY_VERTEX_SHADER:
225*8975f5c5SAndroid Build Coastguard Worker         case GL_REFERENCED_BY_FRAGMENT_SHADER:
226*8975f5c5SAndroid Build Coastguard Worker         case GL_REFERENCED_BY_COMPUTE_SHADER:
227*8975f5c5SAndroid Build Coastguard Worker         case GL_REFERENCED_BY_GEOMETRY_SHADER_EXT:
228*8975f5c5SAndroid Build Coastguard Worker         case GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT:
229*8975f5c5SAndroid Build Coastguard Worker         case GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT:
230*8975f5c5SAndroid Build Coastguard Worker         {
231*8975f5c5SAndroid Build Coastguard Worker             switch (programInterface)
232*8975f5c5SAndroid Build Coastguard Worker             {
233*8975f5c5SAndroid Build Coastguard Worker                 case GL_ATOMIC_COUNTER_BUFFER:
234*8975f5c5SAndroid Build Coastguard Worker                 case GL_BUFFER_VARIABLE:
235*8975f5c5SAndroid Build Coastguard Worker                 case GL_PROGRAM_INPUT:
236*8975f5c5SAndroid Build Coastguard Worker                 case GL_PROGRAM_OUTPUT:
237*8975f5c5SAndroid Build Coastguard Worker                 case GL_SHADER_STORAGE_BLOCK:
238*8975f5c5SAndroid Build Coastguard Worker                 case GL_UNIFORM:
239*8975f5c5SAndroid Build Coastguard Worker                 case GL_UNIFORM_BLOCK:
240*8975f5c5SAndroid Build Coastguard Worker                     return true;
241*8975f5c5SAndroid Build Coastguard Worker                 default:
242*8975f5c5SAndroid Build Coastguard Worker                     return false;
243*8975f5c5SAndroid Build Coastguard Worker             }
244*8975f5c5SAndroid Build Coastguard Worker         }
245*8975f5c5SAndroid Build Coastguard Worker 
246*8975f5c5SAndroid Build Coastguard Worker         case GL_TOP_LEVEL_ARRAY_SIZE:
247*8975f5c5SAndroid Build Coastguard Worker         case GL_TOP_LEVEL_ARRAY_STRIDE:
248*8975f5c5SAndroid Build Coastguard Worker         {
249*8975f5c5SAndroid Build Coastguard Worker             if (programInterface == GL_BUFFER_VARIABLE)
250*8975f5c5SAndroid Build Coastguard Worker             {
251*8975f5c5SAndroid Build Coastguard Worker                 return true;
252*8975f5c5SAndroid Build Coastguard Worker             }
253*8975f5c5SAndroid Build Coastguard Worker             return false;
254*8975f5c5SAndroid Build Coastguard Worker         }
255*8975f5c5SAndroid Build Coastguard Worker 
256*8975f5c5SAndroid Build Coastguard Worker         case GL_TYPE:
257*8975f5c5SAndroid Build Coastguard Worker         {
258*8975f5c5SAndroid Build Coastguard Worker             switch (programInterface)
259*8975f5c5SAndroid Build Coastguard Worker             {
260*8975f5c5SAndroid Build Coastguard Worker                 case GL_BUFFER_VARIABLE:
261*8975f5c5SAndroid Build Coastguard Worker                 case GL_PROGRAM_INPUT:
262*8975f5c5SAndroid Build Coastguard Worker                 case GL_PROGRAM_OUTPUT:
263*8975f5c5SAndroid Build Coastguard Worker                 case GL_TRANSFORM_FEEDBACK_VARYING:
264*8975f5c5SAndroid Build Coastguard Worker                 case GL_UNIFORM:
265*8975f5c5SAndroid Build Coastguard Worker                     return true;
266*8975f5c5SAndroid Build Coastguard Worker                 default:
267*8975f5c5SAndroid Build Coastguard Worker                     return false;
268*8975f5c5SAndroid Build Coastguard Worker             }
269*8975f5c5SAndroid Build Coastguard Worker         }
270*8975f5c5SAndroid Build Coastguard Worker         case GL_IS_PER_PATCH_EXT:
271*8975f5c5SAndroid Build Coastguard Worker             switch (programInterface)
272*8975f5c5SAndroid Build Coastguard Worker             {
273*8975f5c5SAndroid Build Coastguard Worker                 case GL_PROGRAM_INPUT:
274*8975f5c5SAndroid Build Coastguard Worker                 case GL_PROGRAM_OUTPUT:
275*8975f5c5SAndroid Build Coastguard Worker                     return true;
276*8975f5c5SAndroid Build Coastguard Worker             }
277*8975f5c5SAndroid Build Coastguard Worker             return false;
278*8975f5c5SAndroid Build Coastguard Worker 
279*8975f5c5SAndroid Build Coastguard Worker         default:
280*8975f5c5SAndroid Build Coastguard Worker             return false;
281*8975f5c5SAndroid Build Coastguard Worker     }
282*8975f5c5SAndroid Build Coastguard Worker }
283*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramResourceIndex(const Program * programObject,GLenum programInterface,GLuint index)284*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramResourceIndex(const Program *programObject,
285*8975f5c5SAndroid Build Coastguard Worker                                   GLenum programInterface,
286*8975f5c5SAndroid Build Coastguard Worker                                   GLuint index)
287*8975f5c5SAndroid Build Coastguard Worker {
288*8975f5c5SAndroid Build Coastguard Worker     const ProgramExecutable &executable = programObject->getExecutable();
289*8975f5c5SAndroid Build Coastguard Worker     switch (programInterface)
290*8975f5c5SAndroid Build Coastguard Worker     {
291*8975f5c5SAndroid Build Coastguard Worker         case GL_PROGRAM_INPUT:
292*8975f5c5SAndroid Build Coastguard Worker             return index < executable.getProgramInputs().size();
293*8975f5c5SAndroid Build Coastguard Worker 
294*8975f5c5SAndroid Build Coastguard Worker         case GL_PROGRAM_OUTPUT:
295*8975f5c5SAndroid Build Coastguard Worker             return index < executable.getOutputVariables().size();
296*8975f5c5SAndroid Build Coastguard Worker 
297*8975f5c5SAndroid Build Coastguard Worker         case GL_UNIFORM:
298*8975f5c5SAndroid Build Coastguard Worker             return index < executable.getUniforms().size();
299*8975f5c5SAndroid Build Coastguard Worker 
300*8975f5c5SAndroid Build Coastguard Worker         case GL_BUFFER_VARIABLE:
301*8975f5c5SAndroid Build Coastguard Worker             return index < executable.getBufferVariables().size();
302*8975f5c5SAndroid Build Coastguard Worker 
303*8975f5c5SAndroid Build Coastguard Worker         case GL_SHADER_STORAGE_BLOCK:
304*8975f5c5SAndroid Build Coastguard Worker             return index < executable.getShaderStorageBlocks().size();
305*8975f5c5SAndroid Build Coastguard Worker 
306*8975f5c5SAndroid Build Coastguard Worker         case GL_UNIFORM_BLOCK:
307*8975f5c5SAndroid Build Coastguard Worker             return index < executable.getUniformBlocks().size();
308*8975f5c5SAndroid Build Coastguard Worker 
309*8975f5c5SAndroid Build Coastguard Worker         case GL_ATOMIC_COUNTER_BUFFER:
310*8975f5c5SAndroid Build Coastguard Worker             return index < executable.getAtomicCounterBuffers().size();
311*8975f5c5SAndroid Build Coastguard Worker 
312*8975f5c5SAndroid Build Coastguard Worker         case GL_TRANSFORM_FEEDBACK_VARYING:
313*8975f5c5SAndroid Build Coastguard Worker             return index < executable.getLinkedTransformFeedbackVaryings().size();
314*8975f5c5SAndroid Build Coastguard Worker 
315*8975f5c5SAndroid Build Coastguard Worker         default:
316*8975f5c5SAndroid Build Coastguard Worker             UNREACHABLE();
317*8975f5c5SAndroid Build Coastguard Worker             return false;
318*8975f5c5SAndroid Build Coastguard Worker     }
319*8975f5c5SAndroid Build Coastguard Worker }
320*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformBase(const Context * context,angle::EntryPoint entryPoint,GLenum valueType,ShaderProgramID program,UniformLocation location,GLsizei count)321*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformBase(const Context *context,
322*8975f5c5SAndroid Build Coastguard Worker                                 angle::EntryPoint entryPoint,
323*8975f5c5SAndroid Build Coastguard Worker                                 GLenum valueType,
324*8975f5c5SAndroid Build Coastguard Worker                                 ShaderProgramID program,
325*8975f5c5SAndroid Build Coastguard Worker                                 UniformLocation location,
326*8975f5c5SAndroid Build Coastguard Worker                                 GLsizei count)
327*8975f5c5SAndroid Build Coastguard Worker {
328*8975f5c5SAndroid Build Coastguard Worker     const LinkedUniform *uniform = nullptr;
329*8975f5c5SAndroid Build Coastguard Worker     Program *programObject       = GetValidProgram(context, entryPoint, program);
330*8975f5c5SAndroid Build Coastguard Worker     return ValidateUniformCommonBase(context, entryPoint, programObject, location, count,
331*8975f5c5SAndroid Build Coastguard Worker                                      &uniform) &&
332*8975f5c5SAndroid Build Coastguard Worker            ValidateUniformValue(context, entryPoint, valueType, uniform->getType());
333*8975f5c5SAndroid Build Coastguard Worker }
334*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrixBase(const Context * context,angle::EntryPoint entryPoint,GLenum valueType,ShaderProgramID program,UniformLocation location,GLsizei count,GLboolean transpose)335*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrixBase(const Context *context,
336*8975f5c5SAndroid Build Coastguard Worker                                       angle::EntryPoint entryPoint,
337*8975f5c5SAndroid Build Coastguard Worker                                       GLenum valueType,
338*8975f5c5SAndroid Build Coastguard Worker                                       ShaderProgramID program,
339*8975f5c5SAndroid Build Coastguard Worker                                       UniformLocation location,
340*8975f5c5SAndroid Build Coastguard Worker                                       GLsizei count,
341*8975f5c5SAndroid Build Coastguard Worker                                       GLboolean transpose)
342*8975f5c5SAndroid Build Coastguard Worker {
343*8975f5c5SAndroid Build Coastguard Worker     const LinkedUniform *uniform = nullptr;
344*8975f5c5SAndroid Build Coastguard Worker     Program *programObject       = GetValidProgram(context, entryPoint, program);
345*8975f5c5SAndroid Build Coastguard Worker     return ValidateUniformCommonBase(context, entryPoint, programObject, location, count,
346*8975f5c5SAndroid Build Coastguard Worker                                      &uniform) &&
347*8975f5c5SAndroid Build Coastguard Worker            ValidateUniformMatrixValue(context, entryPoint, valueType, uniform->getType());
348*8975f5c5SAndroid Build Coastguard Worker }
349*8975f5c5SAndroid Build Coastguard Worker 
ValidateVertexAttribFormatCommon(const Context * context,angle::EntryPoint entryPoint,GLuint relativeOffset)350*8975f5c5SAndroid Build Coastguard Worker bool ValidateVertexAttribFormatCommon(const Context *context,
351*8975f5c5SAndroid Build Coastguard Worker                                       angle::EntryPoint entryPoint,
352*8975f5c5SAndroid Build Coastguard Worker                                       GLuint relativeOffset)
353*8975f5c5SAndroid Build Coastguard Worker {
354*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
355*8975f5c5SAndroid Build Coastguard Worker     {
356*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
357*8975f5c5SAndroid Build Coastguard Worker         return false;
358*8975f5c5SAndroid Build Coastguard Worker     }
359*8975f5c5SAndroid Build Coastguard Worker 
360*8975f5c5SAndroid Build Coastguard Worker     const Caps &caps = context->getCaps();
361*8975f5c5SAndroid Build Coastguard Worker     if (relativeOffset > static_cast<GLuint>(caps.maxVertexAttribRelativeOffset))
362*8975f5c5SAndroid Build Coastguard Worker     {
363*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kRelativeOffsetTooLarge);
364*8975f5c5SAndroid Build Coastguard Worker         return false;
365*8975f5c5SAndroid Build Coastguard Worker     }
366*8975f5c5SAndroid Build Coastguard Worker 
367*8975f5c5SAndroid Build Coastguard Worker     // [OpenGL ES 3.1] Section 10.3.1 page 243:
368*8975f5c5SAndroid Build Coastguard Worker     // An INVALID_OPERATION error is generated if the default vertex array object is bound.
369*8975f5c5SAndroid Build Coastguard Worker     if (context->getState().getVertexArrayId().value == 0)
370*8975f5c5SAndroid Build Coastguard Worker     {
371*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kDefaultVertexArray);
372*8975f5c5SAndroid Build Coastguard Worker         return false;
373*8975f5c5SAndroid Build Coastguard Worker     }
374*8975f5c5SAndroid Build Coastguard Worker 
375*8975f5c5SAndroid Build Coastguard Worker     return true;
376*8975f5c5SAndroid Build Coastguard Worker }
377*8975f5c5SAndroid Build Coastguard Worker 
378*8975f5c5SAndroid Build Coastguard Worker }  // anonymous namespace
379*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetBooleani_v(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLuint index,const GLboolean * data)380*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetBooleani_v(const Context *context,
381*8975f5c5SAndroid Build Coastguard Worker                            angle::EntryPoint entryPoint,
382*8975f5c5SAndroid Build Coastguard Worker                            GLenum target,
383*8975f5c5SAndroid Build Coastguard Worker                            GLuint index,
384*8975f5c5SAndroid Build Coastguard Worker                            const GLboolean *data)
385*8975f5c5SAndroid Build Coastguard Worker {
386*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1 && !context->getExtensions().drawBuffersIndexedAny())
387*8975f5c5SAndroid Build Coastguard Worker     {
388*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION,
389*8975f5c5SAndroid Build Coastguard Worker                                kES31OrDrawBuffersIndexedExtensionNotAvailable);
390*8975f5c5SAndroid Build Coastguard Worker         return false;
391*8975f5c5SAndroid Build Coastguard Worker     }
392*8975f5c5SAndroid Build Coastguard Worker 
393*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateIndexedStateQuery(context, entryPoint, target, index, nullptr))
394*8975f5c5SAndroid Build Coastguard Worker     {
395*8975f5c5SAndroid Build Coastguard Worker         return false;
396*8975f5c5SAndroid Build Coastguard Worker     }
397*8975f5c5SAndroid Build Coastguard Worker 
398*8975f5c5SAndroid Build Coastguard Worker     return true;
399*8975f5c5SAndroid Build Coastguard Worker }
400*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetBooleani_vRobustANGLE(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLuint index,GLsizei bufSize,const GLsizei * length,const GLboolean * data)401*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetBooleani_vRobustANGLE(const Context *context,
402*8975f5c5SAndroid Build Coastguard Worker                                       angle::EntryPoint entryPoint,
403*8975f5c5SAndroid Build Coastguard Worker                                       GLenum target,
404*8975f5c5SAndroid Build Coastguard Worker                                       GLuint index,
405*8975f5c5SAndroid Build Coastguard Worker                                       GLsizei bufSize,
406*8975f5c5SAndroid Build Coastguard Worker                                       const GLsizei *length,
407*8975f5c5SAndroid Build Coastguard Worker                                       const GLboolean *data)
408*8975f5c5SAndroid Build Coastguard Worker {
409*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1 && !context->getExtensions().drawBuffersIndexedAny())
410*8975f5c5SAndroid Build Coastguard Worker     {
411*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION,
412*8975f5c5SAndroid Build Coastguard Worker                                kES31OrDrawBuffersIndexedExtensionNotAvailable);
413*8975f5c5SAndroid Build Coastguard Worker         return false;
414*8975f5c5SAndroid Build Coastguard Worker     }
415*8975f5c5SAndroid Build Coastguard Worker 
416*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateRobustEntryPoint(context, entryPoint, bufSize))
417*8975f5c5SAndroid Build Coastguard Worker     {
418*8975f5c5SAndroid Build Coastguard Worker         return false;
419*8975f5c5SAndroid Build Coastguard Worker     }
420*8975f5c5SAndroid Build Coastguard Worker 
421*8975f5c5SAndroid Build Coastguard Worker     GLsizei numParams = 0;
422*8975f5c5SAndroid Build Coastguard Worker 
423*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateIndexedStateQuery(context, entryPoint, target, index, &numParams))
424*8975f5c5SAndroid Build Coastguard Worker     {
425*8975f5c5SAndroid Build Coastguard Worker         return false;
426*8975f5c5SAndroid Build Coastguard Worker     }
427*8975f5c5SAndroid Build Coastguard Worker 
428*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateRobustBufferSize(context, entryPoint, bufSize, numParams))
429*8975f5c5SAndroid Build Coastguard Worker     {
430*8975f5c5SAndroid Build Coastguard Worker         return false;
431*8975f5c5SAndroid Build Coastguard Worker     }
432*8975f5c5SAndroid Build Coastguard Worker 
433*8975f5c5SAndroid Build Coastguard Worker     SetRobustLengthParam(length, numParams);
434*8975f5c5SAndroid Build Coastguard Worker     return true;
435*8975f5c5SAndroid Build Coastguard Worker }
436*8975f5c5SAndroid Build Coastguard Worker 
ValidateDrawIndirectBase(const Context * context,angle::EntryPoint entryPoint,PrimitiveMode mode,const void * indirect)437*8975f5c5SAndroid Build Coastguard Worker bool ValidateDrawIndirectBase(const Context *context,
438*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
439*8975f5c5SAndroid Build Coastguard Worker                               PrimitiveMode mode,
440*8975f5c5SAndroid Build Coastguard Worker                               const void *indirect)
441*8975f5c5SAndroid Build Coastguard Worker {
442*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
443*8975f5c5SAndroid Build Coastguard Worker     {
444*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
445*8975f5c5SAndroid Build Coastguard Worker         return false;
446*8975f5c5SAndroid Build Coastguard Worker     }
447*8975f5c5SAndroid Build Coastguard Worker 
448*8975f5c5SAndroid Build Coastguard Worker     // Here the third parameter 1 is only to pass the count validation.
449*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateDrawBase(context, entryPoint, mode))
450*8975f5c5SAndroid Build Coastguard Worker     {
451*8975f5c5SAndroid Build Coastguard Worker         return false;
452*8975f5c5SAndroid Build Coastguard Worker     }
453*8975f5c5SAndroid Build Coastguard Worker 
454*8975f5c5SAndroid Build Coastguard Worker     const State &state = context->getState();
455*8975f5c5SAndroid Build Coastguard Worker 
456*8975f5c5SAndroid Build Coastguard Worker     // An INVALID_OPERATION error is generated if zero is bound to VERTEX_ARRAY_BINDING,
457*8975f5c5SAndroid Build Coastguard Worker     // DRAW_INDIRECT_BUFFER or to any enabled vertex array.
458*8975f5c5SAndroid Build Coastguard Worker     if (state.getVertexArrayId().value == 0)
459*8975f5c5SAndroid Build Coastguard Worker     {
460*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kDefaultVertexArray);
461*8975f5c5SAndroid Build Coastguard Worker         return false;
462*8975f5c5SAndroid Build Coastguard Worker     }
463*8975f5c5SAndroid Build Coastguard Worker 
464*8975f5c5SAndroid Build Coastguard Worker     if (context->getStateCache().hasAnyActiveClientAttrib())
465*8975f5c5SAndroid Build Coastguard Worker     {
466*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kClientDataInVertexArray);
467*8975f5c5SAndroid Build Coastguard Worker         return false;
468*8975f5c5SAndroid Build Coastguard Worker     }
469*8975f5c5SAndroid Build Coastguard Worker 
470*8975f5c5SAndroid Build Coastguard Worker     Buffer *drawIndirectBuffer = state.getTargetBuffer(BufferBinding::DrawIndirect);
471*8975f5c5SAndroid Build Coastguard Worker     if (!drawIndirectBuffer)
472*8975f5c5SAndroid Build Coastguard Worker     {
473*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kDrawIndirectBufferNotBound);
474*8975f5c5SAndroid Build Coastguard Worker         return false;
475*8975f5c5SAndroid Build Coastguard Worker     }
476*8975f5c5SAndroid Build Coastguard Worker 
477*8975f5c5SAndroid Build Coastguard Worker     // An INVALID_VALUE error is generated if indirect is not a multiple of the size, in basic
478*8975f5c5SAndroid Build Coastguard Worker     // machine units, of uint.
479*8975f5c5SAndroid Build Coastguard Worker     GLint64 offset = reinterpret_cast<GLint64>(indirect);
480*8975f5c5SAndroid Build Coastguard Worker     if ((static_cast<GLuint>(offset) % sizeof(GLuint)) != 0)
481*8975f5c5SAndroid Build Coastguard Worker     {
482*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidIndirectOffset);
483*8975f5c5SAndroid Build Coastguard Worker         return false;
484*8975f5c5SAndroid Build Coastguard Worker     }
485*8975f5c5SAndroid Build Coastguard Worker 
486*8975f5c5SAndroid Build Coastguard Worker     return true;
487*8975f5c5SAndroid Build Coastguard Worker }
488*8975f5c5SAndroid Build Coastguard Worker 
ValidateDrawArraysIndirect(const Context * context,angle::EntryPoint entryPoint,PrimitiveMode mode,const void * indirect)489*8975f5c5SAndroid Build Coastguard Worker bool ValidateDrawArraysIndirect(const Context *context,
490*8975f5c5SAndroid Build Coastguard Worker                                 angle::EntryPoint entryPoint,
491*8975f5c5SAndroid Build Coastguard Worker                                 PrimitiveMode mode,
492*8975f5c5SAndroid Build Coastguard Worker                                 const void *indirect)
493*8975f5c5SAndroid Build Coastguard Worker {
494*8975f5c5SAndroid Build Coastguard Worker     const State &state                      = context->getState();
495*8975f5c5SAndroid Build Coastguard Worker     TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback();
496*8975f5c5SAndroid Build Coastguard Worker     if (curTransformFeedback && curTransformFeedback->isActive() &&
497*8975f5c5SAndroid Build Coastguard Worker         !curTransformFeedback->isPaused())
498*8975f5c5SAndroid Build Coastguard Worker     {
499*8975f5c5SAndroid Build Coastguard Worker         // EXT_geometry_shader allows transform feedback to work with all draw commands.
500*8975f5c5SAndroid Build Coastguard Worker         // [EXT_geometry_shader] Section 12.1, "Transform Feedback"
501*8975f5c5SAndroid Build Coastguard Worker         if (context->getExtensions().geometryShaderAny() || context->getClientVersion() >= ES_3_2)
502*8975f5c5SAndroid Build Coastguard Worker         {
503*8975f5c5SAndroid Build Coastguard Worker             if (!ValidateTransformFeedbackPrimitiveMode(
504*8975f5c5SAndroid Build Coastguard Worker                     context, entryPoint, curTransformFeedback->getPrimitiveMode(), mode))
505*8975f5c5SAndroid Build Coastguard Worker             {
506*8975f5c5SAndroid Build Coastguard Worker                 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidDrawModeTransformFeedback);
507*8975f5c5SAndroid Build Coastguard Worker                 return false;
508*8975f5c5SAndroid Build Coastguard Worker             }
509*8975f5c5SAndroid Build Coastguard Worker         }
510*8975f5c5SAndroid Build Coastguard Worker         else
511*8975f5c5SAndroid Build Coastguard Worker         {
512*8975f5c5SAndroid Build Coastguard Worker             // An INVALID_OPERATION error is generated if transform feedback is active and not
513*8975f5c5SAndroid Build Coastguard Worker             // paused.
514*8975f5c5SAndroid Build Coastguard Worker             ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kUnsupportedDrawModeForTransformFeedback);
515*8975f5c5SAndroid Build Coastguard Worker             return false;
516*8975f5c5SAndroid Build Coastguard Worker         }
517*8975f5c5SAndroid Build Coastguard Worker     }
518*8975f5c5SAndroid Build Coastguard Worker 
519*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateDrawIndirectBase(context, entryPoint, mode, indirect))
520*8975f5c5SAndroid Build Coastguard Worker         return false;
521*8975f5c5SAndroid Build Coastguard Worker 
522*8975f5c5SAndroid Build Coastguard Worker     Buffer *drawIndirectBuffer = state.getTargetBuffer(BufferBinding::DrawIndirect);
523*8975f5c5SAndroid Build Coastguard Worker     CheckedNumeric<size_t> checkedOffset(reinterpret_cast<size_t>(indirect));
524*8975f5c5SAndroid Build Coastguard Worker     // In OpenGL ES3.1 spec, session 10.5, it defines the struct of DrawArraysIndirectCommand
525*8975f5c5SAndroid Build Coastguard Worker     // which's size is 4 * sizeof(uint).
526*8975f5c5SAndroid Build Coastguard Worker     auto checkedSum = checkedOffset + 4 * sizeof(GLuint);
527*8975f5c5SAndroid Build Coastguard Worker     if (!checkedSum.IsValid() ||
528*8975f5c5SAndroid Build Coastguard Worker         checkedSum.ValueOrDie() > static_cast<size_t>(drawIndirectBuffer->getSize()))
529*8975f5c5SAndroid Build Coastguard Worker     {
530*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kParamOverflow);
531*8975f5c5SAndroid Build Coastguard Worker         return false;
532*8975f5c5SAndroid Build Coastguard Worker     }
533*8975f5c5SAndroid Build Coastguard Worker 
534*8975f5c5SAndroid Build Coastguard Worker     return true;
535*8975f5c5SAndroid Build Coastguard Worker }
536*8975f5c5SAndroid Build Coastguard Worker 
ValidateDrawElementsIndirect(const Context * context,angle::EntryPoint entryPoint,PrimitiveMode mode,DrawElementsType type,const void * indirect)537*8975f5c5SAndroid Build Coastguard Worker bool ValidateDrawElementsIndirect(const Context *context,
538*8975f5c5SAndroid Build Coastguard Worker                                   angle::EntryPoint entryPoint,
539*8975f5c5SAndroid Build Coastguard Worker                                   PrimitiveMode mode,
540*8975f5c5SAndroid Build Coastguard Worker                                   DrawElementsType type,
541*8975f5c5SAndroid Build Coastguard Worker                                   const void *indirect)
542*8975f5c5SAndroid Build Coastguard Worker {
543*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateDrawElementsBase(context, entryPoint, mode, type))
544*8975f5c5SAndroid Build Coastguard Worker     {
545*8975f5c5SAndroid Build Coastguard Worker         return false;
546*8975f5c5SAndroid Build Coastguard Worker     }
547*8975f5c5SAndroid Build Coastguard Worker 
548*8975f5c5SAndroid Build Coastguard Worker     const State &state         = context->getState();
549*8975f5c5SAndroid Build Coastguard Worker     const VertexArray *vao     = state.getVertexArray();
550*8975f5c5SAndroid Build Coastguard Worker     Buffer *elementArrayBuffer = vao->getElementArrayBuffer();
551*8975f5c5SAndroid Build Coastguard Worker     if (!elementArrayBuffer)
552*8975f5c5SAndroid Build Coastguard Worker     {
553*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kMustHaveElementArrayBinding);
554*8975f5c5SAndroid Build Coastguard Worker         return false;
555*8975f5c5SAndroid Build Coastguard Worker     }
556*8975f5c5SAndroid Build Coastguard Worker 
557*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateDrawIndirectBase(context, entryPoint, mode, indirect))
558*8975f5c5SAndroid Build Coastguard Worker         return false;
559*8975f5c5SAndroid Build Coastguard Worker 
560*8975f5c5SAndroid Build Coastguard Worker     Buffer *drawIndirectBuffer = state.getTargetBuffer(BufferBinding::DrawIndirect);
561*8975f5c5SAndroid Build Coastguard Worker     CheckedNumeric<size_t> checkedOffset(reinterpret_cast<size_t>(indirect));
562*8975f5c5SAndroid Build Coastguard Worker     // In OpenGL ES3.1 spec, session 10.5, it defines the struct of DrawElementsIndirectCommand
563*8975f5c5SAndroid Build Coastguard Worker     // which's size is 5 * sizeof(uint).
564*8975f5c5SAndroid Build Coastguard Worker     auto checkedSum = checkedOffset + 5 * sizeof(GLuint);
565*8975f5c5SAndroid Build Coastguard Worker     if (!checkedSum.IsValid() ||
566*8975f5c5SAndroid Build Coastguard Worker         checkedSum.ValueOrDie() > static_cast<size_t>(drawIndirectBuffer->getSize()))
567*8975f5c5SAndroid Build Coastguard Worker     {
568*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kParamOverflow);
569*8975f5c5SAndroid Build Coastguard Worker         return false;
570*8975f5c5SAndroid Build Coastguard Worker     }
571*8975f5c5SAndroid Build Coastguard Worker 
572*8975f5c5SAndroid Build Coastguard Worker     return true;
573*8975f5c5SAndroid Build Coastguard Worker }
574*8975f5c5SAndroid Build Coastguard Worker 
ValidateMultiDrawIndirectBase(const Context * context,angle::EntryPoint entryPoint,GLsizei drawcount,GLsizei stride)575*8975f5c5SAndroid Build Coastguard Worker bool ValidateMultiDrawIndirectBase(const Context *context,
576*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
577*8975f5c5SAndroid Build Coastguard Worker                                    GLsizei drawcount,
578*8975f5c5SAndroid Build Coastguard Worker                                    GLsizei stride)
579*8975f5c5SAndroid Build Coastguard Worker {
580*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().multiDrawIndirectEXT)
581*8975f5c5SAndroid Build Coastguard Worker     {
582*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
583*8975f5c5SAndroid Build Coastguard Worker         return false;
584*8975f5c5SAndroid Build Coastguard Worker     }
585*8975f5c5SAndroid Build Coastguard Worker 
586*8975f5c5SAndroid Build Coastguard Worker     // An INVALID_VALUE error is generated if stride is neither 0 nor a multiple of 4.
587*8975f5c5SAndroid Build Coastguard Worker     if ((stride & 3) != 0)
588*8975f5c5SAndroid Build Coastguard Worker     {
589*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidDrawBufferValue);
590*8975f5c5SAndroid Build Coastguard Worker         return false;
591*8975f5c5SAndroid Build Coastguard Worker     }
592*8975f5c5SAndroid Build Coastguard Worker 
593*8975f5c5SAndroid Build Coastguard Worker     // An INVALID_VALUE error is generated if drawcount is not positive.
594*8975f5c5SAndroid Build Coastguard Worker     if (drawcount <= 0)
595*8975f5c5SAndroid Build Coastguard Worker     {
596*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidValueNonPositive);
597*8975f5c5SAndroid Build Coastguard Worker         return false;
598*8975f5c5SAndroid Build Coastguard Worker     }
599*8975f5c5SAndroid Build Coastguard Worker 
600*8975f5c5SAndroid Build Coastguard Worker     return true;
601*8975f5c5SAndroid Build Coastguard Worker }
602*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform1iBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLint v0)603*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform1iBase(const Context *context,
604*8975f5c5SAndroid Build Coastguard Worker                                   angle::EntryPoint entryPoint,
605*8975f5c5SAndroid Build Coastguard Worker                                   ShaderProgramID program,
606*8975f5c5SAndroid Build Coastguard Worker                                   UniformLocation location,
607*8975f5c5SAndroid Build Coastguard Worker                                   GLint v0)
608*8975f5c5SAndroid Build Coastguard Worker {
609*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform1ivBase(context, entryPoint, program, location, 1, &v0);
610*8975f5c5SAndroid Build Coastguard Worker }
611*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform2iBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLint v0,GLint v1)612*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform2iBase(const Context *context,
613*8975f5c5SAndroid Build Coastguard Worker                                   angle::EntryPoint entryPoint,
614*8975f5c5SAndroid Build Coastguard Worker                                   ShaderProgramID program,
615*8975f5c5SAndroid Build Coastguard Worker                                   UniformLocation location,
616*8975f5c5SAndroid Build Coastguard Worker                                   GLint v0,
617*8975f5c5SAndroid Build Coastguard Worker                                   GLint v1)
618*8975f5c5SAndroid Build Coastguard Worker {
619*8975f5c5SAndroid Build Coastguard Worker     GLint xy[2] = {v0, v1};
620*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform2ivBase(context, entryPoint, program, location, 1, xy);
621*8975f5c5SAndroid Build Coastguard Worker }
622*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform3iBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLint v0,GLint v1,GLint v2)623*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform3iBase(const Context *context,
624*8975f5c5SAndroid Build Coastguard Worker                                   angle::EntryPoint entryPoint,
625*8975f5c5SAndroid Build Coastguard Worker                                   ShaderProgramID program,
626*8975f5c5SAndroid Build Coastguard Worker                                   UniformLocation location,
627*8975f5c5SAndroid Build Coastguard Worker                                   GLint v0,
628*8975f5c5SAndroid Build Coastguard Worker                                   GLint v1,
629*8975f5c5SAndroid Build Coastguard Worker                                   GLint v2)
630*8975f5c5SAndroid Build Coastguard Worker {
631*8975f5c5SAndroid Build Coastguard Worker     GLint xyz[3] = {v0, v1, v2};
632*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform3ivBase(context, entryPoint, program, location, 1, xyz);
633*8975f5c5SAndroid Build Coastguard Worker }
634*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform4iBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLint v0,GLint v1,GLint v2,GLint v3)635*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform4iBase(const Context *context,
636*8975f5c5SAndroid Build Coastguard Worker                                   angle::EntryPoint entryPoint,
637*8975f5c5SAndroid Build Coastguard Worker                                   ShaderProgramID program,
638*8975f5c5SAndroid Build Coastguard Worker                                   UniformLocation location,
639*8975f5c5SAndroid Build Coastguard Worker                                   GLint v0,
640*8975f5c5SAndroid Build Coastguard Worker                                   GLint v1,
641*8975f5c5SAndroid Build Coastguard Worker                                   GLint v2,
642*8975f5c5SAndroid Build Coastguard Worker                                   GLint v3)
643*8975f5c5SAndroid Build Coastguard Worker {
644*8975f5c5SAndroid Build Coastguard Worker     GLint xyzw[4] = {v0, v1, v2, v3};
645*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform4ivBase(context, entryPoint, program, location, 1, xyzw);
646*8975f5c5SAndroid Build Coastguard Worker }
647*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform1uiBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLuint v0)648*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform1uiBase(const Context *context,
649*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
650*8975f5c5SAndroid Build Coastguard Worker                                    ShaderProgramID program,
651*8975f5c5SAndroid Build Coastguard Worker                                    UniformLocation location,
652*8975f5c5SAndroid Build Coastguard Worker                                    GLuint v0)
653*8975f5c5SAndroid Build Coastguard Worker {
654*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform1uivBase(context, entryPoint, program, location, 1, &v0);
655*8975f5c5SAndroid Build Coastguard Worker }
656*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform2uiBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLuint v0,GLuint v1)657*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform2uiBase(const Context *context,
658*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
659*8975f5c5SAndroid Build Coastguard Worker                                    ShaderProgramID program,
660*8975f5c5SAndroid Build Coastguard Worker                                    UniformLocation location,
661*8975f5c5SAndroid Build Coastguard Worker                                    GLuint v0,
662*8975f5c5SAndroid Build Coastguard Worker                                    GLuint v1)
663*8975f5c5SAndroid Build Coastguard Worker {
664*8975f5c5SAndroid Build Coastguard Worker     GLuint xy[2] = {v0, v1};
665*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform2uivBase(context, entryPoint, program, location, 1, xy);
666*8975f5c5SAndroid Build Coastguard Worker }
667*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform3uiBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLuint v0,GLuint v1,GLuint v2)668*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform3uiBase(const Context *context,
669*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
670*8975f5c5SAndroid Build Coastguard Worker                                    ShaderProgramID program,
671*8975f5c5SAndroid Build Coastguard Worker                                    UniformLocation location,
672*8975f5c5SAndroid Build Coastguard Worker                                    GLuint v0,
673*8975f5c5SAndroid Build Coastguard Worker                                    GLuint v1,
674*8975f5c5SAndroid Build Coastguard Worker                                    GLuint v2)
675*8975f5c5SAndroid Build Coastguard Worker {
676*8975f5c5SAndroid Build Coastguard Worker     GLuint xyz[3] = {v0, v1, v2};
677*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform3uivBase(context, entryPoint, program, location, 1, xyz);
678*8975f5c5SAndroid Build Coastguard Worker }
679*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform4uiBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLuint v0,GLuint v1,GLuint v2,GLuint v3)680*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform4uiBase(const Context *context,
681*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
682*8975f5c5SAndroid Build Coastguard Worker                                    ShaderProgramID program,
683*8975f5c5SAndroid Build Coastguard Worker                                    UniformLocation location,
684*8975f5c5SAndroid Build Coastguard Worker                                    GLuint v0,
685*8975f5c5SAndroid Build Coastguard Worker                                    GLuint v1,
686*8975f5c5SAndroid Build Coastguard Worker                                    GLuint v2,
687*8975f5c5SAndroid Build Coastguard Worker                                    GLuint v3)
688*8975f5c5SAndroid Build Coastguard Worker {
689*8975f5c5SAndroid Build Coastguard Worker     GLuint xyzw[4] = {v0, v1, v2, v3};
690*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform4uivBase(context, entryPoint, program, location, 1, xyzw);
691*8975f5c5SAndroid Build Coastguard Worker }
692*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform1fBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLfloat v0)693*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform1fBase(const Context *context,
694*8975f5c5SAndroid Build Coastguard Worker                                   angle::EntryPoint entryPoint,
695*8975f5c5SAndroid Build Coastguard Worker                                   ShaderProgramID program,
696*8975f5c5SAndroid Build Coastguard Worker                                   UniformLocation location,
697*8975f5c5SAndroid Build Coastguard Worker                                   GLfloat v0)
698*8975f5c5SAndroid Build Coastguard Worker {
699*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform1fvBase(context, entryPoint, program, location, 1, &v0);
700*8975f5c5SAndroid Build Coastguard Worker }
701*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform2fBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLfloat v0,GLfloat v1)702*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform2fBase(const Context *context,
703*8975f5c5SAndroid Build Coastguard Worker                                   angle::EntryPoint entryPoint,
704*8975f5c5SAndroid Build Coastguard Worker                                   ShaderProgramID program,
705*8975f5c5SAndroid Build Coastguard Worker                                   UniformLocation location,
706*8975f5c5SAndroid Build Coastguard Worker                                   GLfloat v0,
707*8975f5c5SAndroid Build Coastguard Worker                                   GLfloat v1)
708*8975f5c5SAndroid Build Coastguard Worker {
709*8975f5c5SAndroid Build Coastguard Worker     GLfloat xy[2] = {v0, v1};
710*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform2fvBase(context, entryPoint, program, location, 1, xy);
711*8975f5c5SAndroid Build Coastguard Worker }
712*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform3fBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLfloat v0,GLfloat v1,GLfloat v2)713*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform3fBase(const Context *context,
714*8975f5c5SAndroid Build Coastguard Worker                                   angle::EntryPoint entryPoint,
715*8975f5c5SAndroid Build Coastguard Worker                                   ShaderProgramID program,
716*8975f5c5SAndroid Build Coastguard Worker                                   UniformLocation location,
717*8975f5c5SAndroid Build Coastguard Worker                                   GLfloat v0,
718*8975f5c5SAndroid Build Coastguard Worker                                   GLfloat v1,
719*8975f5c5SAndroid Build Coastguard Worker                                   GLfloat v2)
720*8975f5c5SAndroid Build Coastguard Worker {
721*8975f5c5SAndroid Build Coastguard Worker     GLfloat xyz[3] = {v0, v1, v2};
722*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform3fvBase(context, entryPoint, program, location, 1, xyz);
723*8975f5c5SAndroid Build Coastguard Worker }
724*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform4fBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLfloat v0,GLfloat v1,GLfloat v2,GLfloat v3)725*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform4fBase(const Context *context,
726*8975f5c5SAndroid Build Coastguard Worker                                   angle::EntryPoint entryPoint,
727*8975f5c5SAndroid Build Coastguard Worker                                   ShaderProgramID program,
728*8975f5c5SAndroid Build Coastguard Worker                                   UniformLocation location,
729*8975f5c5SAndroid Build Coastguard Worker                                   GLfloat v0,
730*8975f5c5SAndroid Build Coastguard Worker                                   GLfloat v1,
731*8975f5c5SAndroid Build Coastguard Worker                                   GLfloat v2,
732*8975f5c5SAndroid Build Coastguard Worker                                   GLfloat v3)
733*8975f5c5SAndroid Build Coastguard Worker {
734*8975f5c5SAndroid Build Coastguard Worker     GLfloat xyzw[4] = {v0, v1, v2, v3};
735*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform4fvBase(context, entryPoint, program, location, 1, xyzw);
736*8975f5c5SAndroid Build Coastguard Worker }
737*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform1ivBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,const GLint * value)738*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform1ivBase(const Context *context,
739*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
740*8975f5c5SAndroid Build Coastguard Worker                                    ShaderProgramID program,
741*8975f5c5SAndroid Build Coastguard Worker                                    UniformLocation location,
742*8975f5c5SAndroid Build Coastguard Worker                                    GLsizei count,
743*8975f5c5SAndroid Build Coastguard Worker                                    const GLint *value)
744*8975f5c5SAndroid Build Coastguard Worker {
745*8975f5c5SAndroid Build Coastguard Worker     const LinkedUniform *uniform = nullptr;
746*8975f5c5SAndroid Build Coastguard Worker     Program *programObject       = GetValidProgram(context, entryPoint, program);
747*8975f5c5SAndroid Build Coastguard Worker     return ValidateUniformCommonBase(context, entryPoint, programObject, location, count,
748*8975f5c5SAndroid Build Coastguard Worker                                      &uniform) &&
749*8975f5c5SAndroid Build Coastguard Worker            ValidateUniform1ivValue(context, entryPoint, uniform->getType(), count, value);
750*8975f5c5SAndroid Build Coastguard Worker }
751*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform2ivBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,const GLint * value)752*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform2ivBase(const Context *context,
753*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
754*8975f5c5SAndroid Build Coastguard Worker                                    ShaderProgramID program,
755*8975f5c5SAndroid Build Coastguard Worker                                    UniformLocation location,
756*8975f5c5SAndroid Build Coastguard Worker                                    GLsizei count,
757*8975f5c5SAndroid Build Coastguard Worker                                    const GLint *value)
758*8975f5c5SAndroid Build Coastguard Worker {
759*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformBase(context, entryPoint, GL_INT_VEC2, program, location, count);
760*8975f5c5SAndroid Build Coastguard Worker }
761*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform3ivBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,const GLint * value)762*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform3ivBase(const Context *context,
763*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
764*8975f5c5SAndroid Build Coastguard Worker                                    ShaderProgramID program,
765*8975f5c5SAndroid Build Coastguard Worker                                    UniformLocation location,
766*8975f5c5SAndroid Build Coastguard Worker                                    GLsizei count,
767*8975f5c5SAndroid Build Coastguard Worker                                    const GLint *value)
768*8975f5c5SAndroid Build Coastguard Worker {
769*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformBase(context, entryPoint, GL_INT_VEC3, program, location, count);
770*8975f5c5SAndroid Build Coastguard Worker }
771*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform4ivBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,const GLint * value)772*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform4ivBase(const Context *context,
773*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
774*8975f5c5SAndroid Build Coastguard Worker                                    ShaderProgramID program,
775*8975f5c5SAndroid Build Coastguard Worker                                    UniformLocation location,
776*8975f5c5SAndroid Build Coastguard Worker                                    GLsizei count,
777*8975f5c5SAndroid Build Coastguard Worker                                    const GLint *value)
778*8975f5c5SAndroid Build Coastguard Worker {
779*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformBase(context, entryPoint, GL_INT_VEC4, program, location, count);
780*8975f5c5SAndroid Build Coastguard Worker }
781*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform1uivBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,const GLuint * value)782*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform1uivBase(const Context *context,
783*8975f5c5SAndroid Build Coastguard Worker                                     angle::EntryPoint entryPoint,
784*8975f5c5SAndroid Build Coastguard Worker                                     ShaderProgramID program,
785*8975f5c5SAndroid Build Coastguard Worker                                     UniformLocation location,
786*8975f5c5SAndroid Build Coastguard Worker                                     GLsizei count,
787*8975f5c5SAndroid Build Coastguard Worker                                     const GLuint *value)
788*8975f5c5SAndroid Build Coastguard Worker {
789*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformBase(context, entryPoint, GL_UNSIGNED_INT, program, location,
790*8975f5c5SAndroid Build Coastguard Worker                                       count);
791*8975f5c5SAndroid Build Coastguard Worker }
792*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform2uivBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,const GLuint * value)793*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform2uivBase(const Context *context,
794*8975f5c5SAndroid Build Coastguard Worker                                     angle::EntryPoint entryPoint,
795*8975f5c5SAndroid Build Coastguard Worker                                     ShaderProgramID program,
796*8975f5c5SAndroid Build Coastguard Worker                                     UniformLocation location,
797*8975f5c5SAndroid Build Coastguard Worker                                     GLsizei count,
798*8975f5c5SAndroid Build Coastguard Worker                                     const GLuint *value)
799*8975f5c5SAndroid Build Coastguard Worker {
800*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformBase(context, entryPoint, GL_UNSIGNED_INT_VEC2, program, location,
801*8975f5c5SAndroid Build Coastguard Worker                                       count);
802*8975f5c5SAndroid Build Coastguard Worker }
803*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform3uivBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,const GLuint * value)804*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform3uivBase(const Context *context,
805*8975f5c5SAndroid Build Coastguard Worker                                     angle::EntryPoint entryPoint,
806*8975f5c5SAndroid Build Coastguard Worker                                     ShaderProgramID program,
807*8975f5c5SAndroid Build Coastguard Worker                                     UniformLocation location,
808*8975f5c5SAndroid Build Coastguard Worker                                     GLsizei count,
809*8975f5c5SAndroid Build Coastguard Worker                                     const GLuint *value)
810*8975f5c5SAndroid Build Coastguard Worker {
811*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformBase(context, entryPoint, GL_UNSIGNED_INT_VEC3, program, location,
812*8975f5c5SAndroid Build Coastguard Worker                                       count);
813*8975f5c5SAndroid Build Coastguard Worker }
814*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform4uivBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,const GLuint * value)815*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform4uivBase(const Context *context,
816*8975f5c5SAndroid Build Coastguard Worker                                     angle::EntryPoint entryPoint,
817*8975f5c5SAndroid Build Coastguard Worker                                     ShaderProgramID program,
818*8975f5c5SAndroid Build Coastguard Worker                                     UniformLocation location,
819*8975f5c5SAndroid Build Coastguard Worker                                     GLsizei count,
820*8975f5c5SAndroid Build Coastguard Worker                                     const GLuint *value)
821*8975f5c5SAndroid Build Coastguard Worker {
822*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformBase(context, entryPoint, GL_UNSIGNED_INT_VEC4, program, location,
823*8975f5c5SAndroid Build Coastguard Worker                                       count);
824*8975f5c5SAndroid Build Coastguard Worker }
825*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform1fvBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,const GLfloat * value)826*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform1fvBase(const Context *context,
827*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
828*8975f5c5SAndroid Build Coastguard Worker                                    ShaderProgramID program,
829*8975f5c5SAndroid Build Coastguard Worker                                    UniformLocation location,
830*8975f5c5SAndroid Build Coastguard Worker                                    GLsizei count,
831*8975f5c5SAndroid Build Coastguard Worker                                    const GLfloat *value)
832*8975f5c5SAndroid Build Coastguard Worker {
833*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformBase(context, entryPoint, GL_FLOAT, program, location, count);
834*8975f5c5SAndroid Build Coastguard Worker }
835*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform2fvBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,const GLfloat * value)836*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform2fvBase(const Context *context,
837*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
838*8975f5c5SAndroid Build Coastguard Worker                                    ShaderProgramID program,
839*8975f5c5SAndroid Build Coastguard Worker                                    UniformLocation location,
840*8975f5c5SAndroid Build Coastguard Worker                                    GLsizei count,
841*8975f5c5SAndroid Build Coastguard Worker                                    const GLfloat *value)
842*8975f5c5SAndroid Build Coastguard Worker {
843*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformBase(context, entryPoint, GL_FLOAT_VEC2, program, location, count);
844*8975f5c5SAndroid Build Coastguard Worker }
845*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform3fvBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,const GLfloat * value)846*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform3fvBase(const Context *context,
847*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
848*8975f5c5SAndroid Build Coastguard Worker                                    ShaderProgramID program,
849*8975f5c5SAndroid Build Coastguard Worker                                    UniformLocation location,
850*8975f5c5SAndroid Build Coastguard Worker                                    GLsizei count,
851*8975f5c5SAndroid Build Coastguard Worker                                    const GLfloat *value)
852*8975f5c5SAndroid Build Coastguard Worker {
853*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformBase(context, entryPoint, GL_FLOAT_VEC3, program, location, count);
854*8975f5c5SAndroid Build Coastguard Worker }
855*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform4fvBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,const GLfloat * value)856*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform4fvBase(const Context *context,
857*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
858*8975f5c5SAndroid Build Coastguard Worker                                    ShaderProgramID program,
859*8975f5c5SAndroid Build Coastguard Worker                                    UniformLocation location,
860*8975f5c5SAndroid Build Coastguard Worker                                    GLsizei count,
861*8975f5c5SAndroid Build Coastguard Worker                                    const GLfloat *value)
862*8975f5c5SAndroid Build Coastguard Worker {
863*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformBase(context, entryPoint, GL_FLOAT_VEC4, program, location, count);
864*8975f5c5SAndroid Build Coastguard Worker }
865*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix2fvBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value)866*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix2fvBase(const Context *context,
867*8975f5c5SAndroid Build Coastguard Worker                                          angle::EntryPoint entryPoint,
868*8975f5c5SAndroid Build Coastguard Worker                                          ShaderProgramID program,
869*8975f5c5SAndroid Build Coastguard Worker                                          UniformLocation location,
870*8975f5c5SAndroid Build Coastguard Worker                                          GLsizei count,
871*8975f5c5SAndroid Build Coastguard Worker                                          GLboolean transpose,
872*8975f5c5SAndroid Build Coastguard Worker                                          const GLfloat *value)
873*8975f5c5SAndroid Build Coastguard Worker {
874*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrixBase(context, entryPoint, GL_FLOAT_MAT2, program, location,
875*8975f5c5SAndroid Build Coastguard Worker                                             count, transpose);
876*8975f5c5SAndroid Build Coastguard Worker }
877*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix3fvBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value)878*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix3fvBase(const Context *context,
879*8975f5c5SAndroid Build Coastguard Worker                                          angle::EntryPoint entryPoint,
880*8975f5c5SAndroid Build Coastguard Worker                                          ShaderProgramID program,
881*8975f5c5SAndroid Build Coastguard Worker                                          UniformLocation location,
882*8975f5c5SAndroid Build Coastguard Worker                                          GLsizei count,
883*8975f5c5SAndroid Build Coastguard Worker                                          GLboolean transpose,
884*8975f5c5SAndroid Build Coastguard Worker                                          const GLfloat *value)
885*8975f5c5SAndroid Build Coastguard Worker {
886*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrixBase(context, entryPoint, GL_FLOAT_MAT3, program, location,
887*8975f5c5SAndroid Build Coastguard Worker                                             count, transpose);
888*8975f5c5SAndroid Build Coastguard Worker }
889*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix4fvBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value)890*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix4fvBase(const Context *context,
891*8975f5c5SAndroid Build Coastguard Worker                                          angle::EntryPoint entryPoint,
892*8975f5c5SAndroid Build Coastguard Worker                                          ShaderProgramID program,
893*8975f5c5SAndroid Build Coastguard Worker                                          UniformLocation location,
894*8975f5c5SAndroid Build Coastguard Worker                                          GLsizei count,
895*8975f5c5SAndroid Build Coastguard Worker                                          GLboolean transpose,
896*8975f5c5SAndroid Build Coastguard Worker                                          const GLfloat *value)
897*8975f5c5SAndroid Build Coastguard Worker {
898*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrixBase(context, entryPoint, GL_FLOAT_MAT4, program, location,
899*8975f5c5SAndroid Build Coastguard Worker                                             count, transpose);
900*8975f5c5SAndroid Build Coastguard Worker }
901*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix2x3fvBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value)902*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix2x3fvBase(const Context *context,
903*8975f5c5SAndroid Build Coastguard Worker                                            angle::EntryPoint entryPoint,
904*8975f5c5SAndroid Build Coastguard Worker                                            ShaderProgramID program,
905*8975f5c5SAndroid Build Coastguard Worker                                            UniformLocation location,
906*8975f5c5SAndroid Build Coastguard Worker                                            GLsizei count,
907*8975f5c5SAndroid Build Coastguard Worker                                            GLboolean transpose,
908*8975f5c5SAndroid Build Coastguard Worker                                            const GLfloat *value)
909*8975f5c5SAndroid Build Coastguard Worker {
910*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrixBase(context, entryPoint, GL_FLOAT_MAT2x3, program, location,
911*8975f5c5SAndroid Build Coastguard Worker                                             count, transpose);
912*8975f5c5SAndroid Build Coastguard Worker }
913*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix3x2fvBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value)914*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix3x2fvBase(const Context *context,
915*8975f5c5SAndroid Build Coastguard Worker                                            angle::EntryPoint entryPoint,
916*8975f5c5SAndroid Build Coastguard Worker                                            ShaderProgramID program,
917*8975f5c5SAndroid Build Coastguard Worker                                            UniformLocation location,
918*8975f5c5SAndroid Build Coastguard Worker                                            GLsizei count,
919*8975f5c5SAndroid Build Coastguard Worker                                            GLboolean transpose,
920*8975f5c5SAndroid Build Coastguard Worker                                            const GLfloat *value)
921*8975f5c5SAndroid Build Coastguard Worker {
922*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrixBase(context, entryPoint, GL_FLOAT_MAT3x2, program, location,
923*8975f5c5SAndroid Build Coastguard Worker                                             count, transpose);
924*8975f5c5SAndroid Build Coastguard Worker }
925*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix2x4fvBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value)926*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix2x4fvBase(const Context *context,
927*8975f5c5SAndroid Build Coastguard Worker                                            angle::EntryPoint entryPoint,
928*8975f5c5SAndroid Build Coastguard Worker                                            ShaderProgramID program,
929*8975f5c5SAndroid Build Coastguard Worker                                            UniformLocation location,
930*8975f5c5SAndroid Build Coastguard Worker                                            GLsizei count,
931*8975f5c5SAndroid Build Coastguard Worker                                            GLboolean transpose,
932*8975f5c5SAndroid Build Coastguard Worker                                            const GLfloat *value)
933*8975f5c5SAndroid Build Coastguard Worker {
934*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrixBase(context, entryPoint, GL_FLOAT_MAT2x4, program, location,
935*8975f5c5SAndroid Build Coastguard Worker                                             count, transpose);
936*8975f5c5SAndroid Build Coastguard Worker }
937*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix4x2fvBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value)938*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix4x2fvBase(const Context *context,
939*8975f5c5SAndroid Build Coastguard Worker                                            angle::EntryPoint entryPoint,
940*8975f5c5SAndroid Build Coastguard Worker                                            ShaderProgramID program,
941*8975f5c5SAndroid Build Coastguard Worker                                            UniformLocation location,
942*8975f5c5SAndroid Build Coastguard Worker                                            GLsizei count,
943*8975f5c5SAndroid Build Coastguard Worker                                            GLboolean transpose,
944*8975f5c5SAndroid Build Coastguard Worker                                            const GLfloat *value)
945*8975f5c5SAndroid Build Coastguard Worker {
946*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrixBase(context, entryPoint, GL_FLOAT_MAT4x2, program, location,
947*8975f5c5SAndroid Build Coastguard Worker                                             count, transpose);
948*8975f5c5SAndroid Build Coastguard Worker }
949*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix3x4fvBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value)950*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix3x4fvBase(const Context *context,
951*8975f5c5SAndroid Build Coastguard Worker                                            angle::EntryPoint entryPoint,
952*8975f5c5SAndroid Build Coastguard Worker                                            ShaderProgramID program,
953*8975f5c5SAndroid Build Coastguard Worker                                            UniformLocation location,
954*8975f5c5SAndroid Build Coastguard Worker                                            GLsizei count,
955*8975f5c5SAndroid Build Coastguard Worker                                            GLboolean transpose,
956*8975f5c5SAndroid Build Coastguard Worker                                            const GLfloat *value)
957*8975f5c5SAndroid Build Coastguard Worker {
958*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrixBase(context, entryPoint, GL_FLOAT_MAT3x4, program, location,
959*8975f5c5SAndroid Build Coastguard Worker                                             count, transpose);
960*8975f5c5SAndroid Build Coastguard Worker }
961*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix4x3fvBase(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei count,GLboolean transpose,const GLfloat * value)962*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix4x3fvBase(const Context *context,
963*8975f5c5SAndroid Build Coastguard Worker                                            angle::EntryPoint entryPoint,
964*8975f5c5SAndroid Build Coastguard Worker                                            ShaderProgramID program,
965*8975f5c5SAndroid Build Coastguard Worker                                            UniformLocation location,
966*8975f5c5SAndroid Build Coastguard Worker                                            GLsizei count,
967*8975f5c5SAndroid Build Coastguard Worker                                            GLboolean transpose,
968*8975f5c5SAndroid Build Coastguard Worker                                            const GLfloat *value)
969*8975f5c5SAndroid Build Coastguard Worker {
970*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrixBase(context, entryPoint, GL_FLOAT_MAT4x3, program, location,
971*8975f5c5SAndroid Build Coastguard Worker                                             count, transpose);
972*8975f5c5SAndroid Build Coastguard Worker }
973*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetTexLevelParameterfv(const Context * context,angle::EntryPoint entryPoint,TextureTarget target,GLint level,GLenum pname,const GLfloat * params)974*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetTexLevelParameterfv(const Context *context,
975*8975f5c5SAndroid Build Coastguard Worker                                     angle::EntryPoint entryPoint,
976*8975f5c5SAndroid Build Coastguard Worker                                     TextureTarget target,
977*8975f5c5SAndroid Build Coastguard Worker                                     GLint level,
978*8975f5c5SAndroid Build Coastguard Worker                                     GLenum pname,
979*8975f5c5SAndroid Build Coastguard Worker                                     const GLfloat *params)
980*8975f5c5SAndroid Build Coastguard Worker {
981*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
982*8975f5c5SAndroid Build Coastguard Worker     {
983*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
984*8975f5c5SAndroid Build Coastguard Worker         return false;
985*8975f5c5SAndroid Build Coastguard Worker     }
986*8975f5c5SAndroid Build Coastguard Worker 
987*8975f5c5SAndroid Build Coastguard Worker     return ValidateGetTexLevelParameterBase(context, entryPoint, target, level, pname, nullptr);
988*8975f5c5SAndroid Build Coastguard Worker }
989*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetTexLevelParameterfvRobustANGLE(const Context * context,angle::EntryPoint entryPoint,TextureTarget target,GLint level,GLenum pname,GLsizei bufSize,const GLsizei * length,const GLfloat * params)990*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetTexLevelParameterfvRobustANGLE(const Context *context,
991*8975f5c5SAndroid Build Coastguard Worker                                                angle::EntryPoint entryPoint,
992*8975f5c5SAndroid Build Coastguard Worker                                                TextureTarget target,
993*8975f5c5SAndroid Build Coastguard Worker                                                GLint level,
994*8975f5c5SAndroid Build Coastguard Worker                                                GLenum pname,
995*8975f5c5SAndroid Build Coastguard Worker                                                GLsizei bufSize,
996*8975f5c5SAndroid Build Coastguard Worker                                                const GLsizei *length,
997*8975f5c5SAndroid Build Coastguard Worker                                                const GLfloat *params)
998*8975f5c5SAndroid Build Coastguard Worker {
999*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
1000*8975f5c5SAndroid Build Coastguard Worker     return false;
1001*8975f5c5SAndroid Build Coastguard Worker }
1002*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetTexLevelParameteriv(const Context * context,angle::EntryPoint entryPoint,TextureTarget target,GLint level,GLenum pname,const GLint * params)1003*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetTexLevelParameteriv(const Context *context,
1004*8975f5c5SAndroid Build Coastguard Worker                                     angle::EntryPoint entryPoint,
1005*8975f5c5SAndroid Build Coastguard Worker                                     TextureTarget target,
1006*8975f5c5SAndroid Build Coastguard Worker                                     GLint level,
1007*8975f5c5SAndroid Build Coastguard Worker                                     GLenum pname,
1008*8975f5c5SAndroid Build Coastguard Worker                                     const GLint *params)
1009*8975f5c5SAndroid Build Coastguard Worker {
1010*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
1011*8975f5c5SAndroid Build Coastguard Worker     {
1012*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
1013*8975f5c5SAndroid Build Coastguard Worker         return false;
1014*8975f5c5SAndroid Build Coastguard Worker     }
1015*8975f5c5SAndroid Build Coastguard Worker 
1016*8975f5c5SAndroid Build Coastguard Worker     return ValidateGetTexLevelParameterBase(context, entryPoint, target, level, pname, nullptr);
1017*8975f5c5SAndroid Build Coastguard Worker }
1018*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetTexLevelParameterivRobustANGLE(const Context * context,angle::EntryPoint entryPoint,TextureTarget target,GLint level,GLenum pname,GLsizei bufSize,const GLsizei * length,const GLint * params)1019*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetTexLevelParameterivRobustANGLE(const Context *context,
1020*8975f5c5SAndroid Build Coastguard Worker                                                angle::EntryPoint entryPoint,
1021*8975f5c5SAndroid Build Coastguard Worker                                                TextureTarget target,
1022*8975f5c5SAndroid Build Coastguard Worker                                                GLint level,
1023*8975f5c5SAndroid Build Coastguard Worker                                                GLenum pname,
1024*8975f5c5SAndroid Build Coastguard Worker                                                GLsizei bufSize,
1025*8975f5c5SAndroid Build Coastguard Worker                                                const GLsizei *length,
1026*8975f5c5SAndroid Build Coastguard Worker                                                const GLint *params)
1027*8975f5c5SAndroid Build Coastguard Worker {
1028*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
1029*8975f5c5SAndroid Build Coastguard Worker     return false;
1030*8975f5c5SAndroid Build Coastguard Worker }
1031*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexStorage2DMultisample(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLsizei samples,GLenum internalFormat,GLsizei width,GLsizei height,GLboolean fixedSampleLocations)1032*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexStorage2DMultisample(const Context *context,
1033*8975f5c5SAndroid Build Coastguard Worker                                      angle::EntryPoint entryPoint,
1034*8975f5c5SAndroid Build Coastguard Worker                                      TextureType target,
1035*8975f5c5SAndroid Build Coastguard Worker                                      GLsizei samples,
1036*8975f5c5SAndroid Build Coastguard Worker                                      GLenum internalFormat,
1037*8975f5c5SAndroid Build Coastguard Worker                                      GLsizei width,
1038*8975f5c5SAndroid Build Coastguard Worker                                      GLsizei height,
1039*8975f5c5SAndroid Build Coastguard Worker                                      GLboolean fixedSampleLocations)
1040*8975f5c5SAndroid Build Coastguard Worker {
1041*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
1042*8975f5c5SAndroid Build Coastguard Worker     {
1043*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
1044*8975f5c5SAndroid Build Coastguard Worker         return false;
1045*8975f5c5SAndroid Build Coastguard Worker     }
1046*8975f5c5SAndroid Build Coastguard Worker 
1047*8975f5c5SAndroid Build Coastguard Worker     return ValidateTexStorage2DMultisampleBase(context, entryPoint, target, samples, internalFormat,
1048*8975f5c5SAndroid Build Coastguard Worker                                                width, height);
1049*8975f5c5SAndroid Build Coastguard Worker }
1050*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexStorageMem2DMultisampleEXT(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLsizei samples,GLenum internalFormat,GLsizei width,GLsizei height,GLboolean fixedSampleLocations,MemoryObjectID memory,GLuint64 offset)1051*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexStorageMem2DMultisampleEXT(const Context *context,
1052*8975f5c5SAndroid Build Coastguard Worker                                            angle::EntryPoint entryPoint,
1053*8975f5c5SAndroid Build Coastguard Worker                                            TextureType target,
1054*8975f5c5SAndroid Build Coastguard Worker                                            GLsizei samples,
1055*8975f5c5SAndroid Build Coastguard Worker                                            GLenum internalFormat,
1056*8975f5c5SAndroid Build Coastguard Worker                                            GLsizei width,
1057*8975f5c5SAndroid Build Coastguard Worker                                            GLsizei height,
1058*8975f5c5SAndroid Build Coastguard Worker                                            GLboolean fixedSampleLocations,
1059*8975f5c5SAndroid Build Coastguard Worker                                            MemoryObjectID memory,
1060*8975f5c5SAndroid Build Coastguard Worker                                            GLuint64 offset)
1061*8975f5c5SAndroid Build Coastguard Worker {
1062*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().memoryObjectEXT)
1063*8975f5c5SAndroid Build Coastguard Worker     {
1064*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
1065*8975f5c5SAndroid Build Coastguard Worker         return false;
1066*8975f5c5SAndroid Build Coastguard Worker     }
1067*8975f5c5SAndroid Build Coastguard Worker 
1068*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
1069*8975f5c5SAndroid Build Coastguard Worker     return false;
1070*8975f5c5SAndroid Build Coastguard Worker }
1071*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetMultisamplefv(const Context * context,angle::EntryPoint entryPoint,GLenum pname,GLuint index,const GLfloat * val)1072*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetMultisamplefv(const Context *context,
1073*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
1074*8975f5c5SAndroid Build Coastguard Worker                               GLenum pname,
1075*8975f5c5SAndroid Build Coastguard Worker                               GLuint index,
1076*8975f5c5SAndroid Build Coastguard Worker                               const GLfloat *val)
1077*8975f5c5SAndroid Build Coastguard Worker {
1078*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
1079*8975f5c5SAndroid Build Coastguard Worker     {
1080*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
1081*8975f5c5SAndroid Build Coastguard Worker         return false;
1082*8975f5c5SAndroid Build Coastguard Worker     }
1083*8975f5c5SAndroid Build Coastguard Worker 
1084*8975f5c5SAndroid Build Coastguard Worker     return ValidateGetMultisamplefvBase(context, entryPoint, pname, index, val);
1085*8975f5c5SAndroid Build Coastguard Worker }
1086*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetMultisamplefvRobustANGLE(const Context * context,angle::EntryPoint entryPoint,GLenum pname,GLuint index,GLsizei bufSize,const GLsizei * length,const GLfloat * val)1087*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetMultisamplefvRobustANGLE(const Context *context,
1088*8975f5c5SAndroid Build Coastguard Worker                                          angle::EntryPoint entryPoint,
1089*8975f5c5SAndroid Build Coastguard Worker                                          GLenum pname,
1090*8975f5c5SAndroid Build Coastguard Worker                                          GLuint index,
1091*8975f5c5SAndroid Build Coastguard Worker                                          GLsizei bufSize,
1092*8975f5c5SAndroid Build Coastguard Worker                                          const GLsizei *length,
1093*8975f5c5SAndroid Build Coastguard Worker                                          const GLfloat *val)
1094*8975f5c5SAndroid Build Coastguard Worker {
1095*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
1096*8975f5c5SAndroid Build Coastguard Worker     return false;
1097*8975f5c5SAndroid Build Coastguard Worker }
1098*8975f5c5SAndroid Build Coastguard Worker 
ValidateFramebufferParameteri(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum pname,GLint param)1099*8975f5c5SAndroid Build Coastguard Worker bool ValidateFramebufferParameteri(const Context *context,
1100*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
1101*8975f5c5SAndroid Build Coastguard Worker                                    GLenum target,
1102*8975f5c5SAndroid Build Coastguard Worker                                    GLenum pname,
1103*8975f5c5SAndroid Build Coastguard Worker                                    GLint param)
1104*8975f5c5SAndroid Build Coastguard Worker {
1105*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
1106*8975f5c5SAndroid Build Coastguard Worker     {
1107*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
1108*8975f5c5SAndroid Build Coastguard Worker         return false;
1109*8975f5c5SAndroid Build Coastguard Worker     }
1110*8975f5c5SAndroid Build Coastguard Worker 
1111*8975f5c5SAndroid Build Coastguard Worker     return ValidateFramebufferParameteriBase(context, entryPoint, target, pname, param);
1112*8975f5c5SAndroid Build Coastguard Worker }
1113*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetFramebufferParameteriv(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum pname,const GLint * params)1114*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetFramebufferParameteriv(const Context *context,
1115*8975f5c5SAndroid Build Coastguard Worker                                        angle::EntryPoint entryPoint,
1116*8975f5c5SAndroid Build Coastguard Worker                                        GLenum target,
1117*8975f5c5SAndroid Build Coastguard Worker                                        GLenum pname,
1118*8975f5c5SAndroid Build Coastguard Worker                                        const GLint *params)
1119*8975f5c5SAndroid Build Coastguard Worker {
1120*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
1121*8975f5c5SAndroid Build Coastguard Worker     {
1122*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
1123*8975f5c5SAndroid Build Coastguard Worker         return false;
1124*8975f5c5SAndroid Build Coastguard Worker     }
1125*8975f5c5SAndroid Build Coastguard Worker 
1126*8975f5c5SAndroid Build Coastguard Worker     return ValidateGetFramebufferParameterivBase(context, entryPoint, target, pname, params);
1127*8975f5c5SAndroid Build Coastguard Worker }
1128*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetFramebufferParameterivRobustANGLE(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum pname,GLsizei bufSize,const GLsizei * length,const GLint * params)1129*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetFramebufferParameterivRobustANGLE(const Context *context,
1130*8975f5c5SAndroid Build Coastguard Worker                                                   angle::EntryPoint entryPoint,
1131*8975f5c5SAndroid Build Coastguard Worker                                                   GLenum target,
1132*8975f5c5SAndroid Build Coastguard Worker                                                   GLenum pname,
1133*8975f5c5SAndroid Build Coastguard Worker                                                   GLsizei bufSize,
1134*8975f5c5SAndroid Build Coastguard Worker                                                   const GLsizei *length,
1135*8975f5c5SAndroid Build Coastguard Worker                                                   const GLint *params)
1136*8975f5c5SAndroid Build Coastguard Worker {
1137*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
1138*8975f5c5SAndroid Build Coastguard Worker     return false;
1139*8975f5c5SAndroid Build Coastguard Worker }
1140*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetProgramResourceIndex(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,GLenum programInterface,const GLchar * name)1141*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetProgramResourceIndex(const Context *context,
1142*8975f5c5SAndroid Build Coastguard Worker                                      angle::EntryPoint entryPoint,
1143*8975f5c5SAndroid Build Coastguard Worker                                      ShaderProgramID program,
1144*8975f5c5SAndroid Build Coastguard Worker                                      GLenum programInterface,
1145*8975f5c5SAndroid Build Coastguard Worker                                      const GLchar *name)
1146*8975f5c5SAndroid Build Coastguard Worker {
1147*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
1148*8975f5c5SAndroid Build Coastguard Worker     {
1149*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
1150*8975f5c5SAndroid Build Coastguard Worker         return false;
1151*8975f5c5SAndroid Build Coastguard Worker     }
1152*8975f5c5SAndroid Build Coastguard Worker 
1153*8975f5c5SAndroid Build Coastguard Worker     Program *programObject = GetValidProgram(context, entryPoint, program);
1154*8975f5c5SAndroid Build Coastguard Worker     if (programObject == nullptr)
1155*8975f5c5SAndroid Build Coastguard Worker     {
1156*8975f5c5SAndroid Build Coastguard Worker         return false;
1157*8975f5c5SAndroid Build Coastguard Worker     }
1158*8975f5c5SAndroid Build Coastguard Worker 
1159*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateNamedProgramInterface(programInterface))
1160*8975f5c5SAndroid Build Coastguard Worker     {
1161*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidProgramInterface);
1162*8975f5c5SAndroid Build Coastguard Worker         return false;
1163*8975f5c5SAndroid Build Coastguard Worker     }
1164*8975f5c5SAndroid Build Coastguard Worker 
1165*8975f5c5SAndroid Build Coastguard Worker     return true;
1166*8975f5c5SAndroid Build Coastguard Worker }
1167*8975f5c5SAndroid Build Coastguard Worker 
ValidateBindVertexBuffer(const Context * context,angle::EntryPoint entryPoint,GLuint bindingIndex,BufferID buffer,GLintptr offset,GLsizei stride)1168*8975f5c5SAndroid Build Coastguard Worker bool ValidateBindVertexBuffer(const Context *context,
1169*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
1170*8975f5c5SAndroid Build Coastguard Worker                               GLuint bindingIndex,
1171*8975f5c5SAndroid Build Coastguard Worker                               BufferID buffer,
1172*8975f5c5SAndroid Build Coastguard Worker                               GLintptr offset,
1173*8975f5c5SAndroid Build Coastguard Worker                               GLsizei stride)
1174*8975f5c5SAndroid Build Coastguard Worker {
1175*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
1176*8975f5c5SAndroid Build Coastguard Worker     {
1177*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
1178*8975f5c5SAndroid Build Coastguard Worker         return false;
1179*8975f5c5SAndroid Build Coastguard Worker     }
1180*8975f5c5SAndroid Build Coastguard Worker 
1181*8975f5c5SAndroid Build Coastguard Worker     if (!context->isBufferGenerated(buffer))
1182*8975f5c5SAndroid Build Coastguard Worker     {
1183*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kObjectNotGenerated);
1184*8975f5c5SAndroid Build Coastguard Worker         return false;
1185*8975f5c5SAndroid Build Coastguard Worker     }
1186*8975f5c5SAndroid Build Coastguard Worker 
1187*8975f5c5SAndroid Build Coastguard Worker     const Caps &caps = context->getCaps();
1188*8975f5c5SAndroid Build Coastguard Worker     if (bindingIndex >= static_cast<GLuint>(caps.maxVertexAttribBindings))
1189*8975f5c5SAndroid Build Coastguard Worker     {
1190*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kExceedsMaxVertexAttribBindings);
1191*8975f5c5SAndroid Build Coastguard Worker         return false;
1192*8975f5c5SAndroid Build Coastguard Worker     }
1193*8975f5c5SAndroid Build Coastguard Worker 
1194*8975f5c5SAndroid Build Coastguard Worker     if (offset < 0)
1195*8975f5c5SAndroid Build Coastguard Worker     {
1196*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNegativeOffset);
1197*8975f5c5SAndroid Build Coastguard Worker         return false;
1198*8975f5c5SAndroid Build Coastguard Worker     }
1199*8975f5c5SAndroid Build Coastguard Worker 
1200*8975f5c5SAndroid Build Coastguard Worker     if (stride < 0 || stride > caps.maxVertexAttribStride)
1201*8975f5c5SAndroid Build Coastguard Worker     {
1202*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kExceedsMaxVertexAttribStride);
1203*8975f5c5SAndroid Build Coastguard Worker         return false;
1204*8975f5c5SAndroid Build Coastguard Worker     }
1205*8975f5c5SAndroid Build Coastguard Worker 
1206*8975f5c5SAndroid Build Coastguard Worker     // [OpenGL ES 3.1] Section 10.3.1 page 244:
1207*8975f5c5SAndroid Build Coastguard Worker     // An INVALID_OPERATION error is generated if the default vertex array object is bound.
1208*8975f5c5SAndroid Build Coastguard Worker     if (context->getState().getVertexArrayId().value == 0)
1209*8975f5c5SAndroid Build Coastguard Worker     {
1210*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kDefaultVertexArray);
1211*8975f5c5SAndroid Build Coastguard Worker         return false;
1212*8975f5c5SAndroid Build Coastguard Worker     }
1213*8975f5c5SAndroid Build Coastguard Worker 
1214*8975f5c5SAndroid Build Coastguard Worker     return true;
1215*8975f5c5SAndroid Build Coastguard Worker }
1216*8975f5c5SAndroid Build Coastguard Worker 
ValidateVertexBindingDivisor(const Context * context,angle::EntryPoint entryPoint,GLuint bindingIndex,GLuint divisor)1217*8975f5c5SAndroid Build Coastguard Worker bool ValidateVertexBindingDivisor(const Context *context,
1218*8975f5c5SAndroid Build Coastguard Worker                                   angle::EntryPoint entryPoint,
1219*8975f5c5SAndroid Build Coastguard Worker                                   GLuint bindingIndex,
1220*8975f5c5SAndroid Build Coastguard Worker                                   GLuint divisor)
1221*8975f5c5SAndroid Build Coastguard Worker {
1222*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
1223*8975f5c5SAndroid Build Coastguard Worker     {
1224*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
1225*8975f5c5SAndroid Build Coastguard Worker         return false;
1226*8975f5c5SAndroid Build Coastguard Worker     }
1227*8975f5c5SAndroid Build Coastguard Worker 
1228*8975f5c5SAndroid Build Coastguard Worker     const Caps &caps = context->getCaps();
1229*8975f5c5SAndroid Build Coastguard Worker     if (bindingIndex >= static_cast<GLuint>(caps.maxVertexAttribBindings))
1230*8975f5c5SAndroid Build Coastguard Worker     {
1231*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kExceedsMaxVertexAttribBindings);
1232*8975f5c5SAndroid Build Coastguard Worker         return false;
1233*8975f5c5SAndroid Build Coastguard Worker     }
1234*8975f5c5SAndroid Build Coastguard Worker 
1235*8975f5c5SAndroid Build Coastguard Worker     // [OpenGL ES 3.1] Section 10.3.1 page 243:
1236*8975f5c5SAndroid Build Coastguard Worker     // An INVALID_OPERATION error is generated if the default vertex array object is bound.
1237*8975f5c5SAndroid Build Coastguard Worker     if (context->getState().getVertexArrayId().value == 0)
1238*8975f5c5SAndroid Build Coastguard Worker     {
1239*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kDefaultVertexArray);
1240*8975f5c5SAndroid Build Coastguard Worker         return false;
1241*8975f5c5SAndroid Build Coastguard Worker     }
1242*8975f5c5SAndroid Build Coastguard Worker 
1243*8975f5c5SAndroid Build Coastguard Worker     return true;
1244*8975f5c5SAndroid Build Coastguard Worker }
1245*8975f5c5SAndroid Build Coastguard Worker 
ValidateVertexAttribFormat(const Context * context,angle::EntryPoint entryPoint,GLuint attribindex,GLint size,VertexAttribType type,GLboolean normalized,GLuint relativeoffset)1246*8975f5c5SAndroid Build Coastguard Worker bool ValidateVertexAttribFormat(const Context *context,
1247*8975f5c5SAndroid Build Coastguard Worker                                 angle::EntryPoint entryPoint,
1248*8975f5c5SAndroid Build Coastguard Worker                                 GLuint attribindex,
1249*8975f5c5SAndroid Build Coastguard Worker                                 GLint size,
1250*8975f5c5SAndroid Build Coastguard Worker                                 VertexAttribType type,
1251*8975f5c5SAndroid Build Coastguard Worker                                 GLboolean normalized,
1252*8975f5c5SAndroid Build Coastguard Worker                                 GLuint relativeoffset)
1253*8975f5c5SAndroid Build Coastguard Worker {
1254*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateVertexAttribFormatCommon(context, entryPoint, relativeoffset))
1255*8975f5c5SAndroid Build Coastguard Worker     {
1256*8975f5c5SAndroid Build Coastguard Worker         return false;
1257*8975f5c5SAndroid Build Coastguard Worker     }
1258*8975f5c5SAndroid Build Coastguard Worker 
1259*8975f5c5SAndroid Build Coastguard Worker     return ValidateFloatVertexFormat(context, entryPoint, attribindex, size, type);
1260*8975f5c5SAndroid Build Coastguard Worker }
1261*8975f5c5SAndroid Build Coastguard Worker 
ValidateVertexAttribIFormat(const Context * context,angle::EntryPoint entryPoint,GLuint attribindex,GLint size,VertexAttribType type,GLuint relativeoffset)1262*8975f5c5SAndroid Build Coastguard Worker bool ValidateVertexAttribIFormat(const Context *context,
1263*8975f5c5SAndroid Build Coastguard Worker                                  angle::EntryPoint entryPoint,
1264*8975f5c5SAndroid Build Coastguard Worker                                  GLuint attribindex,
1265*8975f5c5SAndroid Build Coastguard Worker                                  GLint size,
1266*8975f5c5SAndroid Build Coastguard Worker                                  VertexAttribType type,
1267*8975f5c5SAndroid Build Coastguard Worker                                  GLuint relativeoffset)
1268*8975f5c5SAndroid Build Coastguard Worker {
1269*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateVertexAttribFormatCommon(context, entryPoint, relativeoffset))
1270*8975f5c5SAndroid Build Coastguard Worker     {
1271*8975f5c5SAndroid Build Coastguard Worker         return false;
1272*8975f5c5SAndroid Build Coastguard Worker     }
1273*8975f5c5SAndroid Build Coastguard Worker 
1274*8975f5c5SAndroid Build Coastguard Worker     return ValidateIntegerVertexFormat(context, entryPoint, attribindex, size, type);
1275*8975f5c5SAndroid Build Coastguard Worker }
1276*8975f5c5SAndroid Build Coastguard Worker 
ValidateVertexAttribBinding(const Context * context,angle::EntryPoint entryPoint,GLuint attribIndex,GLuint bindingIndex)1277*8975f5c5SAndroid Build Coastguard Worker bool ValidateVertexAttribBinding(const Context *context,
1278*8975f5c5SAndroid Build Coastguard Worker                                  angle::EntryPoint entryPoint,
1279*8975f5c5SAndroid Build Coastguard Worker                                  GLuint attribIndex,
1280*8975f5c5SAndroid Build Coastguard Worker                                  GLuint bindingIndex)
1281*8975f5c5SAndroid Build Coastguard Worker {
1282*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
1283*8975f5c5SAndroid Build Coastguard Worker     {
1284*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
1285*8975f5c5SAndroid Build Coastguard Worker         return false;
1286*8975f5c5SAndroid Build Coastguard Worker     }
1287*8975f5c5SAndroid Build Coastguard Worker 
1288*8975f5c5SAndroid Build Coastguard Worker     // [OpenGL ES 3.1] Section 10.3.1 page 243:
1289*8975f5c5SAndroid Build Coastguard Worker     // An INVALID_OPERATION error is generated if the default vertex array object is bound.
1290*8975f5c5SAndroid Build Coastguard Worker     if (context->getState().getVertexArrayId().value == 0)
1291*8975f5c5SAndroid Build Coastguard Worker     {
1292*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kDefaultVertexArray);
1293*8975f5c5SAndroid Build Coastguard Worker         return false;
1294*8975f5c5SAndroid Build Coastguard Worker     }
1295*8975f5c5SAndroid Build Coastguard Worker 
1296*8975f5c5SAndroid Build Coastguard Worker     const Caps &caps = context->getCaps();
1297*8975f5c5SAndroid Build Coastguard Worker     if (attribIndex >= static_cast<GLuint>(caps.maxVertexAttributes))
1298*8975f5c5SAndroid Build Coastguard Worker     {
1299*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kIndexExceedsMaxVertexAttribute);
1300*8975f5c5SAndroid Build Coastguard Worker         return false;
1301*8975f5c5SAndroid Build Coastguard Worker     }
1302*8975f5c5SAndroid Build Coastguard Worker 
1303*8975f5c5SAndroid Build Coastguard Worker     if (bindingIndex >= static_cast<GLuint>(caps.maxVertexAttribBindings))
1304*8975f5c5SAndroid Build Coastguard Worker     {
1305*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kExceedsMaxVertexAttribBindings);
1306*8975f5c5SAndroid Build Coastguard Worker         return false;
1307*8975f5c5SAndroid Build Coastguard Worker     }
1308*8975f5c5SAndroid Build Coastguard Worker 
1309*8975f5c5SAndroid Build Coastguard Worker     return true;
1310*8975f5c5SAndroid Build Coastguard Worker }
1311*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetProgramResourceName(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,GLenum programInterface,GLuint index,GLsizei bufSize,const GLsizei * length,const GLchar * name)1312*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetProgramResourceName(const Context *context,
1313*8975f5c5SAndroid Build Coastguard Worker                                     angle::EntryPoint entryPoint,
1314*8975f5c5SAndroid Build Coastguard Worker                                     ShaderProgramID program,
1315*8975f5c5SAndroid Build Coastguard Worker                                     GLenum programInterface,
1316*8975f5c5SAndroid Build Coastguard Worker                                     GLuint index,
1317*8975f5c5SAndroid Build Coastguard Worker                                     GLsizei bufSize,
1318*8975f5c5SAndroid Build Coastguard Worker                                     const GLsizei *length,
1319*8975f5c5SAndroid Build Coastguard Worker                                     const GLchar *name)
1320*8975f5c5SAndroid Build Coastguard Worker {
1321*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
1322*8975f5c5SAndroid Build Coastguard Worker     {
1323*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
1324*8975f5c5SAndroid Build Coastguard Worker         return false;
1325*8975f5c5SAndroid Build Coastguard Worker     }
1326*8975f5c5SAndroid Build Coastguard Worker 
1327*8975f5c5SAndroid Build Coastguard Worker     Program *programObject = GetValidProgram(context, entryPoint, program);
1328*8975f5c5SAndroid Build Coastguard Worker     if (programObject == nullptr)
1329*8975f5c5SAndroid Build Coastguard Worker     {
1330*8975f5c5SAndroid Build Coastguard Worker         return false;
1331*8975f5c5SAndroid Build Coastguard Worker     }
1332*8975f5c5SAndroid Build Coastguard Worker 
1333*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateNamedProgramInterface(programInterface))
1334*8975f5c5SAndroid Build Coastguard Worker     {
1335*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidProgramInterface);
1336*8975f5c5SAndroid Build Coastguard Worker         return false;
1337*8975f5c5SAndroid Build Coastguard Worker     }
1338*8975f5c5SAndroid Build Coastguard Worker 
1339*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateProgramResourceIndex(programObject, programInterface, index))
1340*8975f5c5SAndroid Build Coastguard Worker     {
1341*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidProgramResourceIndex);
1342*8975f5c5SAndroid Build Coastguard Worker         return false;
1343*8975f5c5SAndroid Build Coastguard Worker     }
1344*8975f5c5SAndroid Build Coastguard Worker 
1345*8975f5c5SAndroid Build Coastguard Worker     if (bufSize < 0)
1346*8975f5c5SAndroid Build Coastguard Worker     {
1347*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNegativeBufferSize);
1348*8975f5c5SAndroid Build Coastguard Worker         return false;
1349*8975f5c5SAndroid Build Coastguard Worker     }
1350*8975f5c5SAndroid Build Coastguard Worker 
1351*8975f5c5SAndroid Build Coastguard Worker     return true;
1352*8975f5c5SAndroid Build Coastguard Worker }
1353*8975f5c5SAndroid Build Coastguard Worker 
ValidateDispatchCompute(const Context * context,angle::EntryPoint entryPoint,GLuint numGroupsX,GLuint numGroupsY,GLuint numGroupsZ)1354*8975f5c5SAndroid Build Coastguard Worker bool ValidateDispatchCompute(const Context *context,
1355*8975f5c5SAndroid Build Coastguard Worker                              angle::EntryPoint entryPoint,
1356*8975f5c5SAndroid Build Coastguard Worker                              GLuint numGroupsX,
1357*8975f5c5SAndroid Build Coastguard Worker                              GLuint numGroupsY,
1358*8975f5c5SAndroid Build Coastguard Worker                              GLuint numGroupsZ)
1359*8975f5c5SAndroid Build Coastguard Worker {
1360*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
1361*8975f5c5SAndroid Build Coastguard Worker     {
1362*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
1363*8975f5c5SAndroid Build Coastguard Worker         return false;
1364*8975f5c5SAndroid Build Coastguard Worker     }
1365*8975f5c5SAndroid Build Coastguard Worker 
1366*8975f5c5SAndroid Build Coastguard Worker     const State &state                  = context->getState();
1367*8975f5c5SAndroid Build Coastguard Worker     const ProgramExecutable *executable = state.getLinkedProgramExecutable(context);
1368*8975f5c5SAndroid Build Coastguard Worker 
1369*8975f5c5SAndroid Build Coastguard Worker     if (executable == nullptr || !executable->hasLinkedShaderStage(ShaderType::Compute))
1370*8975f5c5SAndroid Build Coastguard Worker     {
1371*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kNoActiveProgramWithComputeShader);
1372*8975f5c5SAndroid Build Coastguard Worker         return false;
1373*8975f5c5SAndroid Build Coastguard Worker     }
1374*8975f5c5SAndroid Build Coastguard Worker 
1375*8975f5c5SAndroid Build Coastguard Worker     const Caps &caps = context->getCaps();
1376*8975f5c5SAndroid Build Coastguard Worker     if (numGroupsX > static_cast<GLuint>(caps.maxComputeWorkGroupCount[0]))
1377*8975f5c5SAndroid Build Coastguard Worker     {
1378*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kExceedsComputeWorkGroupCountX);
1379*8975f5c5SAndroid Build Coastguard Worker         return false;
1380*8975f5c5SAndroid Build Coastguard Worker     }
1381*8975f5c5SAndroid Build Coastguard Worker     if (numGroupsY > static_cast<GLuint>(caps.maxComputeWorkGroupCount[1]))
1382*8975f5c5SAndroid Build Coastguard Worker     {
1383*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kExceedsComputeWorkGroupCountY);
1384*8975f5c5SAndroid Build Coastguard Worker         return false;
1385*8975f5c5SAndroid Build Coastguard Worker     }
1386*8975f5c5SAndroid Build Coastguard Worker     if (numGroupsZ > static_cast<GLuint>(caps.maxComputeWorkGroupCount[2]))
1387*8975f5c5SAndroid Build Coastguard Worker     {
1388*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kExceedsComputeWorkGroupCountZ);
1389*8975f5c5SAndroid Build Coastguard Worker         return false;
1390*8975f5c5SAndroid Build Coastguard Worker     }
1391*8975f5c5SAndroid Build Coastguard Worker 
1392*8975f5c5SAndroid Build Coastguard Worker     return true;
1393*8975f5c5SAndroid Build Coastguard Worker }
1394*8975f5c5SAndroid Build Coastguard Worker 
ValidateDispatchComputeIndirect(const Context * context,angle::EntryPoint entryPoint,GLintptr indirect)1395*8975f5c5SAndroid Build Coastguard Worker bool ValidateDispatchComputeIndirect(const Context *context,
1396*8975f5c5SAndroid Build Coastguard Worker                                      angle::EntryPoint entryPoint,
1397*8975f5c5SAndroid Build Coastguard Worker                                      GLintptr indirect)
1398*8975f5c5SAndroid Build Coastguard Worker {
1399*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
1400*8975f5c5SAndroid Build Coastguard Worker     {
1401*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
1402*8975f5c5SAndroid Build Coastguard Worker         return false;
1403*8975f5c5SAndroid Build Coastguard Worker     }
1404*8975f5c5SAndroid Build Coastguard Worker 
1405*8975f5c5SAndroid Build Coastguard Worker     const State &state                  = context->getState();
1406*8975f5c5SAndroid Build Coastguard Worker     const ProgramExecutable *executable = state.getProgramExecutable();
1407*8975f5c5SAndroid Build Coastguard Worker 
1408*8975f5c5SAndroid Build Coastguard Worker     if (executable == nullptr || !executable->hasLinkedShaderStage(ShaderType::Compute))
1409*8975f5c5SAndroid Build Coastguard Worker     {
1410*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kNoActiveProgramWithComputeShader);
1411*8975f5c5SAndroid Build Coastguard Worker         return false;
1412*8975f5c5SAndroid Build Coastguard Worker     }
1413*8975f5c5SAndroid Build Coastguard Worker 
1414*8975f5c5SAndroid Build Coastguard Worker     if (indirect < 0)
1415*8975f5c5SAndroid Build Coastguard Worker     {
1416*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNegativeOffset);
1417*8975f5c5SAndroid Build Coastguard Worker         return false;
1418*8975f5c5SAndroid Build Coastguard Worker     }
1419*8975f5c5SAndroid Build Coastguard Worker 
1420*8975f5c5SAndroid Build Coastguard Worker     if ((indirect & (sizeof(GLuint) - 1)) != 0)
1421*8975f5c5SAndroid Build Coastguard Worker     {
1422*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kOffsetMustBeMultipleOfUint);
1423*8975f5c5SAndroid Build Coastguard Worker         return false;
1424*8975f5c5SAndroid Build Coastguard Worker     }
1425*8975f5c5SAndroid Build Coastguard Worker 
1426*8975f5c5SAndroid Build Coastguard Worker     Buffer *dispatchIndirectBuffer = state.getTargetBuffer(BufferBinding::DispatchIndirect);
1427*8975f5c5SAndroid Build Coastguard Worker     if (!dispatchIndirectBuffer)
1428*8975f5c5SAndroid Build Coastguard Worker     {
1429*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kDispatchIndirectBufferNotBound);
1430*8975f5c5SAndroid Build Coastguard Worker         return false;
1431*8975f5c5SAndroid Build Coastguard Worker     }
1432*8975f5c5SAndroid Build Coastguard Worker 
1433*8975f5c5SAndroid Build Coastguard Worker     CheckedNumeric<GLuint64> checkedOffset(static_cast<GLuint64>(indirect));
1434*8975f5c5SAndroid Build Coastguard Worker     auto checkedSum = checkedOffset + static_cast<GLuint64>(3 * sizeof(GLuint));
1435*8975f5c5SAndroid Build Coastguard Worker     if (!checkedSum.IsValid() ||
1436*8975f5c5SAndroid Build Coastguard Worker         checkedSum.ValueOrDie() > static_cast<GLuint64>(dispatchIndirectBuffer->getSize()))
1437*8975f5c5SAndroid Build Coastguard Worker     {
1438*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInsufficientBufferSize);
1439*8975f5c5SAndroid Build Coastguard Worker         return false;
1440*8975f5c5SAndroid Build Coastguard Worker     }
1441*8975f5c5SAndroid Build Coastguard Worker 
1442*8975f5c5SAndroid Build Coastguard Worker     return true;
1443*8975f5c5SAndroid Build Coastguard Worker }
1444*8975f5c5SAndroid Build Coastguard Worker 
ValidateBindImageTexture(const Context * context,angle::EntryPoint entryPoint,GLuint unit,TextureID texture,GLint level,GLboolean layered,GLint layer,GLenum access,GLenum format)1445*8975f5c5SAndroid Build Coastguard Worker bool ValidateBindImageTexture(const Context *context,
1446*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
1447*8975f5c5SAndroid Build Coastguard Worker                               GLuint unit,
1448*8975f5c5SAndroid Build Coastguard Worker                               TextureID texture,
1449*8975f5c5SAndroid Build Coastguard Worker                               GLint level,
1450*8975f5c5SAndroid Build Coastguard Worker                               GLboolean layered,
1451*8975f5c5SAndroid Build Coastguard Worker                               GLint layer,
1452*8975f5c5SAndroid Build Coastguard Worker                               GLenum access,
1453*8975f5c5SAndroid Build Coastguard Worker                               GLenum format)
1454*8975f5c5SAndroid Build Coastguard Worker {
1455*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
1456*8975f5c5SAndroid Build Coastguard Worker     {
1457*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
1458*8975f5c5SAndroid Build Coastguard Worker         return false;
1459*8975f5c5SAndroid Build Coastguard Worker     }
1460*8975f5c5SAndroid Build Coastguard Worker 
1461*8975f5c5SAndroid Build Coastguard Worker     GLuint maxImageUnits = static_cast<GLuint>(context->getCaps().maxImageUnits);
1462*8975f5c5SAndroid Build Coastguard Worker     if (unit >= maxImageUnits)
1463*8975f5c5SAndroid Build Coastguard Worker     {
1464*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kExceedsMaxImageUnits);
1465*8975f5c5SAndroid Build Coastguard Worker         return false;
1466*8975f5c5SAndroid Build Coastguard Worker     }
1467*8975f5c5SAndroid Build Coastguard Worker 
1468*8975f5c5SAndroid Build Coastguard Worker     if (level < 0)
1469*8975f5c5SAndroid Build Coastguard Worker     {
1470*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNegativeLevel);
1471*8975f5c5SAndroid Build Coastguard Worker         return false;
1472*8975f5c5SAndroid Build Coastguard Worker     }
1473*8975f5c5SAndroid Build Coastguard Worker 
1474*8975f5c5SAndroid Build Coastguard Worker     if (layer < 0)
1475*8975f5c5SAndroid Build Coastguard Worker     {
1476*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNegativeLayer);
1477*8975f5c5SAndroid Build Coastguard Worker         return false;
1478*8975f5c5SAndroid Build Coastguard Worker     }
1479*8975f5c5SAndroid Build Coastguard Worker 
1480*8975f5c5SAndroid Build Coastguard Worker     if (access != GL_READ_ONLY && access != GL_WRITE_ONLY && access != GL_READ_WRITE)
1481*8975f5c5SAndroid Build Coastguard Worker     {
1482*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidImageAccess);
1483*8975f5c5SAndroid Build Coastguard Worker         return false;
1484*8975f5c5SAndroid Build Coastguard Worker     }
1485*8975f5c5SAndroid Build Coastguard Worker 
1486*8975f5c5SAndroid Build Coastguard Worker     switch (format)
1487*8975f5c5SAndroid Build Coastguard Worker     {
1488*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA32F:
1489*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA16F:
1490*8975f5c5SAndroid Build Coastguard Worker         case GL_R32F:
1491*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA32UI:
1492*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA16UI:
1493*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA8UI:
1494*8975f5c5SAndroid Build Coastguard Worker         case GL_R32UI:
1495*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA32I:
1496*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA16I:
1497*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA8I:
1498*8975f5c5SAndroid Build Coastguard Worker         case GL_R32I:
1499*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA8:
1500*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA8_SNORM:
1501*8975f5c5SAndroid Build Coastguard Worker             break;
1502*8975f5c5SAndroid Build Coastguard Worker         default:
1503*8975f5c5SAndroid Build Coastguard Worker             ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidImageFormat);
1504*8975f5c5SAndroid Build Coastguard Worker             return false;
1505*8975f5c5SAndroid Build Coastguard Worker     }
1506*8975f5c5SAndroid Build Coastguard Worker 
1507*8975f5c5SAndroid Build Coastguard Worker     if (texture.value != 0)
1508*8975f5c5SAndroid Build Coastguard Worker     {
1509*8975f5c5SAndroid Build Coastguard Worker         Texture *tex = context->getTexture(texture);
1510*8975f5c5SAndroid Build Coastguard Worker 
1511*8975f5c5SAndroid Build Coastguard Worker         if (tex == nullptr)
1512*8975f5c5SAndroid Build Coastguard Worker         {
1513*8975f5c5SAndroid Build Coastguard Worker             ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kMissingTextureName);
1514*8975f5c5SAndroid Build Coastguard Worker             return false;
1515*8975f5c5SAndroid Build Coastguard Worker         }
1516*8975f5c5SAndroid Build Coastguard Worker 
1517*8975f5c5SAndroid Build Coastguard Worker         if (!tex->getImmutableFormat() && tex->getType() != gl::TextureType::Buffer)
1518*8975f5c5SAndroid Build Coastguard Worker         {
1519*8975f5c5SAndroid Build Coastguard Worker             ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION,
1520*8975f5c5SAndroid Build Coastguard Worker                                    kTextureIsNeitherImmutableNorTextureBuffer);
1521*8975f5c5SAndroid Build Coastguard Worker             return false;
1522*8975f5c5SAndroid Build Coastguard Worker         }
1523*8975f5c5SAndroid Build Coastguard Worker 
1524*8975f5c5SAndroid Build Coastguard Worker         if (context->getExtensions().textureStorageCompressionEXT &&
1525*8975f5c5SAndroid Build Coastguard Worker             tex->getType() != gl::TextureType::Buffer)
1526*8975f5c5SAndroid Build Coastguard Worker         {
1527*8975f5c5SAndroid Build Coastguard Worker             if (tex->getImageCompressionRate(context) != GL_SURFACE_COMPRESSION_FIXED_RATE_NONE_EXT)
1528*8975f5c5SAndroid Build Coastguard Worker             {
1529*8975f5c5SAndroid Build Coastguard Worker                 ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE,
1530*8975f5c5SAndroid Build Coastguard Worker                                        kTextureFixedCompressedNotSupportBindImageTexture);
1531*8975f5c5SAndroid Build Coastguard Worker                 return false;
1532*8975f5c5SAndroid Build Coastguard Worker             }
1533*8975f5c5SAndroid Build Coastguard Worker         }
1534*8975f5c5SAndroid Build Coastguard Worker     }
1535*8975f5c5SAndroid Build Coastguard Worker 
1536*8975f5c5SAndroid Build Coastguard Worker     return true;
1537*8975f5c5SAndroid Build Coastguard Worker }
1538*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetProgramResourceLocation(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,GLenum programInterface,const GLchar * name)1539*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetProgramResourceLocation(const Context *context,
1540*8975f5c5SAndroid Build Coastguard Worker                                         angle::EntryPoint entryPoint,
1541*8975f5c5SAndroid Build Coastguard Worker                                         ShaderProgramID program,
1542*8975f5c5SAndroid Build Coastguard Worker                                         GLenum programInterface,
1543*8975f5c5SAndroid Build Coastguard Worker                                         const GLchar *name)
1544*8975f5c5SAndroid Build Coastguard Worker {
1545*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
1546*8975f5c5SAndroid Build Coastguard Worker     {
1547*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
1548*8975f5c5SAndroid Build Coastguard Worker         return false;
1549*8975f5c5SAndroid Build Coastguard Worker     }
1550*8975f5c5SAndroid Build Coastguard Worker 
1551*8975f5c5SAndroid Build Coastguard Worker     Program *programObject = GetValidProgram(context, entryPoint, program);
1552*8975f5c5SAndroid Build Coastguard Worker     if (programObject == nullptr)
1553*8975f5c5SAndroid Build Coastguard Worker     {
1554*8975f5c5SAndroid Build Coastguard Worker         return false;
1555*8975f5c5SAndroid Build Coastguard Worker     }
1556*8975f5c5SAndroid Build Coastguard Worker 
1557*8975f5c5SAndroid Build Coastguard Worker     if (!programObject->isLinked())
1558*8975f5c5SAndroid Build Coastguard Worker     {
1559*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kProgramNotLinked);
1560*8975f5c5SAndroid Build Coastguard Worker         return false;
1561*8975f5c5SAndroid Build Coastguard Worker     }
1562*8975f5c5SAndroid Build Coastguard Worker 
1563*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateLocationProgramInterface(programInterface))
1564*8975f5c5SAndroid Build Coastguard Worker     {
1565*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidProgramInterface);
1566*8975f5c5SAndroid Build Coastguard Worker         return false;
1567*8975f5c5SAndroid Build Coastguard Worker     }
1568*8975f5c5SAndroid Build Coastguard Worker     return true;
1569*8975f5c5SAndroid Build Coastguard Worker }
1570*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetProgramResourceiv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,GLenum programInterface,GLuint index,GLsizei propCount,const GLenum * props,GLsizei bufSize,const GLsizei * length,const GLint * params)1571*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetProgramResourceiv(const Context *context,
1572*8975f5c5SAndroid Build Coastguard Worker                                   angle::EntryPoint entryPoint,
1573*8975f5c5SAndroid Build Coastguard Worker                                   ShaderProgramID program,
1574*8975f5c5SAndroid Build Coastguard Worker                                   GLenum programInterface,
1575*8975f5c5SAndroid Build Coastguard Worker                                   GLuint index,
1576*8975f5c5SAndroid Build Coastguard Worker                                   GLsizei propCount,
1577*8975f5c5SAndroid Build Coastguard Worker                                   const GLenum *props,
1578*8975f5c5SAndroid Build Coastguard Worker                                   GLsizei bufSize,
1579*8975f5c5SAndroid Build Coastguard Worker                                   const GLsizei *length,
1580*8975f5c5SAndroid Build Coastguard Worker                                   const GLint *params)
1581*8975f5c5SAndroid Build Coastguard Worker {
1582*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
1583*8975f5c5SAndroid Build Coastguard Worker     {
1584*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
1585*8975f5c5SAndroid Build Coastguard Worker         return false;
1586*8975f5c5SAndroid Build Coastguard Worker     }
1587*8975f5c5SAndroid Build Coastguard Worker 
1588*8975f5c5SAndroid Build Coastguard Worker     Program *programObject = GetValidProgram(context, entryPoint, program);
1589*8975f5c5SAndroid Build Coastguard Worker     if (programObject == nullptr)
1590*8975f5c5SAndroid Build Coastguard Worker     {
1591*8975f5c5SAndroid Build Coastguard Worker         return false;
1592*8975f5c5SAndroid Build Coastguard Worker     }
1593*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateProgramInterface(programInterface))
1594*8975f5c5SAndroid Build Coastguard Worker     {
1595*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidProgramInterface);
1596*8975f5c5SAndroid Build Coastguard Worker         return false;
1597*8975f5c5SAndroid Build Coastguard Worker     }
1598*8975f5c5SAndroid Build Coastguard Worker     if (propCount <= 0)
1599*8975f5c5SAndroid Build Coastguard Worker     {
1600*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidPropCount);
1601*8975f5c5SAndroid Build Coastguard Worker         return false;
1602*8975f5c5SAndroid Build Coastguard Worker     }
1603*8975f5c5SAndroid Build Coastguard Worker     if (bufSize < 0)
1604*8975f5c5SAndroid Build Coastguard Worker     {
1605*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNegativeBufSize);
1606*8975f5c5SAndroid Build Coastguard Worker         return false;
1607*8975f5c5SAndroid Build Coastguard Worker     }
1608*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateProgramResourceIndex(programObject, programInterface, index))
1609*8975f5c5SAndroid Build Coastguard Worker     {
1610*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidProgramResourceIndex);
1611*8975f5c5SAndroid Build Coastguard Worker         return false;
1612*8975f5c5SAndroid Build Coastguard Worker     }
1613*8975f5c5SAndroid Build Coastguard Worker     for (GLsizei i = 0; i < propCount; i++)
1614*8975f5c5SAndroid Build Coastguard Worker     {
1615*8975f5c5SAndroid Build Coastguard Worker         if (!ValidateProgramResourceProperty(context, entryPoint, props[i]))
1616*8975f5c5SAndroid Build Coastguard Worker         {
1617*8975f5c5SAndroid Build Coastguard Worker             ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidProgramResourceProperty);
1618*8975f5c5SAndroid Build Coastguard Worker             return false;
1619*8975f5c5SAndroid Build Coastguard Worker         }
1620*8975f5c5SAndroid Build Coastguard Worker         if (!ValidateProgramResourcePropertyByInterface(props[i], programInterface))
1621*8975f5c5SAndroid Build Coastguard Worker         {
1622*8975f5c5SAndroid Build Coastguard Worker             ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidPropertyForProgramInterface);
1623*8975f5c5SAndroid Build Coastguard Worker             return false;
1624*8975f5c5SAndroid Build Coastguard Worker         }
1625*8975f5c5SAndroid Build Coastguard Worker     }
1626*8975f5c5SAndroid Build Coastguard Worker     return true;
1627*8975f5c5SAndroid Build Coastguard Worker }
1628*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetProgramInterfaceiv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,GLenum programInterface,GLenum pname,const GLint * params)1629*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetProgramInterfaceiv(const Context *context,
1630*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
1631*8975f5c5SAndroid Build Coastguard Worker                                    ShaderProgramID program,
1632*8975f5c5SAndroid Build Coastguard Worker                                    GLenum programInterface,
1633*8975f5c5SAndroid Build Coastguard Worker                                    GLenum pname,
1634*8975f5c5SAndroid Build Coastguard Worker                                    const GLint *params)
1635*8975f5c5SAndroid Build Coastguard Worker {
1636*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
1637*8975f5c5SAndroid Build Coastguard Worker     {
1638*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
1639*8975f5c5SAndroid Build Coastguard Worker         return false;
1640*8975f5c5SAndroid Build Coastguard Worker     }
1641*8975f5c5SAndroid Build Coastguard Worker 
1642*8975f5c5SAndroid Build Coastguard Worker     Program *programObject = GetValidProgram(context, entryPoint, program);
1643*8975f5c5SAndroid Build Coastguard Worker     if (programObject == nullptr)
1644*8975f5c5SAndroid Build Coastguard Worker     {
1645*8975f5c5SAndroid Build Coastguard Worker         return false;
1646*8975f5c5SAndroid Build Coastguard Worker     }
1647*8975f5c5SAndroid Build Coastguard Worker 
1648*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateProgramInterface(programInterface))
1649*8975f5c5SAndroid Build Coastguard Worker     {
1650*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidProgramInterface);
1651*8975f5c5SAndroid Build Coastguard Worker         return false;
1652*8975f5c5SAndroid Build Coastguard Worker     }
1653*8975f5c5SAndroid Build Coastguard Worker 
1654*8975f5c5SAndroid Build Coastguard Worker     switch (pname)
1655*8975f5c5SAndroid Build Coastguard Worker     {
1656*8975f5c5SAndroid Build Coastguard Worker         case GL_ACTIVE_RESOURCES:
1657*8975f5c5SAndroid Build Coastguard Worker         case GL_MAX_NAME_LENGTH:
1658*8975f5c5SAndroid Build Coastguard Worker         case GL_MAX_NUM_ACTIVE_VARIABLES:
1659*8975f5c5SAndroid Build Coastguard Worker             break;
1660*8975f5c5SAndroid Build Coastguard Worker 
1661*8975f5c5SAndroid Build Coastguard Worker         default:
1662*8975f5c5SAndroid Build Coastguard Worker             ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidPname);
1663*8975f5c5SAndroid Build Coastguard Worker             return false;
1664*8975f5c5SAndroid Build Coastguard Worker     }
1665*8975f5c5SAndroid Build Coastguard Worker 
1666*8975f5c5SAndroid Build Coastguard Worker     if (pname == GL_MAX_NAME_LENGTH && programInterface == GL_ATOMIC_COUNTER_BUFFER)
1667*8975f5c5SAndroid Build Coastguard Worker     {
1668*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kAtomicCounterResourceName);
1669*8975f5c5SAndroid Build Coastguard Worker         return false;
1670*8975f5c5SAndroid Build Coastguard Worker     }
1671*8975f5c5SAndroid Build Coastguard Worker 
1672*8975f5c5SAndroid Build Coastguard Worker     if (pname == GL_MAX_NUM_ACTIVE_VARIABLES)
1673*8975f5c5SAndroid Build Coastguard Worker     {
1674*8975f5c5SAndroid Build Coastguard Worker         switch (programInterface)
1675*8975f5c5SAndroid Build Coastguard Worker         {
1676*8975f5c5SAndroid Build Coastguard Worker             case GL_ATOMIC_COUNTER_BUFFER:
1677*8975f5c5SAndroid Build Coastguard Worker             case GL_SHADER_STORAGE_BLOCK:
1678*8975f5c5SAndroid Build Coastguard Worker             case GL_UNIFORM_BLOCK:
1679*8975f5c5SAndroid Build Coastguard Worker                 break;
1680*8975f5c5SAndroid Build Coastguard Worker 
1681*8975f5c5SAndroid Build Coastguard Worker             default:
1682*8975f5c5SAndroid Build Coastguard Worker                 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kMaxActiveVariablesInterface);
1683*8975f5c5SAndroid Build Coastguard Worker                 return false;
1684*8975f5c5SAndroid Build Coastguard Worker         }
1685*8975f5c5SAndroid Build Coastguard Worker     }
1686*8975f5c5SAndroid Build Coastguard Worker 
1687*8975f5c5SAndroid Build Coastguard Worker     return true;
1688*8975f5c5SAndroid Build Coastguard Worker }
1689*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetProgramInterfaceivRobustANGLE(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,GLenum programInterface,GLenum pname,GLsizei bufSize,const GLsizei * length,const GLint * params)1690*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetProgramInterfaceivRobustANGLE(const Context *context,
1691*8975f5c5SAndroid Build Coastguard Worker                                               angle::EntryPoint entryPoint,
1692*8975f5c5SAndroid Build Coastguard Worker                                               ShaderProgramID program,
1693*8975f5c5SAndroid Build Coastguard Worker                                               GLenum programInterface,
1694*8975f5c5SAndroid Build Coastguard Worker                                               GLenum pname,
1695*8975f5c5SAndroid Build Coastguard Worker                                               GLsizei bufSize,
1696*8975f5c5SAndroid Build Coastguard Worker                                               const GLsizei *length,
1697*8975f5c5SAndroid Build Coastguard Worker                                               const GLint *params)
1698*8975f5c5SAndroid Build Coastguard Worker {
1699*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
1700*8975f5c5SAndroid Build Coastguard Worker     return false;
1701*8975f5c5SAndroid Build Coastguard Worker }
1702*8975f5c5SAndroid Build Coastguard Worker 
ValidateGenProgramPipelinesBase(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const ProgramPipelineID * pipelines)1703*8975f5c5SAndroid Build Coastguard Worker bool ValidateGenProgramPipelinesBase(const Context *context,
1704*8975f5c5SAndroid Build Coastguard Worker                                      angle::EntryPoint entryPoint,
1705*8975f5c5SAndroid Build Coastguard Worker                                      GLsizei n,
1706*8975f5c5SAndroid Build Coastguard Worker                                      const ProgramPipelineID *pipelines)
1707*8975f5c5SAndroid Build Coastguard Worker {
1708*8975f5c5SAndroid Build Coastguard Worker     return ValidateGenOrDelete(context, entryPoint, n);
1709*8975f5c5SAndroid Build Coastguard Worker }
1710*8975f5c5SAndroid Build Coastguard Worker 
ValidateDeleteProgramPipelinesBase(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const ProgramPipelineID * pipelines)1711*8975f5c5SAndroid Build Coastguard Worker bool ValidateDeleteProgramPipelinesBase(const Context *context,
1712*8975f5c5SAndroid Build Coastguard Worker                                         angle::EntryPoint entryPoint,
1713*8975f5c5SAndroid Build Coastguard Worker                                         GLsizei n,
1714*8975f5c5SAndroid Build Coastguard Worker                                         const ProgramPipelineID *pipelines)
1715*8975f5c5SAndroid Build Coastguard Worker {
1716*8975f5c5SAndroid Build Coastguard Worker     return ValidateGenOrDelete(context, entryPoint, n);
1717*8975f5c5SAndroid Build Coastguard Worker }
1718*8975f5c5SAndroid Build Coastguard Worker 
ValidateBindProgramPipelineBase(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipeline)1719*8975f5c5SAndroid Build Coastguard Worker bool ValidateBindProgramPipelineBase(const Context *context,
1720*8975f5c5SAndroid Build Coastguard Worker                                      angle::EntryPoint entryPoint,
1721*8975f5c5SAndroid Build Coastguard Worker                                      ProgramPipelineID pipeline)
1722*8975f5c5SAndroid Build Coastguard Worker {
1723*8975f5c5SAndroid Build Coastguard Worker     if (!context->isProgramPipelineGenerated({pipeline}))
1724*8975f5c5SAndroid Build Coastguard Worker     {
1725*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kObjectNotGenerated);
1726*8975f5c5SAndroid Build Coastguard Worker         return false;
1727*8975f5c5SAndroid Build Coastguard Worker     }
1728*8975f5c5SAndroid Build Coastguard Worker 
1729*8975f5c5SAndroid Build Coastguard Worker     return true;
1730*8975f5c5SAndroid Build Coastguard Worker }
1731*8975f5c5SAndroid Build Coastguard Worker 
ValidateIsProgramPipelineBase(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipeline)1732*8975f5c5SAndroid Build Coastguard Worker bool ValidateIsProgramPipelineBase(const Context *context,
1733*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
1734*8975f5c5SAndroid Build Coastguard Worker                                    ProgramPipelineID pipeline)
1735*8975f5c5SAndroid Build Coastguard Worker {
1736*8975f5c5SAndroid Build Coastguard Worker     return true;
1737*8975f5c5SAndroid Build Coastguard Worker }
1738*8975f5c5SAndroid Build Coastguard Worker 
ValidateUseProgramStagesBase(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipeline,GLbitfield stages,ShaderProgramID programId)1739*8975f5c5SAndroid Build Coastguard Worker bool ValidateUseProgramStagesBase(const Context *context,
1740*8975f5c5SAndroid Build Coastguard Worker                                   angle::EntryPoint entryPoint,
1741*8975f5c5SAndroid Build Coastguard Worker                                   ProgramPipelineID pipeline,
1742*8975f5c5SAndroid Build Coastguard Worker                                   GLbitfield stages,
1743*8975f5c5SAndroid Build Coastguard Worker                                   ShaderProgramID programId)
1744*8975f5c5SAndroid Build Coastguard Worker {
1745*8975f5c5SAndroid Build Coastguard Worker     // GL_INVALID_VALUE is generated if shaders contains set bits that are not recognized, and is
1746*8975f5c5SAndroid Build Coastguard Worker     // not the reserved value GL_ALL_SHADER_BITS.
1747*8975f5c5SAndroid Build Coastguard Worker     GLbitfield knownShaderBits =
1748*8975f5c5SAndroid Build Coastguard Worker         GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT | GL_COMPUTE_SHADER_BIT;
1749*8975f5c5SAndroid Build Coastguard Worker 
1750*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() >= ES_3_2 || context->getExtensions().geometryShaderAny())
1751*8975f5c5SAndroid Build Coastguard Worker     {
1752*8975f5c5SAndroid Build Coastguard Worker         knownShaderBits |= GL_GEOMETRY_SHADER_BIT;
1753*8975f5c5SAndroid Build Coastguard Worker     }
1754*8975f5c5SAndroid Build Coastguard Worker 
1755*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() >= ES_3_2 || context->getExtensions().tessellationShaderAny())
1756*8975f5c5SAndroid Build Coastguard Worker     {
1757*8975f5c5SAndroid Build Coastguard Worker         knownShaderBits |= GL_TESS_CONTROL_SHADER_BIT;
1758*8975f5c5SAndroid Build Coastguard Worker         knownShaderBits |= GL_TESS_EVALUATION_SHADER_BIT;
1759*8975f5c5SAndroid Build Coastguard Worker     }
1760*8975f5c5SAndroid Build Coastguard Worker 
1761*8975f5c5SAndroid Build Coastguard Worker     if ((stages & ~knownShaderBits) && (stages != GL_ALL_SHADER_BITS))
1762*8975f5c5SAndroid Build Coastguard Worker     {
1763*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kUnrecognizedShaderStageBit);
1764*8975f5c5SAndroid Build Coastguard Worker         return false;
1765*8975f5c5SAndroid Build Coastguard Worker     }
1766*8975f5c5SAndroid Build Coastguard Worker 
1767*8975f5c5SAndroid Build Coastguard Worker     // GL_INVALID_OPERATION is generated if pipeline is not a name previously returned from a call
1768*8975f5c5SAndroid Build Coastguard Worker     // to glGenProgramPipelines or if such a name has been deleted by a call to
1769*8975f5c5SAndroid Build Coastguard Worker     // glDeleteProgramPipelines.
1770*8975f5c5SAndroid Build Coastguard Worker     if (!context->isProgramPipelineGenerated({pipeline}))
1771*8975f5c5SAndroid Build Coastguard Worker     {
1772*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kObjectNotGenerated);
1773*8975f5c5SAndroid Build Coastguard Worker         return false;
1774*8975f5c5SAndroid Build Coastguard Worker     }
1775*8975f5c5SAndroid Build Coastguard Worker 
1776*8975f5c5SAndroid Build Coastguard Worker     // If program is zero, or refers to a program object with no valid shader executable for a given
1777*8975f5c5SAndroid Build Coastguard Worker     // stage, it is as if the pipeline object has no programmable stage configured for the indicated
1778*8975f5c5SAndroid Build Coastguard Worker     // shader stages.
1779*8975f5c5SAndroid Build Coastguard Worker     if (programId.value == 0)
1780*8975f5c5SAndroid Build Coastguard Worker     {
1781*8975f5c5SAndroid Build Coastguard Worker         return true;
1782*8975f5c5SAndroid Build Coastguard Worker     }
1783*8975f5c5SAndroid Build Coastguard Worker 
1784*8975f5c5SAndroid Build Coastguard Worker     Program *program = context->getProgramNoResolveLink(programId);
1785*8975f5c5SAndroid Build Coastguard Worker     if (!program)
1786*8975f5c5SAndroid Build Coastguard Worker     {
1787*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kProgramDoesNotExist);
1788*8975f5c5SAndroid Build Coastguard Worker         return false;
1789*8975f5c5SAndroid Build Coastguard Worker     }
1790*8975f5c5SAndroid Build Coastguard Worker 
1791*8975f5c5SAndroid Build Coastguard Worker     // GL_INVALID_OPERATION is generated if program refers to a program object that was not linked
1792*8975f5c5SAndroid Build Coastguard Worker     // with its GL_PROGRAM_SEPARABLE status set.
1793*8975f5c5SAndroid Build Coastguard Worker     // resolveLink() may not have been called if glCreateShaderProgramv() was not used and
1794*8975f5c5SAndroid Build Coastguard Worker     // glDetachShader() was not called.
1795*8975f5c5SAndroid Build Coastguard Worker     program->resolveLink(context);
1796*8975f5c5SAndroid Build Coastguard Worker     if (!program->isSeparable())
1797*8975f5c5SAndroid Build Coastguard Worker     {
1798*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kProgramNotSeparable);
1799*8975f5c5SAndroid Build Coastguard Worker         return false;
1800*8975f5c5SAndroid Build Coastguard Worker     }
1801*8975f5c5SAndroid Build Coastguard Worker 
1802*8975f5c5SAndroid Build Coastguard Worker     // GL_INVALID_OPERATION is generated if program refers to a program object that has not been
1803*8975f5c5SAndroid Build Coastguard Worker     // successfully linked.
1804*8975f5c5SAndroid Build Coastguard Worker     if (!program->isLinked())
1805*8975f5c5SAndroid Build Coastguard Worker     {
1806*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kProgramNotLinked);
1807*8975f5c5SAndroid Build Coastguard Worker         return false;
1808*8975f5c5SAndroid Build Coastguard Worker     }
1809*8975f5c5SAndroid Build Coastguard Worker 
1810*8975f5c5SAndroid Build Coastguard Worker     return true;
1811*8975f5c5SAndroid Build Coastguard Worker }
1812*8975f5c5SAndroid Build Coastguard Worker 
ValidateActiveShaderProgramBase(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipeline,ShaderProgramID programId)1813*8975f5c5SAndroid Build Coastguard Worker bool ValidateActiveShaderProgramBase(const Context *context,
1814*8975f5c5SAndroid Build Coastguard Worker                                      angle::EntryPoint entryPoint,
1815*8975f5c5SAndroid Build Coastguard Worker                                      ProgramPipelineID pipeline,
1816*8975f5c5SAndroid Build Coastguard Worker                                      ShaderProgramID programId)
1817*8975f5c5SAndroid Build Coastguard Worker {
1818*8975f5c5SAndroid Build Coastguard Worker     // An INVALID_OPERATION error is generated if pipeline is not a name returned from a previous
1819*8975f5c5SAndroid Build Coastguard Worker     // call to GenProgramPipelines or if such a name has since been deleted by
1820*8975f5c5SAndroid Build Coastguard Worker     // DeleteProgramPipelines.
1821*8975f5c5SAndroid Build Coastguard Worker     if (!context->isProgramPipelineGenerated({pipeline}))
1822*8975f5c5SAndroid Build Coastguard Worker     {
1823*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kObjectNotGenerated);
1824*8975f5c5SAndroid Build Coastguard Worker         return false;
1825*8975f5c5SAndroid Build Coastguard Worker     }
1826*8975f5c5SAndroid Build Coastguard Worker 
1827*8975f5c5SAndroid Build Coastguard Worker     // An INVALID_VALUE error is generated if program is not zero and is not the name of either a
1828*8975f5c5SAndroid Build Coastguard Worker     // program or shader object.
1829*8975f5c5SAndroid Build Coastguard Worker     if ((programId.value != 0) && !context->isProgram(programId) && !context->isShader(programId))
1830*8975f5c5SAndroid Build Coastguard Worker     {
1831*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kProgramDoesNotExist);
1832*8975f5c5SAndroid Build Coastguard Worker         return false;
1833*8975f5c5SAndroid Build Coastguard Worker     }
1834*8975f5c5SAndroid Build Coastguard Worker 
1835*8975f5c5SAndroid Build Coastguard Worker     // An INVALID_OPERATION error is generated if program is the name of a shader object.
1836*8975f5c5SAndroid Build Coastguard Worker     if (context->isShader(programId))
1837*8975f5c5SAndroid Build Coastguard Worker     {
1838*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExpectedProgramName);
1839*8975f5c5SAndroid Build Coastguard Worker         return false;
1840*8975f5c5SAndroid Build Coastguard Worker     }
1841*8975f5c5SAndroid Build Coastguard Worker 
1842*8975f5c5SAndroid Build Coastguard Worker     // An INVALID_OPERATION error is generated if program is not zero and has not been linked, or
1843*8975f5c5SAndroid Build Coastguard Worker     // was last linked unsuccessfully. The active program is not modified.
1844*8975f5c5SAndroid Build Coastguard Worker     Program *program = context->getProgramNoResolveLink(programId);
1845*8975f5c5SAndroid Build Coastguard Worker     if ((programId.value != 0) && !program->isLinked())
1846*8975f5c5SAndroid Build Coastguard Worker     {
1847*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kProgramNotLinked);
1848*8975f5c5SAndroid Build Coastguard Worker         return false;
1849*8975f5c5SAndroid Build Coastguard Worker     }
1850*8975f5c5SAndroid Build Coastguard Worker 
1851*8975f5c5SAndroid Build Coastguard Worker     return true;
1852*8975f5c5SAndroid Build Coastguard Worker }
1853*8975f5c5SAndroid Build Coastguard Worker 
ValidateCreateShaderProgramvBase(const Context * context,angle::EntryPoint entryPoint,ShaderType type,GLsizei count,const GLchar * const * strings)1854*8975f5c5SAndroid Build Coastguard Worker bool ValidateCreateShaderProgramvBase(const Context *context,
1855*8975f5c5SAndroid Build Coastguard Worker                                       angle::EntryPoint entryPoint,
1856*8975f5c5SAndroid Build Coastguard Worker                                       ShaderType type,
1857*8975f5c5SAndroid Build Coastguard Worker                                       GLsizei count,
1858*8975f5c5SAndroid Build Coastguard Worker                                       const GLchar *const *strings)
1859*8975f5c5SAndroid Build Coastguard Worker {
1860*8975f5c5SAndroid Build Coastguard Worker     switch (type)
1861*8975f5c5SAndroid Build Coastguard Worker     {
1862*8975f5c5SAndroid Build Coastguard Worker         case ShaderType::InvalidEnum:
1863*8975f5c5SAndroid Build Coastguard Worker             ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidShaderType);
1864*8975f5c5SAndroid Build Coastguard Worker             return false;
1865*8975f5c5SAndroid Build Coastguard Worker         case ShaderType::Vertex:
1866*8975f5c5SAndroid Build Coastguard Worker         case ShaderType::Fragment:
1867*8975f5c5SAndroid Build Coastguard Worker         case ShaderType::Compute:
1868*8975f5c5SAndroid Build Coastguard Worker             break;
1869*8975f5c5SAndroid Build Coastguard Worker         case ShaderType::Geometry:
1870*8975f5c5SAndroid Build Coastguard Worker             if (!context->getExtensions().geometryShaderAny() &&
1871*8975f5c5SAndroid Build Coastguard Worker                 context->getClientVersion() < ES_3_2)
1872*8975f5c5SAndroid Build Coastguard Worker             {
1873*8975f5c5SAndroid Build Coastguard Worker                 ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidShaderType);
1874*8975f5c5SAndroid Build Coastguard Worker                 return false;
1875*8975f5c5SAndroid Build Coastguard Worker             }
1876*8975f5c5SAndroid Build Coastguard Worker             break;
1877*8975f5c5SAndroid Build Coastguard Worker         case ShaderType::TessControl:
1878*8975f5c5SAndroid Build Coastguard Worker         case ShaderType::TessEvaluation:
1879*8975f5c5SAndroid Build Coastguard Worker             if (!context->getExtensions().tessellationShaderAny() &&
1880*8975f5c5SAndroid Build Coastguard Worker                 context->getClientVersion() < ES_3_2)
1881*8975f5c5SAndroid Build Coastguard Worker             {
1882*8975f5c5SAndroid Build Coastguard Worker                 ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidShaderType);
1883*8975f5c5SAndroid Build Coastguard Worker                 return false;
1884*8975f5c5SAndroid Build Coastguard Worker             }
1885*8975f5c5SAndroid Build Coastguard Worker             break;
1886*8975f5c5SAndroid Build Coastguard Worker         default:
1887*8975f5c5SAndroid Build Coastguard Worker             UNREACHABLE();
1888*8975f5c5SAndroid Build Coastguard Worker     }
1889*8975f5c5SAndroid Build Coastguard Worker 
1890*8975f5c5SAndroid Build Coastguard Worker     // GL_INVALID_VALUE is generated if count is negative.
1891*8975f5c5SAndroid Build Coastguard Worker     if (count < 0)
1892*8975f5c5SAndroid Build Coastguard Worker     {
1893*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNegativeCount);
1894*8975f5c5SAndroid Build Coastguard Worker         return false;
1895*8975f5c5SAndroid Build Coastguard Worker     }
1896*8975f5c5SAndroid Build Coastguard Worker 
1897*8975f5c5SAndroid Build Coastguard Worker     return true;
1898*8975f5c5SAndroid Build Coastguard Worker }
1899*8975f5c5SAndroid Build Coastguard Worker 
ValidateCreateShaderProgramvBase(const Context * context,angle::EntryPoint entryPoint,ShaderType type,GLsizei count,const GLchar ** strings)1900*8975f5c5SAndroid Build Coastguard Worker bool ValidateCreateShaderProgramvBase(const Context *context,
1901*8975f5c5SAndroid Build Coastguard Worker                                       angle::EntryPoint entryPoint,
1902*8975f5c5SAndroid Build Coastguard Worker                                       ShaderType type,
1903*8975f5c5SAndroid Build Coastguard Worker                                       GLsizei count,
1904*8975f5c5SAndroid Build Coastguard Worker                                       const GLchar **strings)
1905*8975f5c5SAndroid Build Coastguard Worker {
1906*8975f5c5SAndroid Build Coastguard Worker     const GLchar *const *tmpStrings = strings;
1907*8975f5c5SAndroid Build Coastguard Worker     return ValidateCreateShaderProgramvBase(context, entryPoint, type, count, tmpStrings);
1908*8975f5c5SAndroid Build Coastguard Worker }
1909*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetProgramPipelineivBase(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipeline,GLenum pname,const GLint * params)1910*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetProgramPipelineivBase(const Context *context,
1911*8975f5c5SAndroid Build Coastguard Worker                                       angle::EntryPoint entryPoint,
1912*8975f5c5SAndroid Build Coastguard Worker                                       ProgramPipelineID pipeline,
1913*8975f5c5SAndroid Build Coastguard Worker                                       GLenum pname,
1914*8975f5c5SAndroid Build Coastguard Worker                                       const GLint *params)
1915*8975f5c5SAndroid Build Coastguard Worker {
1916*8975f5c5SAndroid Build Coastguard Worker     // An INVALID_OPERATION error is generated if pipeline is not a name returned from a previous
1917*8975f5c5SAndroid Build Coastguard Worker     // call to GenProgramPipelines or if such a name has since been deleted by
1918*8975f5c5SAndroid Build Coastguard Worker     // DeleteProgramPipelines.
1919*8975f5c5SAndroid Build Coastguard Worker     if ((pipeline.value == 0) || (!context->isProgramPipelineGenerated(pipeline)))
1920*8975f5c5SAndroid Build Coastguard Worker     {
1921*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kProgramPipelineDoesNotExist);
1922*8975f5c5SAndroid Build Coastguard Worker         return false;
1923*8975f5c5SAndroid Build Coastguard Worker     }
1924*8975f5c5SAndroid Build Coastguard Worker 
1925*8975f5c5SAndroid Build Coastguard Worker     // An INVALID_ENUM error is generated if pname is not ACTIVE_PROGRAM,
1926*8975f5c5SAndroid Build Coastguard Worker     // INFO_LOG_LENGTH, VALIDATE_STATUS, or one of the type arguments in
1927*8975f5c5SAndroid Build Coastguard Worker     // table 7.1.
1928*8975f5c5SAndroid Build Coastguard Worker     switch (pname)
1929*8975f5c5SAndroid Build Coastguard Worker     {
1930*8975f5c5SAndroid Build Coastguard Worker         case GL_ACTIVE_PROGRAM:
1931*8975f5c5SAndroid Build Coastguard Worker         case GL_INFO_LOG_LENGTH:
1932*8975f5c5SAndroid Build Coastguard Worker         case GL_VALIDATE_STATUS:
1933*8975f5c5SAndroid Build Coastguard Worker         case GL_VERTEX_SHADER:
1934*8975f5c5SAndroid Build Coastguard Worker         case GL_FRAGMENT_SHADER:
1935*8975f5c5SAndroid Build Coastguard Worker         case GL_COMPUTE_SHADER:
1936*8975f5c5SAndroid Build Coastguard Worker             break;
1937*8975f5c5SAndroid Build Coastguard Worker         case GL_GEOMETRY_SHADER:
1938*8975f5c5SAndroid Build Coastguard Worker             return context->getExtensions().geometryShaderAny() ||
1939*8975f5c5SAndroid Build Coastguard Worker                    context->getClientVersion() >= ES_3_2;
1940*8975f5c5SAndroid Build Coastguard Worker         case GL_TESS_CONTROL_SHADER:
1941*8975f5c5SAndroid Build Coastguard Worker         case GL_TESS_EVALUATION_SHADER:
1942*8975f5c5SAndroid Build Coastguard Worker             return context->getExtensions().tessellationShaderAny() ||
1943*8975f5c5SAndroid Build Coastguard Worker                    context->getClientVersion() >= ES_3_2;
1944*8975f5c5SAndroid Build Coastguard Worker 
1945*8975f5c5SAndroid Build Coastguard Worker         default:
1946*8975f5c5SAndroid Build Coastguard Worker             ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidPname);
1947*8975f5c5SAndroid Build Coastguard Worker             return false;
1948*8975f5c5SAndroid Build Coastguard Worker     }
1949*8975f5c5SAndroid Build Coastguard Worker 
1950*8975f5c5SAndroid Build Coastguard Worker     return true;
1951*8975f5c5SAndroid Build Coastguard Worker }
1952*8975f5c5SAndroid Build Coastguard Worker 
ValidateValidateProgramPipelineBase(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipeline)1953*8975f5c5SAndroid Build Coastguard Worker bool ValidateValidateProgramPipelineBase(const Context *context,
1954*8975f5c5SAndroid Build Coastguard Worker                                          angle::EntryPoint entryPoint,
1955*8975f5c5SAndroid Build Coastguard Worker                                          ProgramPipelineID pipeline)
1956*8975f5c5SAndroid Build Coastguard Worker {
1957*8975f5c5SAndroid Build Coastguard Worker     if (pipeline.value == 0)
1958*8975f5c5SAndroid Build Coastguard Worker     {
1959*8975f5c5SAndroid Build Coastguard Worker         return false;
1960*8975f5c5SAndroid Build Coastguard Worker     }
1961*8975f5c5SAndroid Build Coastguard Worker 
1962*8975f5c5SAndroid Build Coastguard Worker     if (!context->isProgramPipelineGenerated(pipeline))
1963*8975f5c5SAndroid Build Coastguard Worker     {
1964*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kProgramPipelineDoesNotExist);
1965*8975f5c5SAndroid Build Coastguard Worker         return false;
1966*8975f5c5SAndroid Build Coastguard Worker     }
1967*8975f5c5SAndroid Build Coastguard Worker 
1968*8975f5c5SAndroid Build Coastguard Worker     return true;
1969*8975f5c5SAndroid Build Coastguard Worker }
1970*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetProgramPipelineInfoLogBase(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipeline,GLsizei bufSize,const GLsizei * length,const GLchar * infoLog)1971*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetProgramPipelineInfoLogBase(const Context *context,
1972*8975f5c5SAndroid Build Coastguard Worker                                            angle::EntryPoint entryPoint,
1973*8975f5c5SAndroid Build Coastguard Worker                                            ProgramPipelineID pipeline,
1974*8975f5c5SAndroid Build Coastguard Worker                                            GLsizei bufSize,
1975*8975f5c5SAndroid Build Coastguard Worker                                            const GLsizei *length,
1976*8975f5c5SAndroid Build Coastguard Worker                                            const GLchar *infoLog)
1977*8975f5c5SAndroid Build Coastguard Worker {
1978*8975f5c5SAndroid Build Coastguard Worker     if (bufSize < 0)
1979*8975f5c5SAndroid Build Coastguard Worker     {
1980*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNegativeBufferSize);
1981*8975f5c5SAndroid Build Coastguard Worker         return false;
1982*8975f5c5SAndroid Build Coastguard Worker     }
1983*8975f5c5SAndroid Build Coastguard Worker 
1984*8975f5c5SAndroid Build Coastguard Worker     if (!context->isProgramPipelineGenerated(pipeline))
1985*8975f5c5SAndroid Build Coastguard Worker     {
1986*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kProgramPipelineDoesNotExist);
1987*8975f5c5SAndroid Build Coastguard Worker         return false;
1988*8975f5c5SAndroid Build Coastguard Worker     }
1989*8975f5c5SAndroid Build Coastguard Worker 
1990*8975f5c5SAndroid Build Coastguard Worker     return true;
1991*8975f5c5SAndroid Build Coastguard Worker }
1992*8975f5c5SAndroid Build Coastguard Worker 
ValidateActiveShaderProgram(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipelinePacked,ShaderProgramID programPacked)1993*8975f5c5SAndroid Build Coastguard Worker bool ValidateActiveShaderProgram(const Context *context,
1994*8975f5c5SAndroid Build Coastguard Worker                                  angle::EntryPoint entryPoint,
1995*8975f5c5SAndroid Build Coastguard Worker                                  ProgramPipelineID pipelinePacked,
1996*8975f5c5SAndroid Build Coastguard Worker                                  ShaderProgramID programPacked)
1997*8975f5c5SAndroid Build Coastguard Worker {
1998*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
1999*8975f5c5SAndroid Build Coastguard Worker     {
2000*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2001*8975f5c5SAndroid Build Coastguard Worker         return false;
2002*8975f5c5SAndroid Build Coastguard Worker     }
2003*8975f5c5SAndroid Build Coastguard Worker 
2004*8975f5c5SAndroid Build Coastguard Worker     return ValidateActiveShaderProgramBase(context, entryPoint, pipelinePacked, programPacked);
2005*8975f5c5SAndroid Build Coastguard Worker }
2006*8975f5c5SAndroid Build Coastguard Worker 
ValidateBindProgramPipeline(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipelinePacked)2007*8975f5c5SAndroid Build Coastguard Worker bool ValidateBindProgramPipeline(const Context *context,
2008*8975f5c5SAndroid Build Coastguard Worker                                  angle::EntryPoint entryPoint,
2009*8975f5c5SAndroid Build Coastguard Worker                                  ProgramPipelineID pipelinePacked)
2010*8975f5c5SAndroid Build Coastguard Worker {
2011*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2012*8975f5c5SAndroid Build Coastguard Worker     {
2013*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2014*8975f5c5SAndroid Build Coastguard Worker         return false;
2015*8975f5c5SAndroid Build Coastguard Worker     }
2016*8975f5c5SAndroid Build Coastguard Worker 
2017*8975f5c5SAndroid Build Coastguard Worker     return ValidateBindProgramPipelineBase(context, entryPoint, pipelinePacked);
2018*8975f5c5SAndroid Build Coastguard Worker }
2019*8975f5c5SAndroid Build Coastguard Worker 
ValidateCreateShaderProgramv(const Context * context,angle::EntryPoint entryPoint,ShaderType typePacked,GLsizei count,const GLchar * const * strings)2020*8975f5c5SAndroid Build Coastguard Worker bool ValidateCreateShaderProgramv(const Context *context,
2021*8975f5c5SAndroid Build Coastguard Worker                                   angle::EntryPoint entryPoint,
2022*8975f5c5SAndroid Build Coastguard Worker                                   ShaderType typePacked,
2023*8975f5c5SAndroid Build Coastguard Worker                                   GLsizei count,
2024*8975f5c5SAndroid Build Coastguard Worker                                   const GLchar *const *strings)
2025*8975f5c5SAndroid Build Coastguard Worker {
2026*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2027*8975f5c5SAndroid Build Coastguard Worker     {
2028*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2029*8975f5c5SAndroid Build Coastguard Worker         return false;
2030*8975f5c5SAndroid Build Coastguard Worker     }
2031*8975f5c5SAndroid Build Coastguard Worker 
2032*8975f5c5SAndroid Build Coastguard Worker     return ValidateCreateShaderProgramvBase(context, entryPoint, typePacked, count, strings);
2033*8975f5c5SAndroid Build Coastguard Worker }
2034*8975f5c5SAndroid Build Coastguard Worker 
ValidateDeleteProgramPipelines(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const ProgramPipelineID * pipelinesPacked)2035*8975f5c5SAndroid Build Coastguard Worker bool ValidateDeleteProgramPipelines(const Context *context,
2036*8975f5c5SAndroid Build Coastguard Worker                                     angle::EntryPoint entryPoint,
2037*8975f5c5SAndroid Build Coastguard Worker                                     GLsizei n,
2038*8975f5c5SAndroid Build Coastguard Worker                                     const ProgramPipelineID *pipelinesPacked)
2039*8975f5c5SAndroid Build Coastguard Worker {
2040*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2041*8975f5c5SAndroid Build Coastguard Worker     {
2042*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2043*8975f5c5SAndroid Build Coastguard Worker         return false;
2044*8975f5c5SAndroid Build Coastguard Worker     }
2045*8975f5c5SAndroid Build Coastguard Worker 
2046*8975f5c5SAndroid Build Coastguard Worker     return ValidateDeleteProgramPipelinesBase(context, entryPoint, n, pipelinesPacked);
2047*8975f5c5SAndroid Build Coastguard Worker }
2048*8975f5c5SAndroid Build Coastguard Worker 
ValidateGenProgramPipelines(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const ProgramPipelineID * pipelinesPacked)2049*8975f5c5SAndroid Build Coastguard Worker bool ValidateGenProgramPipelines(const Context *context,
2050*8975f5c5SAndroid Build Coastguard Worker                                  angle::EntryPoint entryPoint,
2051*8975f5c5SAndroid Build Coastguard Worker                                  GLsizei n,
2052*8975f5c5SAndroid Build Coastguard Worker                                  const ProgramPipelineID *pipelinesPacked)
2053*8975f5c5SAndroid Build Coastguard Worker {
2054*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2055*8975f5c5SAndroid Build Coastguard Worker     {
2056*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2057*8975f5c5SAndroid Build Coastguard Worker         return false;
2058*8975f5c5SAndroid Build Coastguard Worker     }
2059*8975f5c5SAndroid Build Coastguard Worker 
2060*8975f5c5SAndroid Build Coastguard Worker     return ValidateGenProgramPipelinesBase(context, entryPoint, n, pipelinesPacked);
2061*8975f5c5SAndroid Build Coastguard Worker }
2062*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetProgramPipelineInfoLog(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipelinePacked,GLsizei bufSize,const GLsizei * length,const GLchar * infoLog)2063*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetProgramPipelineInfoLog(const Context *context,
2064*8975f5c5SAndroid Build Coastguard Worker                                        angle::EntryPoint entryPoint,
2065*8975f5c5SAndroid Build Coastguard Worker                                        ProgramPipelineID pipelinePacked,
2066*8975f5c5SAndroid Build Coastguard Worker                                        GLsizei bufSize,
2067*8975f5c5SAndroid Build Coastguard Worker                                        const GLsizei *length,
2068*8975f5c5SAndroid Build Coastguard Worker                                        const GLchar *infoLog)
2069*8975f5c5SAndroid Build Coastguard Worker {
2070*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2071*8975f5c5SAndroid Build Coastguard Worker     {
2072*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2073*8975f5c5SAndroid Build Coastguard Worker         return false;
2074*8975f5c5SAndroid Build Coastguard Worker     }
2075*8975f5c5SAndroid Build Coastguard Worker 
2076*8975f5c5SAndroid Build Coastguard Worker     return ValidateGetProgramPipelineInfoLogBase(context, entryPoint, pipelinePacked, bufSize,
2077*8975f5c5SAndroid Build Coastguard Worker                                                  length, infoLog);
2078*8975f5c5SAndroid Build Coastguard Worker }
2079*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetProgramPipelineiv(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipelinePacked,GLenum pname,const GLint * params)2080*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetProgramPipelineiv(const Context *context,
2081*8975f5c5SAndroid Build Coastguard Worker                                   angle::EntryPoint entryPoint,
2082*8975f5c5SAndroid Build Coastguard Worker                                   ProgramPipelineID pipelinePacked,
2083*8975f5c5SAndroid Build Coastguard Worker                                   GLenum pname,
2084*8975f5c5SAndroid Build Coastguard Worker                                   const GLint *params)
2085*8975f5c5SAndroid Build Coastguard Worker {
2086*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2087*8975f5c5SAndroid Build Coastguard Worker     {
2088*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2089*8975f5c5SAndroid Build Coastguard Worker         return false;
2090*8975f5c5SAndroid Build Coastguard Worker     }
2091*8975f5c5SAndroid Build Coastguard Worker 
2092*8975f5c5SAndroid Build Coastguard Worker     return ValidateGetProgramPipelineivBase(context, entryPoint, pipelinePacked, pname, params);
2093*8975f5c5SAndroid Build Coastguard Worker }
2094*8975f5c5SAndroid Build Coastguard Worker 
ValidateIsProgramPipeline(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipelinePacked)2095*8975f5c5SAndroid Build Coastguard Worker bool ValidateIsProgramPipeline(const Context *context,
2096*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
2097*8975f5c5SAndroid Build Coastguard Worker                                ProgramPipelineID pipelinePacked)
2098*8975f5c5SAndroid Build Coastguard Worker {
2099*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2100*8975f5c5SAndroid Build Coastguard Worker     {
2101*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2102*8975f5c5SAndroid Build Coastguard Worker         return false;
2103*8975f5c5SAndroid Build Coastguard Worker     }
2104*8975f5c5SAndroid Build Coastguard Worker 
2105*8975f5c5SAndroid Build Coastguard Worker     return ValidateIsProgramPipelineBase(context, entryPoint, pipelinePacked);
2106*8975f5c5SAndroid Build Coastguard Worker }
2107*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform1f(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLfloat v0)2108*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform1f(const Context *context,
2109*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
2110*8975f5c5SAndroid Build Coastguard Worker                               ShaderProgramID programPacked,
2111*8975f5c5SAndroid Build Coastguard Worker                               UniformLocation locationPacked,
2112*8975f5c5SAndroid Build Coastguard Worker                               GLfloat v0)
2113*8975f5c5SAndroid Build Coastguard Worker {
2114*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2115*8975f5c5SAndroid Build Coastguard Worker     {
2116*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2117*8975f5c5SAndroid Build Coastguard Worker         return false;
2118*8975f5c5SAndroid Build Coastguard Worker     }
2119*8975f5c5SAndroid Build Coastguard Worker 
2120*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform1fBase(context, entryPoint, programPacked, locationPacked, v0);
2121*8975f5c5SAndroid Build Coastguard Worker }
2122*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform1fv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLfloat * value)2123*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform1fv(const Context *context,
2124*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
2125*8975f5c5SAndroid Build Coastguard Worker                                ShaderProgramID programPacked,
2126*8975f5c5SAndroid Build Coastguard Worker                                UniformLocation locationPacked,
2127*8975f5c5SAndroid Build Coastguard Worker                                GLsizei count,
2128*8975f5c5SAndroid Build Coastguard Worker                                const GLfloat *value)
2129*8975f5c5SAndroid Build Coastguard Worker {
2130*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2131*8975f5c5SAndroid Build Coastguard Worker     {
2132*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2133*8975f5c5SAndroid Build Coastguard Worker         return false;
2134*8975f5c5SAndroid Build Coastguard Worker     }
2135*8975f5c5SAndroid Build Coastguard Worker 
2136*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform1fvBase(context, entryPoint, programPacked, locationPacked, count,
2137*8975f5c5SAndroid Build Coastguard Worker                                          value);
2138*8975f5c5SAndroid Build Coastguard Worker }
2139*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform1i(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLint v0)2140*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform1i(const Context *context,
2141*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
2142*8975f5c5SAndroid Build Coastguard Worker                               ShaderProgramID programPacked,
2143*8975f5c5SAndroid Build Coastguard Worker                               UniformLocation locationPacked,
2144*8975f5c5SAndroid Build Coastguard Worker                               GLint v0)
2145*8975f5c5SAndroid Build Coastguard Worker {
2146*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2147*8975f5c5SAndroid Build Coastguard Worker     {
2148*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2149*8975f5c5SAndroid Build Coastguard Worker         return false;
2150*8975f5c5SAndroid Build Coastguard Worker     }
2151*8975f5c5SAndroid Build Coastguard Worker 
2152*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform1iBase(context, entryPoint, programPacked, locationPacked, v0);
2153*8975f5c5SAndroid Build Coastguard Worker }
2154*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform1iv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLint * value)2155*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform1iv(const Context *context,
2156*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
2157*8975f5c5SAndroid Build Coastguard Worker                                ShaderProgramID programPacked,
2158*8975f5c5SAndroid Build Coastguard Worker                                UniformLocation locationPacked,
2159*8975f5c5SAndroid Build Coastguard Worker                                GLsizei count,
2160*8975f5c5SAndroid Build Coastguard Worker                                const GLint *value)
2161*8975f5c5SAndroid Build Coastguard Worker {
2162*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2163*8975f5c5SAndroid Build Coastguard Worker     {
2164*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2165*8975f5c5SAndroid Build Coastguard Worker         return false;
2166*8975f5c5SAndroid Build Coastguard Worker     }
2167*8975f5c5SAndroid Build Coastguard Worker 
2168*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform1ivBase(context, entryPoint, programPacked, locationPacked, count,
2169*8975f5c5SAndroid Build Coastguard Worker                                          value);
2170*8975f5c5SAndroid Build Coastguard Worker }
2171*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform1ui(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLuint v0)2172*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform1ui(const Context *context,
2173*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
2174*8975f5c5SAndroid Build Coastguard Worker                                ShaderProgramID programPacked,
2175*8975f5c5SAndroid Build Coastguard Worker                                UniformLocation locationPacked,
2176*8975f5c5SAndroid Build Coastguard Worker                                GLuint v0)
2177*8975f5c5SAndroid Build Coastguard Worker {
2178*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2179*8975f5c5SAndroid Build Coastguard Worker     {
2180*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2181*8975f5c5SAndroid Build Coastguard Worker         return false;
2182*8975f5c5SAndroid Build Coastguard Worker     }
2183*8975f5c5SAndroid Build Coastguard Worker 
2184*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform1uiBase(context, entryPoint, programPacked, locationPacked, v0);
2185*8975f5c5SAndroid Build Coastguard Worker }
2186*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform1uiv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLuint * value)2187*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform1uiv(const Context *context,
2188*8975f5c5SAndroid Build Coastguard Worker                                 angle::EntryPoint entryPoint,
2189*8975f5c5SAndroid Build Coastguard Worker                                 ShaderProgramID programPacked,
2190*8975f5c5SAndroid Build Coastguard Worker                                 UniformLocation locationPacked,
2191*8975f5c5SAndroid Build Coastguard Worker                                 GLsizei count,
2192*8975f5c5SAndroid Build Coastguard Worker                                 const GLuint *value)
2193*8975f5c5SAndroid Build Coastguard Worker {
2194*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2195*8975f5c5SAndroid Build Coastguard Worker     {
2196*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2197*8975f5c5SAndroid Build Coastguard Worker         return false;
2198*8975f5c5SAndroid Build Coastguard Worker     }
2199*8975f5c5SAndroid Build Coastguard Worker 
2200*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform1uivBase(context, entryPoint, programPacked, locationPacked, count,
2201*8975f5c5SAndroid Build Coastguard Worker                                           value);
2202*8975f5c5SAndroid Build Coastguard Worker }
2203*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform2f(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLfloat v0,GLfloat v1)2204*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform2f(const Context *context,
2205*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
2206*8975f5c5SAndroid Build Coastguard Worker                               ShaderProgramID programPacked,
2207*8975f5c5SAndroid Build Coastguard Worker                               UniformLocation locationPacked,
2208*8975f5c5SAndroid Build Coastguard Worker                               GLfloat v0,
2209*8975f5c5SAndroid Build Coastguard Worker                               GLfloat v1)
2210*8975f5c5SAndroid Build Coastguard Worker {
2211*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2212*8975f5c5SAndroid Build Coastguard Worker     {
2213*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2214*8975f5c5SAndroid Build Coastguard Worker         return false;
2215*8975f5c5SAndroid Build Coastguard Worker     }
2216*8975f5c5SAndroid Build Coastguard Worker 
2217*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform2fBase(context, entryPoint, programPacked, locationPacked, v0, v1);
2218*8975f5c5SAndroid Build Coastguard Worker }
2219*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform2fv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLfloat * value)2220*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform2fv(const Context *context,
2221*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
2222*8975f5c5SAndroid Build Coastguard Worker                                ShaderProgramID programPacked,
2223*8975f5c5SAndroid Build Coastguard Worker                                UniformLocation locationPacked,
2224*8975f5c5SAndroid Build Coastguard Worker                                GLsizei count,
2225*8975f5c5SAndroid Build Coastguard Worker                                const GLfloat *value)
2226*8975f5c5SAndroid Build Coastguard Worker {
2227*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2228*8975f5c5SAndroid Build Coastguard Worker     {
2229*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2230*8975f5c5SAndroid Build Coastguard Worker         return false;
2231*8975f5c5SAndroid Build Coastguard Worker     }
2232*8975f5c5SAndroid Build Coastguard Worker 
2233*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform2fvBase(context, entryPoint, programPacked, locationPacked, count,
2234*8975f5c5SAndroid Build Coastguard Worker                                          value);
2235*8975f5c5SAndroid Build Coastguard Worker }
2236*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform2i(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLint v0,GLint v1)2237*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform2i(const Context *context,
2238*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
2239*8975f5c5SAndroid Build Coastguard Worker                               ShaderProgramID programPacked,
2240*8975f5c5SAndroid Build Coastguard Worker                               UniformLocation locationPacked,
2241*8975f5c5SAndroid Build Coastguard Worker                               GLint v0,
2242*8975f5c5SAndroid Build Coastguard Worker                               GLint v1)
2243*8975f5c5SAndroid Build Coastguard Worker {
2244*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2245*8975f5c5SAndroid Build Coastguard Worker     {
2246*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2247*8975f5c5SAndroid Build Coastguard Worker         return false;
2248*8975f5c5SAndroid Build Coastguard Worker     }
2249*8975f5c5SAndroid Build Coastguard Worker 
2250*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform2iBase(context, entryPoint, programPacked, locationPacked, v0, v1);
2251*8975f5c5SAndroid Build Coastguard Worker }
2252*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform2iv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLint * value)2253*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform2iv(const Context *context,
2254*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
2255*8975f5c5SAndroid Build Coastguard Worker                                ShaderProgramID programPacked,
2256*8975f5c5SAndroid Build Coastguard Worker                                UniformLocation locationPacked,
2257*8975f5c5SAndroid Build Coastguard Worker                                GLsizei count,
2258*8975f5c5SAndroid Build Coastguard Worker                                const GLint *value)
2259*8975f5c5SAndroid Build Coastguard Worker {
2260*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2261*8975f5c5SAndroid Build Coastguard Worker     {
2262*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2263*8975f5c5SAndroid Build Coastguard Worker         return false;
2264*8975f5c5SAndroid Build Coastguard Worker     }
2265*8975f5c5SAndroid Build Coastguard Worker 
2266*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform2ivBase(context, entryPoint, programPacked, locationPacked, count,
2267*8975f5c5SAndroid Build Coastguard Worker                                          value);
2268*8975f5c5SAndroid Build Coastguard Worker }
2269*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform2ui(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLuint v0,GLuint v1)2270*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform2ui(const Context *context,
2271*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
2272*8975f5c5SAndroid Build Coastguard Worker                                ShaderProgramID programPacked,
2273*8975f5c5SAndroid Build Coastguard Worker                                UniformLocation locationPacked,
2274*8975f5c5SAndroid Build Coastguard Worker                                GLuint v0,
2275*8975f5c5SAndroid Build Coastguard Worker                                GLuint v1)
2276*8975f5c5SAndroid Build Coastguard Worker {
2277*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2278*8975f5c5SAndroid Build Coastguard Worker     {
2279*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2280*8975f5c5SAndroid Build Coastguard Worker         return false;
2281*8975f5c5SAndroid Build Coastguard Worker     }
2282*8975f5c5SAndroid Build Coastguard Worker 
2283*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform2uiBase(context, entryPoint, programPacked, locationPacked, v0,
2284*8975f5c5SAndroid Build Coastguard Worker                                          v1);
2285*8975f5c5SAndroid Build Coastguard Worker }
2286*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform2uiv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLuint * value)2287*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform2uiv(const Context *context,
2288*8975f5c5SAndroid Build Coastguard Worker                                 angle::EntryPoint entryPoint,
2289*8975f5c5SAndroid Build Coastguard Worker                                 ShaderProgramID programPacked,
2290*8975f5c5SAndroid Build Coastguard Worker                                 UniformLocation locationPacked,
2291*8975f5c5SAndroid Build Coastguard Worker                                 GLsizei count,
2292*8975f5c5SAndroid Build Coastguard Worker                                 const GLuint *value)
2293*8975f5c5SAndroid Build Coastguard Worker {
2294*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2295*8975f5c5SAndroid Build Coastguard Worker     {
2296*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2297*8975f5c5SAndroid Build Coastguard Worker         return false;
2298*8975f5c5SAndroid Build Coastguard Worker     }
2299*8975f5c5SAndroid Build Coastguard Worker 
2300*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform2uivBase(context, entryPoint, programPacked, locationPacked, count,
2301*8975f5c5SAndroid Build Coastguard Worker                                           value);
2302*8975f5c5SAndroid Build Coastguard Worker }
2303*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform3f(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLfloat v0,GLfloat v1,GLfloat v2)2304*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform3f(const Context *context,
2305*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
2306*8975f5c5SAndroid Build Coastguard Worker                               ShaderProgramID programPacked,
2307*8975f5c5SAndroid Build Coastguard Worker                               UniformLocation locationPacked,
2308*8975f5c5SAndroid Build Coastguard Worker                               GLfloat v0,
2309*8975f5c5SAndroid Build Coastguard Worker                               GLfloat v1,
2310*8975f5c5SAndroid Build Coastguard Worker                               GLfloat v2)
2311*8975f5c5SAndroid Build Coastguard Worker {
2312*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2313*8975f5c5SAndroid Build Coastguard Worker     {
2314*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2315*8975f5c5SAndroid Build Coastguard Worker         return false;
2316*8975f5c5SAndroid Build Coastguard Worker     }
2317*8975f5c5SAndroid Build Coastguard Worker 
2318*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform3fBase(context, entryPoint, programPacked, locationPacked, v0, v1,
2319*8975f5c5SAndroid Build Coastguard Worker                                         v2);
2320*8975f5c5SAndroid Build Coastguard Worker }
2321*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform3fv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLfloat * value)2322*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform3fv(const Context *context,
2323*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
2324*8975f5c5SAndroid Build Coastguard Worker                                ShaderProgramID programPacked,
2325*8975f5c5SAndroid Build Coastguard Worker                                UniformLocation locationPacked,
2326*8975f5c5SAndroid Build Coastguard Worker                                GLsizei count,
2327*8975f5c5SAndroid Build Coastguard Worker                                const GLfloat *value)
2328*8975f5c5SAndroid Build Coastguard Worker {
2329*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2330*8975f5c5SAndroid Build Coastguard Worker     {
2331*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2332*8975f5c5SAndroid Build Coastguard Worker         return false;
2333*8975f5c5SAndroid Build Coastguard Worker     }
2334*8975f5c5SAndroid Build Coastguard Worker 
2335*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform3fvBase(context, entryPoint, programPacked, locationPacked, count,
2336*8975f5c5SAndroid Build Coastguard Worker                                          value);
2337*8975f5c5SAndroid Build Coastguard Worker }
2338*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform3i(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLint v0,GLint v1,GLint v2)2339*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform3i(const Context *context,
2340*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
2341*8975f5c5SAndroid Build Coastguard Worker                               ShaderProgramID programPacked,
2342*8975f5c5SAndroid Build Coastguard Worker                               UniformLocation locationPacked,
2343*8975f5c5SAndroid Build Coastguard Worker                               GLint v0,
2344*8975f5c5SAndroid Build Coastguard Worker                               GLint v1,
2345*8975f5c5SAndroid Build Coastguard Worker                               GLint v2)
2346*8975f5c5SAndroid Build Coastguard Worker {
2347*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2348*8975f5c5SAndroid Build Coastguard Worker     {
2349*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2350*8975f5c5SAndroid Build Coastguard Worker         return false;
2351*8975f5c5SAndroid Build Coastguard Worker     }
2352*8975f5c5SAndroid Build Coastguard Worker 
2353*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform3iBase(context, entryPoint, programPacked, locationPacked, v0, v1,
2354*8975f5c5SAndroid Build Coastguard Worker                                         v2);
2355*8975f5c5SAndroid Build Coastguard Worker }
2356*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform3iv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLint * value)2357*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform3iv(const Context *context,
2358*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
2359*8975f5c5SAndroid Build Coastguard Worker                                ShaderProgramID programPacked,
2360*8975f5c5SAndroid Build Coastguard Worker                                UniformLocation locationPacked,
2361*8975f5c5SAndroid Build Coastguard Worker                                GLsizei count,
2362*8975f5c5SAndroid Build Coastguard Worker                                const GLint *value)
2363*8975f5c5SAndroid Build Coastguard Worker {
2364*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2365*8975f5c5SAndroid Build Coastguard Worker     {
2366*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2367*8975f5c5SAndroid Build Coastguard Worker         return false;
2368*8975f5c5SAndroid Build Coastguard Worker     }
2369*8975f5c5SAndroid Build Coastguard Worker 
2370*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform3ivBase(context, entryPoint, programPacked, locationPacked, count,
2371*8975f5c5SAndroid Build Coastguard Worker                                          value);
2372*8975f5c5SAndroid Build Coastguard Worker }
2373*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform3ui(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLuint v0,GLuint v1,GLuint v2)2374*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform3ui(const Context *context,
2375*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
2376*8975f5c5SAndroid Build Coastguard Worker                                ShaderProgramID programPacked,
2377*8975f5c5SAndroid Build Coastguard Worker                                UniformLocation locationPacked,
2378*8975f5c5SAndroid Build Coastguard Worker                                GLuint v0,
2379*8975f5c5SAndroid Build Coastguard Worker                                GLuint v1,
2380*8975f5c5SAndroid Build Coastguard Worker                                GLuint v2)
2381*8975f5c5SAndroid Build Coastguard Worker {
2382*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2383*8975f5c5SAndroid Build Coastguard Worker     {
2384*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2385*8975f5c5SAndroid Build Coastguard Worker         return false;
2386*8975f5c5SAndroid Build Coastguard Worker     }
2387*8975f5c5SAndroid Build Coastguard Worker 
2388*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform3uiBase(context, entryPoint, programPacked, locationPacked, v0, v1,
2389*8975f5c5SAndroid Build Coastguard Worker                                          v2);
2390*8975f5c5SAndroid Build Coastguard Worker }
2391*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform3uiv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLuint * value)2392*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform3uiv(const Context *context,
2393*8975f5c5SAndroid Build Coastguard Worker                                 angle::EntryPoint entryPoint,
2394*8975f5c5SAndroid Build Coastguard Worker                                 ShaderProgramID programPacked,
2395*8975f5c5SAndroid Build Coastguard Worker                                 UniformLocation locationPacked,
2396*8975f5c5SAndroid Build Coastguard Worker                                 GLsizei count,
2397*8975f5c5SAndroid Build Coastguard Worker                                 const GLuint *value)
2398*8975f5c5SAndroid Build Coastguard Worker {
2399*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2400*8975f5c5SAndroid Build Coastguard Worker     {
2401*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2402*8975f5c5SAndroid Build Coastguard Worker         return false;
2403*8975f5c5SAndroid Build Coastguard Worker     }
2404*8975f5c5SAndroid Build Coastguard Worker 
2405*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform3uivBase(context, entryPoint, programPacked, locationPacked, count,
2406*8975f5c5SAndroid Build Coastguard Worker                                           value);
2407*8975f5c5SAndroid Build Coastguard Worker }
2408*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform4f(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLfloat v0,GLfloat v1,GLfloat v2,GLfloat v3)2409*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform4f(const Context *context,
2410*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
2411*8975f5c5SAndroid Build Coastguard Worker                               ShaderProgramID programPacked,
2412*8975f5c5SAndroid Build Coastguard Worker                               UniformLocation locationPacked,
2413*8975f5c5SAndroid Build Coastguard Worker                               GLfloat v0,
2414*8975f5c5SAndroid Build Coastguard Worker                               GLfloat v1,
2415*8975f5c5SAndroid Build Coastguard Worker                               GLfloat v2,
2416*8975f5c5SAndroid Build Coastguard Worker                               GLfloat v3)
2417*8975f5c5SAndroid Build Coastguard Worker {
2418*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2419*8975f5c5SAndroid Build Coastguard Worker     {
2420*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2421*8975f5c5SAndroid Build Coastguard Worker         return false;
2422*8975f5c5SAndroid Build Coastguard Worker     }
2423*8975f5c5SAndroid Build Coastguard Worker 
2424*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform4fBase(context, entryPoint, programPacked, locationPacked, v0, v1,
2425*8975f5c5SAndroid Build Coastguard Worker                                         v2, v3);
2426*8975f5c5SAndroid Build Coastguard Worker }
2427*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform4fv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLfloat * value)2428*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform4fv(const Context *context,
2429*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
2430*8975f5c5SAndroid Build Coastguard Worker                                ShaderProgramID programPacked,
2431*8975f5c5SAndroid Build Coastguard Worker                                UniformLocation locationPacked,
2432*8975f5c5SAndroid Build Coastguard Worker                                GLsizei count,
2433*8975f5c5SAndroid Build Coastguard Worker                                const GLfloat *value)
2434*8975f5c5SAndroid Build Coastguard Worker {
2435*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2436*8975f5c5SAndroid Build Coastguard Worker     {
2437*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2438*8975f5c5SAndroid Build Coastguard Worker         return false;
2439*8975f5c5SAndroid Build Coastguard Worker     }
2440*8975f5c5SAndroid Build Coastguard Worker 
2441*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform4fvBase(context, entryPoint, programPacked, locationPacked, count,
2442*8975f5c5SAndroid Build Coastguard Worker                                          value);
2443*8975f5c5SAndroid Build Coastguard Worker }
2444*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform4i(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLint v0,GLint v1,GLint v2,GLint v3)2445*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform4i(const Context *context,
2446*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
2447*8975f5c5SAndroid Build Coastguard Worker                               ShaderProgramID programPacked,
2448*8975f5c5SAndroid Build Coastguard Worker                               UniformLocation locationPacked,
2449*8975f5c5SAndroid Build Coastguard Worker                               GLint v0,
2450*8975f5c5SAndroid Build Coastguard Worker                               GLint v1,
2451*8975f5c5SAndroid Build Coastguard Worker                               GLint v2,
2452*8975f5c5SAndroid Build Coastguard Worker                               GLint v3)
2453*8975f5c5SAndroid Build Coastguard Worker {
2454*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2455*8975f5c5SAndroid Build Coastguard Worker     {
2456*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2457*8975f5c5SAndroid Build Coastguard Worker         return false;
2458*8975f5c5SAndroid Build Coastguard Worker     }
2459*8975f5c5SAndroid Build Coastguard Worker 
2460*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform4iBase(context, entryPoint, programPacked, locationPacked, v0, v1,
2461*8975f5c5SAndroid Build Coastguard Worker                                         v2, v3);
2462*8975f5c5SAndroid Build Coastguard Worker }
2463*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform4iv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLint * value)2464*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform4iv(const Context *context,
2465*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
2466*8975f5c5SAndroid Build Coastguard Worker                                ShaderProgramID programPacked,
2467*8975f5c5SAndroid Build Coastguard Worker                                UniformLocation locationPacked,
2468*8975f5c5SAndroid Build Coastguard Worker                                GLsizei count,
2469*8975f5c5SAndroid Build Coastguard Worker                                const GLint *value)
2470*8975f5c5SAndroid Build Coastguard Worker {
2471*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2472*8975f5c5SAndroid Build Coastguard Worker     {
2473*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2474*8975f5c5SAndroid Build Coastguard Worker         return false;
2475*8975f5c5SAndroid Build Coastguard Worker     }
2476*8975f5c5SAndroid Build Coastguard Worker 
2477*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform4ivBase(context, entryPoint, programPacked, locationPacked, count,
2478*8975f5c5SAndroid Build Coastguard Worker                                          value);
2479*8975f5c5SAndroid Build Coastguard Worker }
2480*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform4ui(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLuint v0,GLuint v1,GLuint v2,GLuint v3)2481*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform4ui(const Context *context,
2482*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
2483*8975f5c5SAndroid Build Coastguard Worker                                ShaderProgramID programPacked,
2484*8975f5c5SAndroid Build Coastguard Worker                                UniformLocation locationPacked,
2485*8975f5c5SAndroid Build Coastguard Worker                                GLuint v0,
2486*8975f5c5SAndroid Build Coastguard Worker                                GLuint v1,
2487*8975f5c5SAndroid Build Coastguard Worker                                GLuint v2,
2488*8975f5c5SAndroid Build Coastguard Worker                                GLuint v3)
2489*8975f5c5SAndroid Build Coastguard Worker {
2490*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2491*8975f5c5SAndroid Build Coastguard Worker     {
2492*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2493*8975f5c5SAndroid Build Coastguard Worker         return false;
2494*8975f5c5SAndroid Build Coastguard Worker     }
2495*8975f5c5SAndroid Build Coastguard Worker 
2496*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform4uiBase(context, entryPoint, programPacked, locationPacked, v0, v1,
2497*8975f5c5SAndroid Build Coastguard Worker                                          v2, v3);
2498*8975f5c5SAndroid Build Coastguard Worker }
2499*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniform4uiv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLuint * value)2500*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniform4uiv(const Context *context,
2501*8975f5c5SAndroid Build Coastguard Worker                                 angle::EntryPoint entryPoint,
2502*8975f5c5SAndroid Build Coastguard Worker                                 ShaderProgramID programPacked,
2503*8975f5c5SAndroid Build Coastguard Worker                                 UniformLocation locationPacked,
2504*8975f5c5SAndroid Build Coastguard Worker                                 GLsizei count,
2505*8975f5c5SAndroid Build Coastguard Worker                                 const GLuint *value)
2506*8975f5c5SAndroid Build Coastguard Worker {
2507*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2508*8975f5c5SAndroid Build Coastguard Worker     {
2509*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2510*8975f5c5SAndroid Build Coastguard Worker         return false;
2511*8975f5c5SAndroid Build Coastguard Worker     }
2512*8975f5c5SAndroid Build Coastguard Worker 
2513*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniform4uivBase(context, entryPoint, programPacked, locationPacked, count,
2514*8975f5c5SAndroid Build Coastguard Worker                                           value);
2515*8975f5c5SAndroid Build Coastguard Worker }
2516*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix2fv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2517*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix2fv(const Context *context,
2518*8975f5c5SAndroid Build Coastguard Worker                                      angle::EntryPoint entryPoint,
2519*8975f5c5SAndroid Build Coastguard Worker                                      ShaderProgramID programPacked,
2520*8975f5c5SAndroid Build Coastguard Worker                                      UniformLocation locationPacked,
2521*8975f5c5SAndroid Build Coastguard Worker                                      GLsizei count,
2522*8975f5c5SAndroid Build Coastguard Worker                                      GLboolean transpose,
2523*8975f5c5SAndroid Build Coastguard Worker                                      const GLfloat *value)
2524*8975f5c5SAndroid Build Coastguard Worker {
2525*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2526*8975f5c5SAndroid Build Coastguard Worker     {
2527*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2528*8975f5c5SAndroid Build Coastguard Worker         return false;
2529*8975f5c5SAndroid Build Coastguard Worker     }
2530*8975f5c5SAndroid Build Coastguard Worker 
2531*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrix2fvBase(context, entryPoint, programPacked, locationPacked,
2532*8975f5c5SAndroid Build Coastguard Worker                                                count, transpose, value);
2533*8975f5c5SAndroid Build Coastguard Worker }
2534*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix2x3fv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2535*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix2x3fv(const Context *context,
2536*8975f5c5SAndroid Build Coastguard Worker                                        angle::EntryPoint entryPoint,
2537*8975f5c5SAndroid Build Coastguard Worker                                        ShaderProgramID programPacked,
2538*8975f5c5SAndroid Build Coastguard Worker                                        UniformLocation locationPacked,
2539*8975f5c5SAndroid Build Coastguard Worker                                        GLsizei count,
2540*8975f5c5SAndroid Build Coastguard Worker                                        GLboolean transpose,
2541*8975f5c5SAndroid Build Coastguard Worker                                        const GLfloat *value)
2542*8975f5c5SAndroid Build Coastguard Worker {
2543*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2544*8975f5c5SAndroid Build Coastguard Worker     {
2545*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2546*8975f5c5SAndroid Build Coastguard Worker         return false;
2547*8975f5c5SAndroid Build Coastguard Worker     }
2548*8975f5c5SAndroid Build Coastguard Worker 
2549*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrix2x3fvBase(context, entryPoint, programPacked, locationPacked,
2550*8975f5c5SAndroid Build Coastguard Worker                                                  count, transpose, value);
2551*8975f5c5SAndroid Build Coastguard Worker }
2552*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix2x4fv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2553*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix2x4fv(const Context *context,
2554*8975f5c5SAndroid Build Coastguard Worker                                        angle::EntryPoint entryPoint,
2555*8975f5c5SAndroid Build Coastguard Worker                                        ShaderProgramID programPacked,
2556*8975f5c5SAndroid Build Coastguard Worker                                        UniformLocation locationPacked,
2557*8975f5c5SAndroid Build Coastguard Worker                                        GLsizei count,
2558*8975f5c5SAndroid Build Coastguard Worker                                        GLboolean transpose,
2559*8975f5c5SAndroid Build Coastguard Worker                                        const GLfloat *value)
2560*8975f5c5SAndroid Build Coastguard Worker {
2561*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2562*8975f5c5SAndroid Build Coastguard Worker     {
2563*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2564*8975f5c5SAndroid Build Coastguard Worker         return false;
2565*8975f5c5SAndroid Build Coastguard Worker     }
2566*8975f5c5SAndroid Build Coastguard Worker 
2567*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrix2x4fvBase(context, entryPoint, programPacked, locationPacked,
2568*8975f5c5SAndroid Build Coastguard Worker                                                  count, transpose, value);
2569*8975f5c5SAndroid Build Coastguard Worker }
2570*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix3fv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2571*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix3fv(const Context *context,
2572*8975f5c5SAndroid Build Coastguard Worker                                      angle::EntryPoint entryPoint,
2573*8975f5c5SAndroid Build Coastguard Worker                                      ShaderProgramID programPacked,
2574*8975f5c5SAndroid Build Coastguard Worker                                      UniformLocation locationPacked,
2575*8975f5c5SAndroid Build Coastguard Worker                                      GLsizei count,
2576*8975f5c5SAndroid Build Coastguard Worker                                      GLboolean transpose,
2577*8975f5c5SAndroid Build Coastguard Worker                                      const GLfloat *value)
2578*8975f5c5SAndroid Build Coastguard Worker {
2579*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2580*8975f5c5SAndroid Build Coastguard Worker     {
2581*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2582*8975f5c5SAndroid Build Coastguard Worker         return false;
2583*8975f5c5SAndroid Build Coastguard Worker     }
2584*8975f5c5SAndroid Build Coastguard Worker 
2585*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrix3fvBase(context, entryPoint, programPacked, locationPacked,
2586*8975f5c5SAndroid Build Coastguard Worker                                                count, transpose, value);
2587*8975f5c5SAndroid Build Coastguard Worker }
2588*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix3x2fv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2589*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix3x2fv(const Context *context,
2590*8975f5c5SAndroid Build Coastguard Worker                                        angle::EntryPoint entryPoint,
2591*8975f5c5SAndroid Build Coastguard Worker                                        ShaderProgramID programPacked,
2592*8975f5c5SAndroid Build Coastguard Worker                                        UniformLocation locationPacked,
2593*8975f5c5SAndroid Build Coastguard Worker                                        GLsizei count,
2594*8975f5c5SAndroid Build Coastguard Worker                                        GLboolean transpose,
2595*8975f5c5SAndroid Build Coastguard Worker                                        const GLfloat *value)
2596*8975f5c5SAndroid Build Coastguard Worker {
2597*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2598*8975f5c5SAndroid Build Coastguard Worker     {
2599*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2600*8975f5c5SAndroid Build Coastguard Worker         return false;
2601*8975f5c5SAndroid Build Coastguard Worker     }
2602*8975f5c5SAndroid Build Coastguard Worker 
2603*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrix3x2fvBase(context, entryPoint, programPacked, locationPacked,
2604*8975f5c5SAndroid Build Coastguard Worker                                                  count, transpose, value);
2605*8975f5c5SAndroid Build Coastguard Worker }
2606*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix3x4fv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2607*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix3x4fv(const Context *context,
2608*8975f5c5SAndroid Build Coastguard Worker                                        angle::EntryPoint entryPoint,
2609*8975f5c5SAndroid Build Coastguard Worker                                        ShaderProgramID programPacked,
2610*8975f5c5SAndroid Build Coastguard Worker                                        UniformLocation locationPacked,
2611*8975f5c5SAndroid Build Coastguard Worker                                        GLsizei count,
2612*8975f5c5SAndroid Build Coastguard Worker                                        GLboolean transpose,
2613*8975f5c5SAndroid Build Coastguard Worker                                        const GLfloat *value)
2614*8975f5c5SAndroid Build Coastguard Worker {
2615*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2616*8975f5c5SAndroid Build Coastguard Worker     {
2617*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2618*8975f5c5SAndroid Build Coastguard Worker         return false;
2619*8975f5c5SAndroid Build Coastguard Worker     }
2620*8975f5c5SAndroid Build Coastguard Worker 
2621*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrix3x4fvBase(context, entryPoint, programPacked, locationPacked,
2622*8975f5c5SAndroid Build Coastguard Worker                                                  count, transpose, value);
2623*8975f5c5SAndroid Build Coastguard Worker }
2624*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix4fv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2625*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix4fv(const Context *context,
2626*8975f5c5SAndroid Build Coastguard Worker                                      angle::EntryPoint entryPoint,
2627*8975f5c5SAndroid Build Coastguard Worker                                      ShaderProgramID programPacked,
2628*8975f5c5SAndroid Build Coastguard Worker                                      UniformLocation locationPacked,
2629*8975f5c5SAndroid Build Coastguard Worker                                      GLsizei count,
2630*8975f5c5SAndroid Build Coastguard Worker                                      GLboolean transpose,
2631*8975f5c5SAndroid Build Coastguard Worker                                      const GLfloat *value)
2632*8975f5c5SAndroid Build Coastguard Worker {
2633*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2634*8975f5c5SAndroid Build Coastguard Worker     {
2635*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2636*8975f5c5SAndroid Build Coastguard Worker         return false;
2637*8975f5c5SAndroid Build Coastguard Worker     }
2638*8975f5c5SAndroid Build Coastguard Worker 
2639*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrix4fvBase(context, entryPoint, programPacked, locationPacked,
2640*8975f5c5SAndroid Build Coastguard Worker                                                count, transpose, value);
2641*8975f5c5SAndroid Build Coastguard Worker }
2642*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix4x2fv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2643*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix4x2fv(const Context *context,
2644*8975f5c5SAndroid Build Coastguard Worker                                        angle::EntryPoint entryPoint,
2645*8975f5c5SAndroid Build Coastguard Worker                                        ShaderProgramID programPacked,
2646*8975f5c5SAndroid Build Coastguard Worker                                        UniformLocation locationPacked,
2647*8975f5c5SAndroid Build Coastguard Worker                                        GLsizei count,
2648*8975f5c5SAndroid Build Coastguard Worker                                        GLboolean transpose,
2649*8975f5c5SAndroid Build Coastguard Worker                                        const GLfloat *value)
2650*8975f5c5SAndroid Build Coastguard Worker {
2651*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2652*8975f5c5SAndroid Build Coastguard Worker     {
2653*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2654*8975f5c5SAndroid Build Coastguard Worker         return false;
2655*8975f5c5SAndroid Build Coastguard Worker     }
2656*8975f5c5SAndroid Build Coastguard Worker 
2657*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrix4x2fvBase(context, entryPoint, programPacked, locationPacked,
2658*8975f5c5SAndroid Build Coastguard Worker                                                  count, transpose, value);
2659*8975f5c5SAndroid Build Coastguard Worker }
2660*8975f5c5SAndroid Build Coastguard Worker 
ValidateProgramUniformMatrix4x3fv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2661*8975f5c5SAndroid Build Coastguard Worker bool ValidateProgramUniformMatrix4x3fv(const Context *context,
2662*8975f5c5SAndroid Build Coastguard Worker                                        angle::EntryPoint entryPoint,
2663*8975f5c5SAndroid Build Coastguard Worker                                        ShaderProgramID programPacked,
2664*8975f5c5SAndroid Build Coastguard Worker                                        UniformLocation locationPacked,
2665*8975f5c5SAndroid Build Coastguard Worker                                        GLsizei count,
2666*8975f5c5SAndroid Build Coastguard Worker                                        GLboolean transpose,
2667*8975f5c5SAndroid Build Coastguard Worker                                        const GLfloat *value)
2668*8975f5c5SAndroid Build Coastguard Worker {
2669*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2670*8975f5c5SAndroid Build Coastguard Worker     {
2671*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2672*8975f5c5SAndroid Build Coastguard Worker         return false;
2673*8975f5c5SAndroid Build Coastguard Worker     }
2674*8975f5c5SAndroid Build Coastguard Worker 
2675*8975f5c5SAndroid Build Coastguard Worker     return ValidateProgramUniformMatrix4x3fvBase(context, entryPoint, programPacked, locationPacked,
2676*8975f5c5SAndroid Build Coastguard Worker                                                  count, transpose, value);
2677*8975f5c5SAndroid Build Coastguard Worker }
2678*8975f5c5SAndroid Build Coastguard Worker 
ValidateUseProgramStages(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipelinePacked,GLbitfield stages,ShaderProgramID programPacked)2679*8975f5c5SAndroid Build Coastguard Worker bool ValidateUseProgramStages(const Context *context,
2680*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
2681*8975f5c5SAndroid Build Coastguard Worker                               ProgramPipelineID pipelinePacked,
2682*8975f5c5SAndroid Build Coastguard Worker                               GLbitfield stages,
2683*8975f5c5SAndroid Build Coastguard Worker                               ShaderProgramID programPacked)
2684*8975f5c5SAndroid Build Coastguard Worker {
2685*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2686*8975f5c5SAndroid Build Coastguard Worker     {
2687*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2688*8975f5c5SAndroid Build Coastguard Worker         return false;
2689*8975f5c5SAndroid Build Coastguard Worker     }
2690*8975f5c5SAndroid Build Coastguard Worker 
2691*8975f5c5SAndroid Build Coastguard Worker     return ValidateUseProgramStagesBase(context, entryPoint, pipelinePacked, stages, programPacked);
2692*8975f5c5SAndroid Build Coastguard Worker }
2693*8975f5c5SAndroid Build Coastguard Worker 
ValidateValidateProgramPipeline(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipelinePacked)2694*8975f5c5SAndroid Build Coastguard Worker bool ValidateValidateProgramPipeline(const Context *context,
2695*8975f5c5SAndroid Build Coastguard Worker                                      angle::EntryPoint entryPoint,
2696*8975f5c5SAndroid Build Coastguard Worker                                      ProgramPipelineID pipelinePacked)
2697*8975f5c5SAndroid Build Coastguard Worker {
2698*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2699*8975f5c5SAndroid Build Coastguard Worker     {
2700*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2701*8975f5c5SAndroid Build Coastguard Worker         return false;
2702*8975f5c5SAndroid Build Coastguard Worker     }
2703*8975f5c5SAndroid Build Coastguard Worker 
2704*8975f5c5SAndroid Build Coastguard Worker     return ValidateValidateProgramPipelineBase(context, entryPoint, pipelinePacked);
2705*8975f5c5SAndroid Build Coastguard Worker }
2706*8975f5c5SAndroid Build Coastguard Worker 
ValidateMemoryBarrier(const Context * context,angle::EntryPoint entryPoint,GLbitfield barriers)2707*8975f5c5SAndroid Build Coastguard Worker bool ValidateMemoryBarrier(const Context *context,
2708*8975f5c5SAndroid Build Coastguard Worker                            angle::EntryPoint entryPoint,
2709*8975f5c5SAndroid Build Coastguard Worker                            GLbitfield barriers)
2710*8975f5c5SAndroid Build Coastguard Worker {
2711*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2712*8975f5c5SAndroid Build Coastguard Worker     {
2713*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2714*8975f5c5SAndroid Build Coastguard Worker         return false;
2715*8975f5c5SAndroid Build Coastguard Worker     }
2716*8975f5c5SAndroid Build Coastguard Worker 
2717*8975f5c5SAndroid Build Coastguard Worker     if (barriers == GL_ALL_BARRIER_BITS)
2718*8975f5c5SAndroid Build Coastguard Worker     {
2719*8975f5c5SAndroid Build Coastguard Worker         return true;
2720*8975f5c5SAndroid Build Coastguard Worker     }
2721*8975f5c5SAndroid Build Coastguard Worker 
2722*8975f5c5SAndroid Build Coastguard Worker     GLbitfield supported_barrier_bits =
2723*8975f5c5SAndroid Build Coastguard Worker         GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT | GL_ELEMENT_ARRAY_BARRIER_BIT | GL_UNIFORM_BARRIER_BIT |
2724*8975f5c5SAndroid Build Coastguard Worker         GL_TEXTURE_FETCH_BARRIER_BIT | GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL_COMMAND_BARRIER_BIT |
2725*8975f5c5SAndroid Build Coastguard Worker         GL_PIXEL_BUFFER_BARRIER_BIT | GL_TEXTURE_UPDATE_BARRIER_BIT | GL_BUFFER_UPDATE_BARRIER_BIT |
2726*8975f5c5SAndroid Build Coastguard Worker         GL_FRAMEBUFFER_BARRIER_BIT | GL_TRANSFORM_FEEDBACK_BARRIER_BIT |
2727*8975f5c5SAndroid Build Coastguard Worker         GL_ATOMIC_COUNTER_BARRIER_BIT | GL_SHADER_STORAGE_BARRIER_BIT;
2728*8975f5c5SAndroid Build Coastguard Worker 
2729*8975f5c5SAndroid Build Coastguard Worker     if (context->getExtensions().bufferStorageEXT)
2730*8975f5c5SAndroid Build Coastguard Worker     {
2731*8975f5c5SAndroid Build Coastguard Worker         supported_barrier_bits |= GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT_EXT;
2732*8975f5c5SAndroid Build Coastguard Worker     }
2733*8975f5c5SAndroid Build Coastguard Worker 
2734*8975f5c5SAndroid Build Coastguard Worker     if (barriers == 0 || (barriers & ~supported_barrier_bits) != 0)
2735*8975f5c5SAndroid Build Coastguard Worker     {
2736*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidMemoryBarrierBit);
2737*8975f5c5SAndroid Build Coastguard Worker         return false;
2738*8975f5c5SAndroid Build Coastguard Worker     }
2739*8975f5c5SAndroid Build Coastguard Worker 
2740*8975f5c5SAndroid Build Coastguard Worker     return true;
2741*8975f5c5SAndroid Build Coastguard Worker }
2742*8975f5c5SAndroid Build Coastguard Worker 
ValidateMemoryBarrierByRegion(const Context * context,angle::EntryPoint entryPoint,GLbitfield barriers)2743*8975f5c5SAndroid Build Coastguard Worker bool ValidateMemoryBarrierByRegion(const Context *context,
2744*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
2745*8975f5c5SAndroid Build Coastguard Worker                                    GLbitfield barriers)
2746*8975f5c5SAndroid Build Coastguard Worker {
2747*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2748*8975f5c5SAndroid Build Coastguard Worker     {
2749*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2750*8975f5c5SAndroid Build Coastguard Worker         return false;
2751*8975f5c5SAndroid Build Coastguard Worker     }
2752*8975f5c5SAndroid Build Coastguard Worker 
2753*8975f5c5SAndroid Build Coastguard Worker     if (barriers == GL_ALL_BARRIER_BITS)
2754*8975f5c5SAndroid Build Coastguard Worker     {
2755*8975f5c5SAndroid Build Coastguard Worker         return true;
2756*8975f5c5SAndroid Build Coastguard Worker     }
2757*8975f5c5SAndroid Build Coastguard Worker 
2758*8975f5c5SAndroid Build Coastguard Worker     GLbitfield supported_barrier_bits = GL_ATOMIC_COUNTER_BARRIER_BIT | GL_FRAMEBUFFER_BARRIER_BIT |
2759*8975f5c5SAndroid Build Coastguard Worker                                         GL_SHADER_IMAGE_ACCESS_BARRIER_BIT |
2760*8975f5c5SAndroid Build Coastguard Worker                                         GL_SHADER_STORAGE_BARRIER_BIT |
2761*8975f5c5SAndroid Build Coastguard Worker                                         GL_TEXTURE_FETCH_BARRIER_BIT | GL_UNIFORM_BARRIER_BIT;
2762*8975f5c5SAndroid Build Coastguard Worker     if (barriers == 0 || (barriers & ~supported_barrier_bits) != 0)
2763*8975f5c5SAndroid Build Coastguard Worker     {
2764*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidMemoryBarrierBit);
2765*8975f5c5SAndroid Build Coastguard Worker         return false;
2766*8975f5c5SAndroid Build Coastguard Worker     }
2767*8975f5c5SAndroid Build Coastguard Worker 
2768*8975f5c5SAndroid Build Coastguard Worker     return true;
2769*8975f5c5SAndroid Build Coastguard Worker }
2770*8975f5c5SAndroid Build Coastguard Worker 
ValidateSampleMaski(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLuint maskNumber,GLbitfield mask)2771*8975f5c5SAndroid Build Coastguard Worker bool ValidateSampleMaski(const PrivateState &state,
2772*8975f5c5SAndroid Build Coastguard Worker                          ErrorSet *errors,
2773*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
2774*8975f5c5SAndroid Build Coastguard Worker                          GLuint maskNumber,
2775*8975f5c5SAndroid Build Coastguard Worker                          GLbitfield mask)
2776*8975f5c5SAndroid Build Coastguard Worker {
2777*8975f5c5SAndroid Build Coastguard Worker     if (state.getClientVersion() < ES_3_1)
2778*8975f5c5SAndroid Build Coastguard Worker     {
2779*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_OPERATION, kES31Required);
2780*8975f5c5SAndroid Build Coastguard Worker         return false;
2781*8975f5c5SAndroid Build Coastguard Worker     }
2782*8975f5c5SAndroid Build Coastguard Worker 
2783*8975f5c5SAndroid Build Coastguard Worker     return ValidateSampleMaskiBase(state, errors, entryPoint, maskNumber, mask);
2784*8975f5c5SAndroid Build Coastguard Worker }
2785*8975f5c5SAndroid Build Coastguard Worker 
ValidateMinSampleShadingOES(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat value)2786*8975f5c5SAndroid Build Coastguard Worker bool ValidateMinSampleShadingOES(const PrivateState &state,
2787*8975f5c5SAndroid Build Coastguard Worker                                  ErrorSet *errors,
2788*8975f5c5SAndroid Build Coastguard Worker                                  angle::EntryPoint entryPoint,
2789*8975f5c5SAndroid Build Coastguard Worker                                  GLfloat value)
2790*8975f5c5SAndroid Build Coastguard Worker {
2791*8975f5c5SAndroid Build Coastguard Worker     if (!state.getExtensions().sampleShadingOES)
2792*8975f5c5SAndroid Build Coastguard Worker     {
2793*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2794*8975f5c5SAndroid Build Coastguard Worker         return false;
2795*8975f5c5SAndroid Build Coastguard Worker     }
2796*8975f5c5SAndroid Build Coastguard Worker 
2797*8975f5c5SAndroid Build Coastguard Worker     return true;
2798*8975f5c5SAndroid Build Coastguard Worker }
2799*8975f5c5SAndroid Build Coastguard Worker 
ValidateFramebufferTextureCommon(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum attachment,TextureID texture,GLint level)2800*8975f5c5SAndroid Build Coastguard Worker bool ValidateFramebufferTextureCommon(const Context *context,
2801*8975f5c5SAndroid Build Coastguard Worker                                       angle::EntryPoint entryPoint,
2802*8975f5c5SAndroid Build Coastguard Worker                                       GLenum target,
2803*8975f5c5SAndroid Build Coastguard Worker                                       GLenum attachment,
2804*8975f5c5SAndroid Build Coastguard Worker                                       TextureID texture,
2805*8975f5c5SAndroid Build Coastguard Worker                                       GLint level)
2806*8975f5c5SAndroid Build Coastguard Worker {
2807*8975f5c5SAndroid Build Coastguard Worker     if (texture.value != 0)
2808*8975f5c5SAndroid Build Coastguard Worker     {
2809*8975f5c5SAndroid Build Coastguard Worker         Texture *tex = context->getTexture(texture);
2810*8975f5c5SAndroid Build Coastguard Worker 
2811*8975f5c5SAndroid Build Coastguard Worker         // [EXT_geometry_shader] Section 9.2.8 "Attaching Texture Images to a Framebuffer"
2812*8975f5c5SAndroid Build Coastguard Worker         // An INVALID_VALUE error is generated if <texture> is not the name of a texture object.
2813*8975f5c5SAndroid Build Coastguard Worker         // We put this validation before ValidateFramebufferTextureBase because it is an
2814*8975f5c5SAndroid Build Coastguard Worker         // INVALID_OPERATION error for both FramebufferTexture2D and FramebufferTextureLayer:
2815*8975f5c5SAndroid Build Coastguard Worker         // [OpenGL ES 3.1] Chapter 9.2.8 (FramebufferTexture2D)
2816*8975f5c5SAndroid Build Coastguard Worker         // An INVALID_OPERATION error is generated if texture is not zero, and does not name an
2817*8975f5c5SAndroid Build Coastguard Worker         // existing texture object of type matching textarget.
2818*8975f5c5SAndroid Build Coastguard Worker         // [OpenGL ES 3.1 Chapter 9.2.8 (FramebufferTextureLayer)
2819*8975f5c5SAndroid Build Coastguard Worker         // An INVALID_OPERATION error is generated if texture is non-zero and is not the name of a
2820*8975f5c5SAndroid Build Coastguard Worker         // three-dimensional or two-dimensional array texture.
2821*8975f5c5SAndroid Build Coastguard Worker         if (tex == nullptr)
2822*8975f5c5SAndroid Build Coastguard Worker         {
2823*8975f5c5SAndroid Build Coastguard Worker             ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidTextureName);
2824*8975f5c5SAndroid Build Coastguard Worker             return false;
2825*8975f5c5SAndroid Build Coastguard Worker         }
2826*8975f5c5SAndroid Build Coastguard Worker 
2827*8975f5c5SAndroid Build Coastguard Worker         if (!ValidMipLevel(context, tex->getType(), level))
2828*8975f5c5SAndroid Build Coastguard Worker         {
2829*8975f5c5SAndroid Build Coastguard Worker             ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidMipLevel);
2830*8975f5c5SAndroid Build Coastguard Worker             return false;
2831*8975f5c5SAndroid Build Coastguard Worker         }
2832*8975f5c5SAndroid Build Coastguard Worker 
2833*8975f5c5SAndroid Build Coastguard Worker         // GLES spec 3.2, Section 9.2.8 "Attaching Texture Images to a Framebuffer"
2834*8975f5c5SAndroid Build Coastguard Worker         // * If textarget is TEXTURE_2D_MULTISAMPLE, then level must be zero.
2835*8975f5c5SAndroid Build Coastguard Worker         // * If texture is a two-dimensional multisample array texture, then level must be zero.
2836*8975f5c5SAndroid Build Coastguard Worker         // Already validated in ValidMipLevel.
2837*8975f5c5SAndroid Build Coastguard Worker         ASSERT(level == 0 || !IsMultisampled(tex->getType()));
2838*8975f5c5SAndroid Build Coastguard Worker     }
2839*8975f5c5SAndroid Build Coastguard Worker 
2840*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateFramebufferTextureBase(context, entryPoint, target, attachment, texture, level))
2841*8975f5c5SAndroid Build Coastguard Worker     {
2842*8975f5c5SAndroid Build Coastguard Worker         return false;
2843*8975f5c5SAndroid Build Coastguard Worker     }
2844*8975f5c5SAndroid Build Coastguard Worker 
2845*8975f5c5SAndroid Build Coastguard Worker     return true;
2846*8975f5c5SAndroid Build Coastguard Worker }
2847*8975f5c5SAndroid Build Coastguard Worker 
ValidateFramebufferTextureEXT(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum attachment,TextureID texture,GLint level)2848*8975f5c5SAndroid Build Coastguard Worker bool ValidateFramebufferTextureEXT(const Context *context,
2849*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
2850*8975f5c5SAndroid Build Coastguard Worker                                    GLenum target,
2851*8975f5c5SAndroid Build Coastguard Worker                                    GLenum attachment,
2852*8975f5c5SAndroid Build Coastguard Worker                                    TextureID texture,
2853*8975f5c5SAndroid Build Coastguard Worker                                    GLint level)
2854*8975f5c5SAndroid Build Coastguard Worker {
2855*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().geometryShaderEXT)
2856*8975f5c5SAndroid Build Coastguard Worker     {
2857*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kGeometryShaderExtensionNotEnabled);
2858*8975f5c5SAndroid Build Coastguard Worker         return false;
2859*8975f5c5SAndroid Build Coastguard Worker     }
2860*8975f5c5SAndroid Build Coastguard Worker 
2861*8975f5c5SAndroid Build Coastguard Worker     return ValidateFramebufferTextureCommon(context, entryPoint, target, attachment, texture,
2862*8975f5c5SAndroid Build Coastguard Worker                                             level);
2863*8975f5c5SAndroid Build Coastguard Worker }
2864*8975f5c5SAndroid Build Coastguard Worker 
ValidateFramebufferTextureOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum attachment,TextureID texture,GLint level)2865*8975f5c5SAndroid Build Coastguard Worker bool ValidateFramebufferTextureOES(const Context *context,
2866*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
2867*8975f5c5SAndroid Build Coastguard Worker                                    GLenum target,
2868*8975f5c5SAndroid Build Coastguard Worker                                    GLenum attachment,
2869*8975f5c5SAndroid Build Coastguard Worker                                    TextureID texture,
2870*8975f5c5SAndroid Build Coastguard Worker                                    GLint level)
2871*8975f5c5SAndroid Build Coastguard Worker {
2872*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().geometryShaderOES)
2873*8975f5c5SAndroid Build Coastguard Worker     {
2874*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kGeometryShaderExtensionNotEnabled);
2875*8975f5c5SAndroid Build Coastguard Worker         return false;
2876*8975f5c5SAndroid Build Coastguard Worker     }
2877*8975f5c5SAndroid Build Coastguard Worker 
2878*8975f5c5SAndroid Build Coastguard Worker     return ValidateFramebufferTextureCommon(context, entryPoint, target, attachment, texture,
2879*8975f5c5SAndroid Build Coastguard Worker                                             level);
2880*8975f5c5SAndroid Build Coastguard Worker }
2881*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexStorageMem3DMultisampleEXT(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLsizei samples,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedSampleLocations,MemoryObjectID memory,GLuint64 offset)2882*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexStorageMem3DMultisampleEXT(const Context *context,
2883*8975f5c5SAndroid Build Coastguard Worker                                            angle::EntryPoint entryPoint,
2884*8975f5c5SAndroid Build Coastguard Worker                                            TextureType target,
2885*8975f5c5SAndroid Build Coastguard Worker                                            GLsizei samples,
2886*8975f5c5SAndroid Build Coastguard Worker                                            GLenum internalFormat,
2887*8975f5c5SAndroid Build Coastguard Worker                                            GLsizei width,
2888*8975f5c5SAndroid Build Coastguard Worker                                            GLsizei height,
2889*8975f5c5SAndroid Build Coastguard Worker                                            GLsizei depth,
2890*8975f5c5SAndroid Build Coastguard Worker                                            GLboolean fixedSampleLocations,
2891*8975f5c5SAndroid Build Coastguard Worker                                            MemoryObjectID memory,
2892*8975f5c5SAndroid Build Coastguard Worker                                            GLuint64 offset)
2893*8975f5c5SAndroid Build Coastguard Worker {
2894*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().memoryObjectEXT)
2895*8975f5c5SAndroid Build Coastguard Worker     {
2896*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
2897*8975f5c5SAndroid Build Coastguard Worker         return false;
2898*8975f5c5SAndroid Build Coastguard Worker     }
2899*8975f5c5SAndroid Build Coastguard Worker 
2900*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
2901*8975f5c5SAndroid Build Coastguard Worker     return false;
2902*8975f5c5SAndroid Build Coastguard Worker }
2903*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetProgramResourceLocationIndexEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,GLenum programInterface,const char * name)2904*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetProgramResourceLocationIndexEXT(const Context *context,
2905*8975f5c5SAndroid Build Coastguard Worker                                                 angle::EntryPoint entryPoint,
2906*8975f5c5SAndroid Build Coastguard Worker                                                 ShaderProgramID program,
2907*8975f5c5SAndroid Build Coastguard Worker                                                 GLenum programInterface,
2908*8975f5c5SAndroid Build Coastguard Worker                                                 const char *name)
2909*8975f5c5SAndroid Build Coastguard Worker {
2910*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().blendFuncExtendedEXT)
2911*8975f5c5SAndroid Build Coastguard Worker     {
2912*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
2913*8975f5c5SAndroid Build Coastguard Worker         return false;
2914*8975f5c5SAndroid Build Coastguard Worker     }
2915*8975f5c5SAndroid Build Coastguard Worker     if (context->getClientVersion() < ES_3_1)
2916*8975f5c5SAndroid Build Coastguard Worker     {
2917*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES31Required);
2918*8975f5c5SAndroid Build Coastguard Worker         return false;
2919*8975f5c5SAndroid Build Coastguard Worker     }
2920*8975f5c5SAndroid Build Coastguard Worker     if (programInterface != GL_PROGRAM_OUTPUT)
2921*8975f5c5SAndroid Build Coastguard Worker     {
2922*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kProgramInterfaceMustBeProgramOutput);
2923*8975f5c5SAndroid Build Coastguard Worker         return false;
2924*8975f5c5SAndroid Build Coastguard Worker     }
2925*8975f5c5SAndroid Build Coastguard Worker     Program *programObject = GetValidProgram(context, entryPoint, program);
2926*8975f5c5SAndroid Build Coastguard Worker     if (!programObject)
2927*8975f5c5SAndroid Build Coastguard Worker     {
2928*8975f5c5SAndroid Build Coastguard Worker         return false;
2929*8975f5c5SAndroid Build Coastguard Worker     }
2930*8975f5c5SAndroid Build Coastguard Worker     if (!programObject->isLinked())
2931*8975f5c5SAndroid Build Coastguard Worker     {
2932*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kProgramNotLinked);
2933*8975f5c5SAndroid Build Coastguard Worker         return false;
2934*8975f5c5SAndroid Build Coastguard Worker     }
2935*8975f5c5SAndroid Build Coastguard Worker     return true;
2936*8975f5c5SAndroid Build Coastguard Worker }
2937*8975f5c5SAndroid Build Coastguard Worker 
2938*8975f5c5SAndroid Build Coastguard Worker // GL_OES_texture_buffer
ValidateTexBufferOES(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLenum internalformat,BufferID bufferPacked)2939*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexBufferOES(const Context *context,
2940*8975f5c5SAndroid Build Coastguard Worker                           angle::EntryPoint entryPoint,
2941*8975f5c5SAndroid Build Coastguard Worker                           TextureType target,
2942*8975f5c5SAndroid Build Coastguard Worker                           GLenum internalformat,
2943*8975f5c5SAndroid Build Coastguard Worker                           BufferID bufferPacked)
2944*8975f5c5SAndroid Build Coastguard Worker {
2945*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().textureBufferOES)
2946*8975f5c5SAndroid Build Coastguard Worker     {
2947*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kTextureBufferExtensionNotAvailable);
2948*8975f5c5SAndroid Build Coastguard Worker         return false;
2949*8975f5c5SAndroid Build Coastguard Worker     }
2950*8975f5c5SAndroid Build Coastguard Worker 
2951*8975f5c5SAndroid Build Coastguard Worker     return ValidateTexBufferBase(context, entryPoint, target, internalformat, bufferPacked);
2952*8975f5c5SAndroid Build Coastguard Worker }
2953*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexBufferRangeOES(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLenum internalformat,BufferID bufferPacked,GLintptr offset,GLsizeiptr size)2954*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexBufferRangeOES(const Context *context,
2955*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
2956*8975f5c5SAndroid Build Coastguard Worker                                TextureType target,
2957*8975f5c5SAndroid Build Coastguard Worker                                GLenum internalformat,
2958*8975f5c5SAndroid Build Coastguard Worker                                BufferID bufferPacked,
2959*8975f5c5SAndroid Build Coastguard Worker                                GLintptr offset,
2960*8975f5c5SAndroid Build Coastguard Worker                                GLsizeiptr size)
2961*8975f5c5SAndroid Build Coastguard Worker {
2962*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().textureBufferOES)
2963*8975f5c5SAndroid Build Coastguard Worker     {
2964*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kTextureBufferExtensionNotAvailable);
2965*8975f5c5SAndroid Build Coastguard Worker         return false;
2966*8975f5c5SAndroid Build Coastguard Worker     }
2967*8975f5c5SAndroid Build Coastguard Worker 
2968*8975f5c5SAndroid Build Coastguard Worker     return ValidateTexBufferRangeBase(context, entryPoint, target, internalformat, bufferPacked,
2969*8975f5c5SAndroid Build Coastguard Worker                                       offset, size);
2970*8975f5c5SAndroid Build Coastguard Worker }
2971*8975f5c5SAndroid Build Coastguard Worker 
2972*8975f5c5SAndroid Build Coastguard Worker // GL_EXT_texture_buffer
ValidateTexBufferEXT(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLenum internalformat,BufferID bufferPacked)2973*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexBufferEXT(const Context *context,
2974*8975f5c5SAndroid Build Coastguard Worker                           angle::EntryPoint entryPoint,
2975*8975f5c5SAndroid Build Coastguard Worker                           TextureType target,
2976*8975f5c5SAndroid Build Coastguard Worker                           GLenum internalformat,
2977*8975f5c5SAndroid Build Coastguard Worker                           BufferID bufferPacked)
2978*8975f5c5SAndroid Build Coastguard Worker {
2979*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().textureBufferEXT)
2980*8975f5c5SAndroid Build Coastguard Worker     {
2981*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kTextureBufferExtensionNotAvailable);
2982*8975f5c5SAndroid Build Coastguard Worker         return false;
2983*8975f5c5SAndroid Build Coastguard Worker     }
2984*8975f5c5SAndroid Build Coastguard Worker 
2985*8975f5c5SAndroid Build Coastguard Worker     return ValidateTexBufferBase(context, entryPoint, target, internalformat, bufferPacked);
2986*8975f5c5SAndroid Build Coastguard Worker }
2987*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexBufferRangeEXT(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLenum internalformat,BufferID bufferPacked,GLintptr offset,GLsizeiptr size)2988*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexBufferRangeEXT(const Context *context,
2989*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
2990*8975f5c5SAndroid Build Coastguard Worker                                TextureType target,
2991*8975f5c5SAndroid Build Coastguard Worker                                GLenum internalformat,
2992*8975f5c5SAndroid Build Coastguard Worker                                BufferID bufferPacked,
2993*8975f5c5SAndroid Build Coastguard Worker                                GLintptr offset,
2994*8975f5c5SAndroid Build Coastguard Worker                                GLsizeiptr size)
2995*8975f5c5SAndroid Build Coastguard Worker {
2996*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().textureBufferEXT)
2997*8975f5c5SAndroid Build Coastguard Worker     {
2998*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kTextureBufferExtensionNotAvailable);
2999*8975f5c5SAndroid Build Coastguard Worker         return false;
3000*8975f5c5SAndroid Build Coastguard Worker     }
3001*8975f5c5SAndroid Build Coastguard Worker 
3002*8975f5c5SAndroid Build Coastguard Worker     return ValidateTexBufferRangeBase(context, entryPoint, target, internalformat, bufferPacked,
3003*8975f5c5SAndroid Build Coastguard Worker                                       offset, size);
3004*8975f5c5SAndroid Build Coastguard Worker }
3005*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexBufferBase(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLenum internalformat,BufferID bufferPacked)3006*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexBufferBase(const Context *context,
3007*8975f5c5SAndroid Build Coastguard Worker                            angle::EntryPoint entryPoint,
3008*8975f5c5SAndroid Build Coastguard Worker                            TextureType target,
3009*8975f5c5SAndroid Build Coastguard Worker                            GLenum internalformat,
3010*8975f5c5SAndroid Build Coastguard Worker                            BufferID bufferPacked)
3011*8975f5c5SAndroid Build Coastguard Worker {
3012*8975f5c5SAndroid Build Coastguard Worker     if (target != TextureType::Buffer)
3013*8975f5c5SAndroid Build Coastguard Worker     {
3014*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kTextureBufferTarget);
3015*8975f5c5SAndroid Build Coastguard Worker         return false;
3016*8975f5c5SAndroid Build Coastguard Worker     }
3017*8975f5c5SAndroid Build Coastguard Worker 
3018*8975f5c5SAndroid Build Coastguard Worker     switch (internalformat)
3019*8975f5c5SAndroid Build Coastguard Worker     {
3020*8975f5c5SAndroid Build Coastguard Worker         case GL_R8:
3021*8975f5c5SAndroid Build Coastguard Worker         case GL_R16F:
3022*8975f5c5SAndroid Build Coastguard Worker         case GL_R32F:
3023*8975f5c5SAndroid Build Coastguard Worker         case GL_R8I:
3024*8975f5c5SAndroid Build Coastguard Worker         case GL_R16I:
3025*8975f5c5SAndroid Build Coastguard Worker         case GL_R32I:
3026*8975f5c5SAndroid Build Coastguard Worker         case GL_R8UI:
3027*8975f5c5SAndroid Build Coastguard Worker         case GL_R16UI:
3028*8975f5c5SAndroid Build Coastguard Worker         case GL_R32UI:
3029*8975f5c5SAndroid Build Coastguard Worker         case GL_RG8:
3030*8975f5c5SAndroid Build Coastguard Worker         case GL_RG16F:
3031*8975f5c5SAndroid Build Coastguard Worker         case GL_RG32F:
3032*8975f5c5SAndroid Build Coastguard Worker         case GL_RG8I:
3033*8975f5c5SAndroid Build Coastguard Worker         case GL_RG16I:
3034*8975f5c5SAndroid Build Coastguard Worker         case GL_RG32I:
3035*8975f5c5SAndroid Build Coastguard Worker         case GL_RG8UI:
3036*8975f5c5SAndroid Build Coastguard Worker         case GL_RG16UI:
3037*8975f5c5SAndroid Build Coastguard Worker         case GL_RG32UI:
3038*8975f5c5SAndroid Build Coastguard Worker         case GL_RGB32F:
3039*8975f5c5SAndroid Build Coastguard Worker         case GL_RGB32I:
3040*8975f5c5SAndroid Build Coastguard Worker         case GL_RGB32UI:
3041*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA8:
3042*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA16F:
3043*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA32F:
3044*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA8I:
3045*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA16I:
3046*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA32I:
3047*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA8UI:
3048*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA16UI:
3049*8975f5c5SAndroid Build Coastguard Worker         case GL_RGBA32UI:
3050*8975f5c5SAndroid Build Coastguard Worker             break;
3051*8975f5c5SAndroid Build Coastguard Worker 
3052*8975f5c5SAndroid Build Coastguard Worker         default:
3053*8975f5c5SAndroid Build Coastguard Worker             ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kTextureBufferInternalFormat);
3054*8975f5c5SAndroid Build Coastguard Worker             return false;
3055*8975f5c5SAndroid Build Coastguard Worker     }
3056*8975f5c5SAndroid Build Coastguard Worker 
3057*8975f5c5SAndroid Build Coastguard Worker     if (bufferPacked.value != 0)
3058*8975f5c5SAndroid Build Coastguard Worker     {
3059*8975f5c5SAndroid Build Coastguard Worker         if (!context->isBufferGenerated(bufferPacked))
3060*8975f5c5SAndroid Build Coastguard Worker         {
3061*8975f5c5SAndroid Build Coastguard Worker             ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kTextureBufferInvalidBuffer);
3062*8975f5c5SAndroid Build Coastguard Worker             return false;
3063*8975f5c5SAndroid Build Coastguard Worker         }
3064*8975f5c5SAndroid Build Coastguard Worker     }
3065*8975f5c5SAndroid Build Coastguard Worker 
3066*8975f5c5SAndroid Build Coastguard Worker     return true;
3067*8975f5c5SAndroid Build Coastguard Worker }
3068*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexBufferRangeBase(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLenum internalformat,BufferID bufferPacked,GLintptr offset,GLsizeiptr size)3069*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexBufferRangeBase(const Context *context,
3070*8975f5c5SAndroid Build Coastguard Worker                                 angle::EntryPoint entryPoint,
3071*8975f5c5SAndroid Build Coastguard Worker                                 TextureType target,
3072*8975f5c5SAndroid Build Coastguard Worker                                 GLenum internalformat,
3073*8975f5c5SAndroid Build Coastguard Worker                                 BufferID bufferPacked,
3074*8975f5c5SAndroid Build Coastguard Worker                                 GLintptr offset,
3075*8975f5c5SAndroid Build Coastguard Worker                                 GLsizeiptr size)
3076*8975f5c5SAndroid Build Coastguard Worker {
3077*8975f5c5SAndroid Build Coastguard Worker     const Caps &caps = context->getCaps();
3078*8975f5c5SAndroid Build Coastguard Worker 
3079*8975f5c5SAndroid Build Coastguard Worker     if (offset < 0 || (offset % caps.textureBufferOffsetAlignment) != 0)
3080*8975f5c5SAndroid Build Coastguard Worker     {
3081*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kTextureBufferOffsetAlignment);
3082*8975f5c5SAndroid Build Coastguard Worker         return false;
3083*8975f5c5SAndroid Build Coastguard Worker     }
3084*8975f5c5SAndroid Build Coastguard Worker     if (size <= 0)
3085*8975f5c5SAndroid Build Coastguard Worker     {
3086*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kTextureBufferSize);
3087*8975f5c5SAndroid Build Coastguard Worker         return false;
3088*8975f5c5SAndroid Build Coastguard Worker     }
3089*8975f5c5SAndroid Build Coastguard Worker     const Buffer *buffer = context->getBuffer(bufferPacked);
3090*8975f5c5SAndroid Build Coastguard Worker 
3091*8975f5c5SAndroid Build Coastguard Worker     if (!buffer)
3092*8975f5c5SAndroid Build Coastguard Worker     {
3093*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kBufferNotBound);
3094*8975f5c5SAndroid Build Coastguard Worker         return false;
3095*8975f5c5SAndroid Build Coastguard Worker     }
3096*8975f5c5SAndroid Build Coastguard Worker 
3097*8975f5c5SAndroid Build Coastguard Worker     if (offset + size > buffer->getSize())
3098*8975f5c5SAndroid Build Coastguard Worker     {
3099*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kTextureBufferSizeOffset);
3100*8975f5c5SAndroid Build Coastguard Worker         return false;
3101*8975f5c5SAndroid Build Coastguard Worker     }
3102*8975f5c5SAndroid Build Coastguard Worker 
3103*8975f5c5SAndroid Build Coastguard Worker     return ValidateTexBufferBase(context, entryPoint, target, internalformat, bufferPacked);
3104*8975f5c5SAndroid Build Coastguard Worker }
3105*8975f5c5SAndroid Build Coastguard Worker 
ValidatePatchParameteriBase(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,GLint value)3106*8975f5c5SAndroid Build Coastguard Worker bool ValidatePatchParameteriBase(const PrivateState &state,
3107*8975f5c5SAndroid Build Coastguard Worker                                  ErrorSet *errors,
3108*8975f5c5SAndroid Build Coastguard Worker                                  angle::EntryPoint entryPoint,
3109*8975f5c5SAndroid Build Coastguard Worker                                  GLenum pname,
3110*8975f5c5SAndroid Build Coastguard Worker                                  GLint value)
3111*8975f5c5SAndroid Build Coastguard Worker {
3112*8975f5c5SAndroid Build Coastguard Worker     if (state.getClientVersion() < ES_3_1)
3113*8975f5c5SAndroid Build Coastguard Worker     {
3114*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_OPERATION, kES31Required);
3115*8975f5c5SAndroid Build Coastguard Worker         return false;
3116*8975f5c5SAndroid Build Coastguard Worker     }
3117*8975f5c5SAndroid Build Coastguard Worker 
3118*8975f5c5SAndroid Build Coastguard Worker     if (pname != GL_PATCH_VERTICES)
3119*8975f5c5SAndroid Build Coastguard Worker     {
3120*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidPname);
3121*8975f5c5SAndroid Build Coastguard Worker         return false;
3122*8975f5c5SAndroid Build Coastguard Worker     }
3123*8975f5c5SAndroid Build Coastguard Worker 
3124*8975f5c5SAndroid Build Coastguard Worker     if (value <= 0)
3125*8975f5c5SAndroid Build Coastguard Worker     {
3126*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidValueNonPositive);
3127*8975f5c5SAndroid Build Coastguard Worker         return false;
3128*8975f5c5SAndroid Build Coastguard Worker     }
3129*8975f5c5SAndroid Build Coastguard Worker 
3130*8975f5c5SAndroid Build Coastguard Worker     if (value > state.getCaps().maxPatchVertices)
3131*8975f5c5SAndroid Build Coastguard Worker     {
3132*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidValueExceedsMaxPatchSize);
3133*8975f5c5SAndroid Build Coastguard Worker         return false;
3134*8975f5c5SAndroid Build Coastguard Worker     }
3135*8975f5c5SAndroid Build Coastguard Worker 
3136*8975f5c5SAndroid Build Coastguard Worker     return true;
3137*8975f5c5SAndroid Build Coastguard Worker }
3138*8975f5c5SAndroid Build Coastguard Worker 
3139*8975f5c5SAndroid Build Coastguard Worker }  // namespace gl
3140