xref: /aosp_15_r20/external/angle/src/libANGLE/validationES1.cpp (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker //
2*8975f5c5SAndroid Build Coastguard Worker // Copyright 2018 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 // validationES1.cpp: Validation functions for OpenGL ES 1.0 entry point parameters
8*8975f5c5SAndroid Build Coastguard Worker 
9*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/validationES1_autogen.h"
10*8975f5c5SAndroid Build Coastguard Worker 
11*8975f5c5SAndroid Build Coastguard Worker #include "common/debug.h"
12*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/Context.h"
13*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/ErrorStrings.h"
14*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/GLES1State.h"
15*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/queryconversions.h"
16*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/queryutils.h"
17*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/validationES.h"
18*8975f5c5SAndroid Build Coastguard Worker 
19*8975f5c5SAndroid Build Coastguard Worker #define ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint)                         \
20*8975f5c5SAndroid Build Coastguard Worker     do                                                                             \
21*8975f5c5SAndroid Build Coastguard Worker     {                                                                              \
22*8975f5c5SAndroid Build Coastguard Worker         if (state.getClientMajorVersion() > 1)                                     \
23*8975f5c5SAndroid Build Coastguard Worker         {                                                                          \
24*8975f5c5SAndroid Build Coastguard Worker             errors->validationError(entryPoint, GL_INVALID_OPERATION, kGLES1Only); \
25*8975f5c5SAndroid Build Coastguard Worker             return false;                                                          \
26*8975f5c5SAndroid Build Coastguard Worker         }                                                                          \
27*8975f5c5SAndroid Build Coastguard Worker     } while (0)
28*8975f5c5SAndroid Build Coastguard Worker 
29*8975f5c5SAndroid Build Coastguard Worker #define ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint) \
30*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(context->getPrivateState(),      \
31*8975f5c5SAndroid Build Coastguard Worker                             context->getMutableErrorSetForValidation(), entryPoint)
32*8975f5c5SAndroid Build Coastguard Worker 
33*8975f5c5SAndroid Build Coastguard Worker namespace gl
34*8975f5c5SAndroid Build Coastguard Worker {
35*8975f5c5SAndroid Build Coastguard Worker using namespace err;
36*8975f5c5SAndroid Build Coastguard Worker 
ValidateAlphaFuncCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,AlphaTestFunc func)37*8975f5c5SAndroid Build Coastguard Worker bool ValidateAlphaFuncCommon(const PrivateState &state,
38*8975f5c5SAndroid Build Coastguard Worker                              ErrorSet *errors,
39*8975f5c5SAndroid Build Coastguard Worker                              angle::EntryPoint entryPoint,
40*8975f5c5SAndroid Build Coastguard Worker                              AlphaTestFunc func)
41*8975f5c5SAndroid Build Coastguard Worker {
42*8975f5c5SAndroid Build Coastguard Worker     switch (func)
43*8975f5c5SAndroid Build Coastguard Worker     {
44*8975f5c5SAndroid Build Coastguard Worker         case AlphaTestFunc::AlwaysPass:
45*8975f5c5SAndroid Build Coastguard Worker         case AlphaTestFunc::Equal:
46*8975f5c5SAndroid Build Coastguard Worker         case AlphaTestFunc::Gequal:
47*8975f5c5SAndroid Build Coastguard Worker         case AlphaTestFunc::Greater:
48*8975f5c5SAndroid Build Coastguard Worker         case AlphaTestFunc::Lequal:
49*8975f5c5SAndroid Build Coastguard Worker         case AlphaTestFunc::Less:
50*8975f5c5SAndroid Build Coastguard Worker         case AlphaTestFunc::Never:
51*8975f5c5SAndroid Build Coastguard Worker         case AlphaTestFunc::NotEqual:
52*8975f5c5SAndroid Build Coastguard Worker             return true;
53*8975f5c5SAndroid Build Coastguard Worker         default:
54*8975f5c5SAndroid Build Coastguard Worker             errors->validationError(entryPoint, GL_INVALID_ENUM, kEnumInvalid);
55*8975f5c5SAndroid Build Coastguard Worker             return false;
56*8975f5c5SAndroid Build Coastguard Worker     }
57*8975f5c5SAndroid Build Coastguard Worker }
58*8975f5c5SAndroid Build Coastguard Worker 
ValidateClientStateCommon(const Context * context,angle::EntryPoint entryPoint,ClientVertexArrayType arrayType)59*8975f5c5SAndroid Build Coastguard Worker bool ValidateClientStateCommon(const Context *context,
60*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
61*8975f5c5SAndroid Build Coastguard Worker                                ClientVertexArrayType arrayType)
62*8975f5c5SAndroid Build Coastguard Worker {
63*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint);
64*8975f5c5SAndroid Build Coastguard Worker     switch (arrayType)
65*8975f5c5SAndroid Build Coastguard Worker     {
66*8975f5c5SAndroid Build Coastguard Worker         case ClientVertexArrayType::Vertex:
67*8975f5c5SAndroid Build Coastguard Worker         case ClientVertexArrayType::Normal:
68*8975f5c5SAndroid Build Coastguard Worker         case ClientVertexArrayType::Color:
69*8975f5c5SAndroid Build Coastguard Worker         case ClientVertexArrayType::TextureCoord:
70*8975f5c5SAndroid Build Coastguard Worker             return true;
71*8975f5c5SAndroid Build Coastguard Worker         case ClientVertexArrayType::PointSize:
72*8975f5c5SAndroid Build Coastguard Worker             if (!context->getExtensions().pointSizeArrayOES)
73*8975f5c5SAndroid Build Coastguard Worker             {
74*8975f5c5SAndroid Build Coastguard Worker                 ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kPointSizeArrayExtensionNotEnabled);
75*8975f5c5SAndroid Build Coastguard Worker                 return false;
76*8975f5c5SAndroid Build Coastguard Worker             }
77*8975f5c5SAndroid Build Coastguard Worker             return true;
78*8975f5c5SAndroid Build Coastguard Worker         default:
79*8975f5c5SAndroid Build Coastguard Worker             ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidClientState);
80*8975f5c5SAndroid Build Coastguard Worker             return false;
81*8975f5c5SAndroid Build Coastguard Worker     }
82*8975f5c5SAndroid Build Coastguard Worker }
83*8975f5c5SAndroid Build Coastguard Worker 
ValidateBuiltinVertexAttributeCommon(const Context * context,angle::EntryPoint entryPoint,ClientVertexArrayType arrayType,GLint size,VertexAttribType type,GLsizei stride,const void * pointer)84*8975f5c5SAndroid Build Coastguard Worker bool ValidateBuiltinVertexAttributeCommon(const Context *context,
85*8975f5c5SAndroid Build Coastguard Worker                                           angle::EntryPoint entryPoint,
86*8975f5c5SAndroid Build Coastguard Worker                                           ClientVertexArrayType arrayType,
87*8975f5c5SAndroid Build Coastguard Worker                                           GLint size,
88*8975f5c5SAndroid Build Coastguard Worker                                           VertexAttribType type,
89*8975f5c5SAndroid Build Coastguard Worker                                           GLsizei stride,
90*8975f5c5SAndroid Build Coastguard Worker                                           const void *pointer)
91*8975f5c5SAndroid Build Coastguard Worker {
92*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint);
93*8975f5c5SAndroid Build Coastguard Worker 
94*8975f5c5SAndroid Build Coastguard Worker     if (stride < 0)
95*8975f5c5SAndroid Build Coastguard Worker     {
96*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidVertexPointerStride);
97*8975f5c5SAndroid Build Coastguard Worker         return false;
98*8975f5c5SAndroid Build Coastguard Worker     }
99*8975f5c5SAndroid Build Coastguard Worker 
100*8975f5c5SAndroid Build Coastguard Worker     int minSize = 1;
101*8975f5c5SAndroid Build Coastguard Worker     int maxSize = 4;
102*8975f5c5SAndroid Build Coastguard Worker 
103*8975f5c5SAndroid Build Coastguard Worker     switch (arrayType)
104*8975f5c5SAndroid Build Coastguard Worker     {
105*8975f5c5SAndroid Build Coastguard Worker         case ClientVertexArrayType::Vertex:
106*8975f5c5SAndroid Build Coastguard Worker         case ClientVertexArrayType::TextureCoord:
107*8975f5c5SAndroid Build Coastguard Worker             minSize = 2;
108*8975f5c5SAndroid Build Coastguard Worker             maxSize = 4;
109*8975f5c5SAndroid Build Coastguard Worker             break;
110*8975f5c5SAndroid Build Coastguard Worker         case ClientVertexArrayType::Normal:
111*8975f5c5SAndroid Build Coastguard Worker             minSize = 3;
112*8975f5c5SAndroid Build Coastguard Worker             maxSize = 3;
113*8975f5c5SAndroid Build Coastguard Worker             break;
114*8975f5c5SAndroid Build Coastguard Worker         case ClientVertexArrayType::Color:
115*8975f5c5SAndroid Build Coastguard Worker             minSize = 4;
116*8975f5c5SAndroid Build Coastguard Worker             maxSize = 4;
117*8975f5c5SAndroid Build Coastguard Worker             break;
118*8975f5c5SAndroid Build Coastguard Worker         case ClientVertexArrayType::PointSize:
119*8975f5c5SAndroid Build Coastguard Worker             if (!context->getExtensions().pointSizeArrayOES)
120*8975f5c5SAndroid Build Coastguard Worker             {
121*8975f5c5SAndroid Build Coastguard Worker                 ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kPointSizeArrayExtensionNotEnabled);
122*8975f5c5SAndroid Build Coastguard Worker                 return false;
123*8975f5c5SAndroid Build Coastguard Worker             }
124*8975f5c5SAndroid Build Coastguard Worker 
125*8975f5c5SAndroid Build Coastguard Worker             minSize = 1;
126*8975f5c5SAndroid Build Coastguard Worker             maxSize = 1;
127*8975f5c5SAndroid Build Coastguard Worker             break;
128*8975f5c5SAndroid Build Coastguard Worker         default:
129*8975f5c5SAndroid Build Coastguard Worker             UNREACHABLE();
130*8975f5c5SAndroid Build Coastguard Worker             return false;
131*8975f5c5SAndroid Build Coastguard Worker     }
132*8975f5c5SAndroid Build Coastguard Worker 
133*8975f5c5SAndroid Build Coastguard Worker     if (size < minSize || size > maxSize)
134*8975f5c5SAndroid Build Coastguard Worker     {
135*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidVertexPointerSize);
136*8975f5c5SAndroid Build Coastguard Worker         return false;
137*8975f5c5SAndroid Build Coastguard Worker     }
138*8975f5c5SAndroid Build Coastguard Worker 
139*8975f5c5SAndroid Build Coastguard Worker     switch (type)
140*8975f5c5SAndroid Build Coastguard Worker     {
141*8975f5c5SAndroid Build Coastguard Worker         case VertexAttribType::Byte:
142*8975f5c5SAndroid Build Coastguard Worker             if (arrayType == ClientVertexArrayType::PointSize)
143*8975f5c5SAndroid Build Coastguard Worker             {
144*8975f5c5SAndroid Build Coastguard Worker                 ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidVertexPointerType);
145*8975f5c5SAndroid Build Coastguard Worker                 return false;
146*8975f5c5SAndroid Build Coastguard Worker             }
147*8975f5c5SAndroid Build Coastguard Worker             break;
148*8975f5c5SAndroid Build Coastguard Worker         case VertexAttribType::Short:
149*8975f5c5SAndroid Build Coastguard Worker             if (arrayType == ClientVertexArrayType::PointSize ||
150*8975f5c5SAndroid Build Coastguard Worker                 arrayType == ClientVertexArrayType::Color)
151*8975f5c5SAndroid Build Coastguard Worker             {
152*8975f5c5SAndroid Build Coastguard Worker                 ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidVertexPointerType);
153*8975f5c5SAndroid Build Coastguard Worker                 return false;
154*8975f5c5SAndroid Build Coastguard Worker             }
155*8975f5c5SAndroid Build Coastguard Worker             break;
156*8975f5c5SAndroid Build Coastguard Worker         case VertexAttribType::Fixed:
157*8975f5c5SAndroid Build Coastguard Worker         case VertexAttribType::Float:
158*8975f5c5SAndroid Build Coastguard Worker             break;
159*8975f5c5SAndroid Build Coastguard Worker         case VertexAttribType::UnsignedByte:
160*8975f5c5SAndroid Build Coastguard Worker             if (arrayType != ClientVertexArrayType::Color)
161*8975f5c5SAndroid Build Coastguard Worker             {
162*8975f5c5SAndroid Build Coastguard Worker                 ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidVertexPointerType);
163*8975f5c5SAndroid Build Coastguard Worker                 return false;
164*8975f5c5SAndroid Build Coastguard Worker             }
165*8975f5c5SAndroid Build Coastguard Worker             break;
166*8975f5c5SAndroid Build Coastguard Worker         default:
167*8975f5c5SAndroid Build Coastguard Worker             ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidVertexPointerType);
168*8975f5c5SAndroid Build Coastguard Worker             return false;
169*8975f5c5SAndroid Build Coastguard Worker     }
170*8975f5c5SAndroid Build Coastguard Worker 
171*8975f5c5SAndroid Build Coastguard Worker     return true;
172*8975f5c5SAndroid Build Coastguard Worker }
173*8975f5c5SAndroid Build Coastguard Worker 
ValidateLightCaps(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light)174*8975f5c5SAndroid Build Coastguard Worker bool ValidateLightCaps(const PrivateState &state,
175*8975f5c5SAndroid Build Coastguard Worker                        ErrorSet *errors,
176*8975f5c5SAndroid Build Coastguard Worker                        angle::EntryPoint entryPoint,
177*8975f5c5SAndroid Build Coastguard Worker                        GLenum light)
178*8975f5c5SAndroid Build Coastguard Worker {
179*8975f5c5SAndroid Build Coastguard Worker     if (light < GL_LIGHT0 || light >= GL_LIGHT0 + state.getCaps().maxLights)
180*8975f5c5SAndroid Build Coastguard Worker     {
181*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidLight);
182*8975f5c5SAndroid Build Coastguard Worker         return false;
183*8975f5c5SAndroid Build Coastguard Worker     }
184*8975f5c5SAndroid Build Coastguard Worker 
185*8975f5c5SAndroid Build Coastguard Worker     return true;
186*8975f5c5SAndroid Build Coastguard Worker }
187*8975f5c5SAndroid Build Coastguard Worker 
ValidateLightCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light,LightParameter pname,const GLfloat * params)188*8975f5c5SAndroid Build Coastguard Worker bool ValidateLightCommon(const PrivateState &state,
189*8975f5c5SAndroid Build Coastguard Worker                          ErrorSet *errors,
190*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
191*8975f5c5SAndroid Build Coastguard Worker                          GLenum light,
192*8975f5c5SAndroid Build Coastguard Worker                          LightParameter pname,
193*8975f5c5SAndroid Build Coastguard Worker                          const GLfloat *params)
194*8975f5c5SAndroid Build Coastguard Worker {
195*8975f5c5SAndroid Build Coastguard Worker 
196*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
197*8975f5c5SAndroid Build Coastguard Worker 
198*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateLightCaps(state, errors, entryPoint, light))
199*8975f5c5SAndroid Build Coastguard Worker     {
200*8975f5c5SAndroid Build Coastguard Worker         return false;
201*8975f5c5SAndroid Build Coastguard Worker     }
202*8975f5c5SAndroid Build Coastguard Worker 
203*8975f5c5SAndroid Build Coastguard Worker     switch (pname)
204*8975f5c5SAndroid Build Coastguard Worker     {
205*8975f5c5SAndroid Build Coastguard Worker         case LightParameter::Ambient:
206*8975f5c5SAndroid Build Coastguard Worker         case LightParameter::Diffuse:
207*8975f5c5SAndroid Build Coastguard Worker         case LightParameter::Specular:
208*8975f5c5SAndroid Build Coastguard Worker         case LightParameter::Position:
209*8975f5c5SAndroid Build Coastguard Worker         case LightParameter::SpotDirection:
210*8975f5c5SAndroid Build Coastguard Worker             return true;
211*8975f5c5SAndroid Build Coastguard Worker         case LightParameter::SpotExponent:
212*8975f5c5SAndroid Build Coastguard Worker             if (params[0] < 0.0f || params[0] > 128.0f)
213*8975f5c5SAndroid Build Coastguard Worker             {
214*8975f5c5SAndroid Build Coastguard Worker                 errors->validationError(entryPoint, GL_INVALID_VALUE, kLightParameterOutOfRange);
215*8975f5c5SAndroid Build Coastguard Worker                 return false;
216*8975f5c5SAndroid Build Coastguard Worker             }
217*8975f5c5SAndroid Build Coastguard Worker             return true;
218*8975f5c5SAndroid Build Coastguard Worker         case LightParameter::SpotCutoff:
219*8975f5c5SAndroid Build Coastguard Worker             if (params[0] == 180.0f)
220*8975f5c5SAndroid Build Coastguard Worker             {
221*8975f5c5SAndroid Build Coastguard Worker                 return true;
222*8975f5c5SAndroid Build Coastguard Worker             }
223*8975f5c5SAndroid Build Coastguard Worker             if (params[0] < 0.0f || params[0] > 90.0f)
224*8975f5c5SAndroid Build Coastguard Worker             {
225*8975f5c5SAndroid Build Coastguard Worker                 errors->validationError(entryPoint, GL_INVALID_VALUE, kLightParameterOutOfRange);
226*8975f5c5SAndroid Build Coastguard Worker                 return false;
227*8975f5c5SAndroid Build Coastguard Worker             }
228*8975f5c5SAndroid Build Coastguard Worker             return true;
229*8975f5c5SAndroid Build Coastguard Worker         case LightParameter::ConstantAttenuation:
230*8975f5c5SAndroid Build Coastguard Worker         case LightParameter::LinearAttenuation:
231*8975f5c5SAndroid Build Coastguard Worker         case LightParameter::QuadraticAttenuation:
232*8975f5c5SAndroid Build Coastguard Worker             if (params[0] < 0.0f)
233*8975f5c5SAndroid Build Coastguard Worker             {
234*8975f5c5SAndroid Build Coastguard Worker                 errors->validationError(entryPoint, GL_INVALID_VALUE, kLightParameterOutOfRange);
235*8975f5c5SAndroid Build Coastguard Worker                 return false;
236*8975f5c5SAndroid Build Coastguard Worker             }
237*8975f5c5SAndroid Build Coastguard Worker             return true;
238*8975f5c5SAndroid Build Coastguard Worker         default:
239*8975f5c5SAndroid Build Coastguard Worker             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidLightParameter);
240*8975f5c5SAndroid Build Coastguard Worker             return false;
241*8975f5c5SAndroid Build Coastguard Worker     }
242*8975f5c5SAndroid Build Coastguard Worker }
243*8975f5c5SAndroid Build Coastguard Worker 
ValidateLightSingleComponent(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light,LightParameter pname,GLfloat param)244*8975f5c5SAndroid Build Coastguard Worker bool ValidateLightSingleComponent(const PrivateState &state,
245*8975f5c5SAndroid Build Coastguard Worker                                   ErrorSet *errors,
246*8975f5c5SAndroid Build Coastguard Worker                                   angle::EntryPoint entryPoint,
247*8975f5c5SAndroid Build Coastguard Worker                                   GLenum light,
248*8975f5c5SAndroid Build Coastguard Worker                                   LightParameter pname,
249*8975f5c5SAndroid Build Coastguard Worker                                   GLfloat param)
250*8975f5c5SAndroid Build Coastguard Worker {
251*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateLightCommon(state, errors, entryPoint, light, pname, &param))
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     if (GetLightParameterCount(pname) > 1)
257*8975f5c5SAndroid Build Coastguard Worker     {
258*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidLightParameter);
259*8975f5c5SAndroid Build Coastguard Worker         return false;
260*8975f5c5SAndroid Build Coastguard Worker     }
261*8975f5c5SAndroid Build Coastguard Worker 
262*8975f5c5SAndroid Build Coastguard Worker     return true;
263*8975f5c5SAndroid Build Coastguard Worker }
264*8975f5c5SAndroid Build Coastguard Worker 
ValidateMaterialCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,const GLfloat * params)265*8975f5c5SAndroid Build Coastguard Worker bool ValidateMaterialCommon(const PrivateState &state,
266*8975f5c5SAndroid Build Coastguard Worker                             ErrorSet *errors,
267*8975f5c5SAndroid Build Coastguard Worker                             angle::EntryPoint entryPoint,
268*8975f5c5SAndroid Build Coastguard Worker                             GLenum face,
269*8975f5c5SAndroid Build Coastguard Worker                             MaterialParameter pname,
270*8975f5c5SAndroid Build Coastguard Worker                             const GLfloat *params)
271*8975f5c5SAndroid Build Coastguard Worker {
272*8975f5c5SAndroid Build Coastguard Worker     switch (pname)
273*8975f5c5SAndroid Build Coastguard Worker     {
274*8975f5c5SAndroid Build Coastguard Worker         case MaterialParameter::Ambient:
275*8975f5c5SAndroid Build Coastguard Worker         case MaterialParameter::AmbientAndDiffuse:
276*8975f5c5SAndroid Build Coastguard Worker         case MaterialParameter::Diffuse:
277*8975f5c5SAndroid Build Coastguard Worker         case MaterialParameter::Specular:
278*8975f5c5SAndroid Build Coastguard Worker         case MaterialParameter::Emission:
279*8975f5c5SAndroid Build Coastguard Worker             return true;
280*8975f5c5SAndroid Build Coastguard Worker         case MaterialParameter::Shininess:
281*8975f5c5SAndroid Build Coastguard Worker             if (params[0] < 0.0f || params[0] > 128.0f)
282*8975f5c5SAndroid Build Coastguard Worker             {
283*8975f5c5SAndroid Build Coastguard Worker                 errors->validationError(entryPoint, GL_INVALID_VALUE, kMaterialParameterOutOfRange);
284*8975f5c5SAndroid Build Coastguard Worker                 return false;
285*8975f5c5SAndroid Build Coastguard Worker             }
286*8975f5c5SAndroid Build Coastguard Worker             return true;
287*8975f5c5SAndroid Build Coastguard Worker         default:
288*8975f5c5SAndroid Build Coastguard Worker             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidMaterialParameter);
289*8975f5c5SAndroid Build Coastguard Worker             return false;
290*8975f5c5SAndroid Build Coastguard Worker     }
291*8975f5c5SAndroid Build Coastguard Worker }
292*8975f5c5SAndroid Build Coastguard Worker 
ValidateMaterialSetting(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,const GLfloat * params)293*8975f5c5SAndroid Build Coastguard Worker bool ValidateMaterialSetting(const PrivateState &state,
294*8975f5c5SAndroid Build Coastguard Worker                              ErrorSet *errors,
295*8975f5c5SAndroid Build Coastguard Worker                              angle::EntryPoint entryPoint,
296*8975f5c5SAndroid Build Coastguard Worker                              GLenum face,
297*8975f5c5SAndroid Build Coastguard Worker                              MaterialParameter pname,
298*8975f5c5SAndroid Build Coastguard Worker                              const GLfloat *params)
299*8975f5c5SAndroid Build Coastguard Worker {
300*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
301*8975f5c5SAndroid Build Coastguard Worker 
302*8975f5c5SAndroid Build Coastguard Worker     if (face != GL_FRONT_AND_BACK)
303*8975f5c5SAndroid Build Coastguard Worker     {
304*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidMaterialFace);
305*8975f5c5SAndroid Build Coastguard Worker         return false;
306*8975f5c5SAndroid Build Coastguard Worker     }
307*8975f5c5SAndroid Build Coastguard Worker 
308*8975f5c5SAndroid Build Coastguard Worker     return ValidateMaterialCommon(state, errors, entryPoint, face, pname, params);
309*8975f5c5SAndroid Build Coastguard Worker }
310*8975f5c5SAndroid Build Coastguard Worker 
ValidateMaterialQuery(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname)311*8975f5c5SAndroid Build Coastguard Worker bool ValidateMaterialQuery(const PrivateState &state,
312*8975f5c5SAndroid Build Coastguard Worker                            ErrorSet *errors,
313*8975f5c5SAndroid Build Coastguard Worker                            angle::EntryPoint entryPoint,
314*8975f5c5SAndroid Build Coastguard Worker                            GLenum face,
315*8975f5c5SAndroid Build Coastguard Worker                            MaterialParameter pname)
316*8975f5c5SAndroid Build Coastguard Worker {
317*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
318*8975f5c5SAndroid Build Coastguard Worker 
319*8975f5c5SAndroid Build Coastguard Worker     if (face != GL_FRONT && face != GL_BACK)
320*8975f5c5SAndroid Build Coastguard Worker     {
321*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidMaterialFace);
322*8975f5c5SAndroid Build Coastguard Worker         return false;
323*8975f5c5SAndroid Build Coastguard Worker     }
324*8975f5c5SAndroid Build Coastguard Worker 
325*8975f5c5SAndroid Build Coastguard Worker     GLfloat validateParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
326*8975f5c5SAndroid Build Coastguard Worker 
327*8975f5c5SAndroid Build Coastguard Worker     return ValidateMaterialCommon(state, errors, entryPoint, face, pname, validateParams);
328*8975f5c5SAndroid Build Coastguard Worker }
329*8975f5c5SAndroid Build Coastguard Worker 
ValidateMaterialSingleComponent(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,GLfloat param)330*8975f5c5SAndroid Build Coastguard Worker bool ValidateMaterialSingleComponent(const PrivateState &state,
331*8975f5c5SAndroid Build Coastguard Worker                                      ErrorSet *errors,
332*8975f5c5SAndroid Build Coastguard Worker                                      angle::EntryPoint entryPoint,
333*8975f5c5SAndroid Build Coastguard Worker                                      GLenum face,
334*8975f5c5SAndroid Build Coastguard Worker                                      MaterialParameter pname,
335*8975f5c5SAndroid Build Coastguard Worker                                      GLfloat param)
336*8975f5c5SAndroid Build Coastguard Worker {
337*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateMaterialSetting(state, errors, entryPoint, face, pname, &param))
338*8975f5c5SAndroid Build Coastguard Worker     {
339*8975f5c5SAndroid Build Coastguard Worker         return false;
340*8975f5c5SAndroid Build Coastguard Worker     }
341*8975f5c5SAndroid Build Coastguard Worker 
342*8975f5c5SAndroid Build Coastguard Worker     if (GetMaterialParameterCount(pname) > 1)
343*8975f5c5SAndroid Build Coastguard Worker     {
344*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidMaterialParameter);
345*8975f5c5SAndroid Build Coastguard Worker         return false;
346*8975f5c5SAndroid Build Coastguard Worker     }
347*8975f5c5SAndroid Build Coastguard Worker 
348*8975f5c5SAndroid Build Coastguard Worker     return true;
349*8975f5c5SAndroid Build Coastguard Worker }
350*8975f5c5SAndroid Build Coastguard Worker 
ValidateLightModelCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname)351*8975f5c5SAndroid Build Coastguard Worker bool ValidateLightModelCommon(const PrivateState &state,
352*8975f5c5SAndroid Build Coastguard Worker                               ErrorSet *errors,
353*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
354*8975f5c5SAndroid Build Coastguard Worker                               GLenum pname)
355*8975f5c5SAndroid Build Coastguard Worker {
356*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
357*8975f5c5SAndroid Build Coastguard Worker     switch (pname)
358*8975f5c5SAndroid Build Coastguard Worker     {
359*8975f5c5SAndroid Build Coastguard Worker         case GL_LIGHT_MODEL_AMBIENT:
360*8975f5c5SAndroid Build Coastguard Worker         case GL_LIGHT_MODEL_TWO_SIDE:
361*8975f5c5SAndroid Build Coastguard Worker             return true;
362*8975f5c5SAndroid Build Coastguard Worker         default:
363*8975f5c5SAndroid Build Coastguard Worker             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidLightModelParameter);
364*8975f5c5SAndroid Build Coastguard Worker             return false;
365*8975f5c5SAndroid Build Coastguard Worker     }
366*8975f5c5SAndroid Build Coastguard Worker }
367*8975f5c5SAndroid Build Coastguard Worker 
ValidateLightModelSingleComponent(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname)368*8975f5c5SAndroid Build Coastguard Worker bool ValidateLightModelSingleComponent(const PrivateState &state,
369*8975f5c5SAndroid Build Coastguard Worker                                        ErrorSet *errors,
370*8975f5c5SAndroid Build Coastguard Worker                                        angle::EntryPoint entryPoint,
371*8975f5c5SAndroid Build Coastguard Worker                                        GLenum pname)
372*8975f5c5SAndroid Build Coastguard Worker {
373*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateLightModelCommon(state, errors, entryPoint, pname))
374*8975f5c5SAndroid Build Coastguard Worker     {
375*8975f5c5SAndroid Build Coastguard Worker         return false;
376*8975f5c5SAndroid Build Coastguard Worker     }
377*8975f5c5SAndroid Build Coastguard Worker 
378*8975f5c5SAndroid Build Coastguard Worker     switch (pname)
379*8975f5c5SAndroid Build Coastguard Worker     {
380*8975f5c5SAndroid Build Coastguard Worker         case GL_LIGHT_MODEL_TWO_SIDE:
381*8975f5c5SAndroid Build Coastguard Worker             return true;
382*8975f5c5SAndroid Build Coastguard Worker         default:
383*8975f5c5SAndroid Build Coastguard Worker             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidLightModelParameter);
384*8975f5c5SAndroid Build Coastguard Worker             return false;
385*8975f5c5SAndroid Build Coastguard Worker     }
386*8975f5c5SAndroid Build Coastguard Worker }
387*8975f5c5SAndroid Build Coastguard Worker 
ValidateClipPlaneCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum plane)388*8975f5c5SAndroid Build Coastguard Worker bool ValidateClipPlaneCommon(const PrivateState &state,
389*8975f5c5SAndroid Build Coastguard Worker                              ErrorSet *errors,
390*8975f5c5SAndroid Build Coastguard Worker                              angle::EntryPoint entryPoint,
391*8975f5c5SAndroid Build Coastguard Worker                              GLenum plane)
392*8975f5c5SAndroid Build Coastguard Worker {
393*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
394*8975f5c5SAndroid Build Coastguard Worker 
395*8975f5c5SAndroid Build Coastguard Worker     if (plane < GL_CLIP_PLANE0 || plane >= GL_CLIP_PLANE0 + state.getCaps().maxClipPlanes)
396*8975f5c5SAndroid Build Coastguard Worker     {
397*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidClipPlane);
398*8975f5c5SAndroid Build Coastguard Worker         return false;
399*8975f5c5SAndroid Build Coastguard Worker     }
400*8975f5c5SAndroid Build Coastguard Worker 
401*8975f5c5SAndroid Build Coastguard Worker     return true;
402*8975f5c5SAndroid Build Coastguard Worker }
403*8975f5c5SAndroid Build Coastguard Worker 
ValidateFogCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,const GLfloat * params)404*8975f5c5SAndroid Build Coastguard Worker bool ValidateFogCommon(const PrivateState &state,
405*8975f5c5SAndroid Build Coastguard Worker                        ErrorSet *errors,
406*8975f5c5SAndroid Build Coastguard Worker                        angle::EntryPoint entryPoint,
407*8975f5c5SAndroid Build Coastguard Worker                        GLenum pname,
408*8975f5c5SAndroid Build Coastguard Worker                        const GLfloat *params)
409*8975f5c5SAndroid Build Coastguard Worker {
410*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
411*8975f5c5SAndroid Build Coastguard Worker 
412*8975f5c5SAndroid Build Coastguard Worker     switch (pname)
413*8975f5c5SAndroid Build Coastguard Worker     {
414*8975f5c5SAndroid Build Coastguard Worker         case GL_FOG_MODE:
415*8975f5c5SAndroid Build Coastguard Worker         {
416*8975f5c5SAndroid Build Coastguard Worker             GLenum modeParam = static_cast<GLenum>(params[0]);
417*8975f5c5SAndroid Build Coastguard Worker             switch (modeParam)
418*8975f5c5SAndroid Build Coastguard Worker             {
419*8975f5c5SAndroid Build Coastguard Worker                 case GL_EXP:
420*8975f5c5SAndroid Build Coastguard Worker                 case GL_EXP2:
421*8975f5c5SAndroid Build Coastguard Worker                 case GL_LINEAR:
422*8975f5c5SAndroid Build Coastguard Worker                     return true;
423*8975f5c5SAndroid Build Coastguard Worker                 default:
424*8975f5c5SAndroid Build Coastguard Worker                     errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidFogMode);
425*8975f5c5SAndroid Build Coastguard Worker                     return false;
426*8975f5c5SAndroid Build Coastguard Worker             }
427*8975f5c5SAndroid Build Coastguard Worker         }
428*8975f5c5SAndroid Build Coastguard Worker         case GL_FOG_START:
429*8975f5c5SAndroid Build Coastguard Worker         case GL_FOG_END:
430*8975f5c5SAndroid Build Coastguard Worker         case GL_FOG_COLOR:
431*8975f5c5SAndroid Build Coastguard Worker             break;
432*8975f5c5SAndroid Build Coastguard Worker         case GL_FOG_DENSITY:
433*8975f5c5SAndroid Build Coastguard Worker             if (params[0] < 0.0f)
434*8975f5c5SAndroid Build Coastguard Worker             {
435*8975f5c5SAndroid Build Coastguard Worker                 errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidFogDensity);
436*8975f5c5SAndroid Build Coastguard Worker                 return false;
437*8975f5c5SAndroid Build Coastguard Worker             }
438*8975f5c5SAndroid Build Coastguard Worker             break;
439*8975f5c5SAndroid Build Coastguard Worker         default:
440*8975f5c5SAndroid Build Coastguard Worker             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidFogParameter);
441*8975f5c5SAndroid Build Coastguard Worker             return false;
442*8975f5c5SAndroid Build Coastguard Worker     }
443*8975f5c5SAndroid Build Coastguard Worker     return true;
444*8975f5c5SAndroid Build Coastguard Worker }
445*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexEnvCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,const GLfloat * params)446*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexEnvCommon(const PrivateState &state,
447*8975f5c5SAndroid Build Coastguard Worker                           ErrorSet *errors,
448*8975f5c5SAndroid Build Coastguard Worker                           angle::EntryPoint entryPoint,
449*8975f5c5SAndroid Build Coastguard Worker                           TextureEnvTarget target,
450*8975f5c5SAndroid Build Coastguard Worker                           TextureEnvParameter pname,
451*8975f5c5SAndroid Build Coastguard Worker                           const GLfloat *params)
452*8975f5c5SAndroid Build Coastguard Worker {
453*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
454*8975f5c5SAndroid Build Coastguard Worker 
455*8975f5c5SAndroid Build Coastguard Worker     switch (target)
456*8975f5c5SAndroid Build Coastguard Worker     {
457*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvTarget::Env:
458*8975f5c5SAndroid Build Coastguard Worker             switch (pname)
459*8975f5c5SAndroid Build Coastguard Worker             {
460*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::Mode:
461*8975f5c5SAndroid Build Coastguard Worker                 {
462*8975f5c5SAndroid Build Coastguard Worker                     TextureEnvMode mode = FromGLenum<TextureEnvMode>(ConvertToGLenum(params[0]));
463*8975f5c5SAndroid Build Coastguard Worker                     switch (mode)
464*8975f5c5SAndroid Build Coastguard Worker                     {
465*8975f5c5SAndroid Build Coastguard Worker                         case TextureEnvMode::Add:
466*8975f5c5SAndroid Build Coastguard Worker                         case TextureEnvMode::Blend:
467*8975f5c5SAndroid Build Coastguard Worker                         case TextureEnvMode::Combine:
468*8975f5c5SAndroid Build Coastguard Worker                         case TextureEnvMode::Decal:
469*8975f5c5SAndroid Build Coastguard Worker                         case TextureEnvMode::Modulate:
470*8975f5c5SAndroid Build Coastguard Worker                         case TextureEnvMode::Replace:
471*8975f5c5SAndroid Build Coastguard Worker                             break;
472*8975f5c5SAndroid Build Coastguard Worker                         default:
473*8975f5c5SAndroid Build Coastguard Worker                             errors->validationError(entryPoint, GL_INVALID_VALUE,
474*8975f5c5SAndroid Build Coastguard Worker                                                     kInvalidTextureEnvMode);
475*8975f5c5SAndroid Build Coastguard Worker                             return false;
476*8975f5c5SAndroid Build Coastguard Worker                     }
477*8975f5c5SAndroid Build Coastguard Worker                     break;
478*8975f5c5SAndroid Build Coastguard Worker                 }
479*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::CombineRgb:
480*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::CombineAlpha:
481*8975f5c5SAndroid Build Coastguard Worker                 {
482*8975f5c5SAndroid Build Coastguard Worker                     TextureCombine combine = FromGLenum<TextureCombine>(ConvertToGLenum(params[0]));
483*8975f5c5SAndroid Build Coastguard Worker                     switch (combine)
484*8975f5c5SAndroid Build Coastguard Worker                     {
485*8975f5c5SAndroid Build Coastguard Worker                         case TextureCombine::Add:
486*8975f5c5SAndroid Build Coastguard Worker                         case TextureCombine::AddSigned:
487*8975f5c5SAndroid Build Coastguard Worker                         case TextureCombine::Interpolate:
488*8975f5c5SAndroid Build Coastguard Worker                         case TextureCombine::Modulate:
489*8975f5c5SAndroid Build Coastguard Worker                         case TextureCombine::Replace:
490*8975f5c5SAndroid Build Coastguard Worker                         case TextureCombine::Subtract:
491*8975f5c5SAndroid Build Coastguard Worker                             break;
492*8975f5c5SAndroid Build Coastguard Worker                         case TextureCombine::Dot3Rgb:
493*8975f5c5SAndroid Build Coastguard Worker                         case TextureCombine::Dot3Rgba:
494*8975f5c5SAndroid Build Coastguard Worker                             if (pname == TextureEnvParameter::CombineAlpha)
495*8975f5c5SAndroid Build Coastguard Worker                             {
496*8975f5c5SAndroid Build Coastguard Worker                                 errors->validationError(entryPoint, GL_INVALID_VALUE,
497*8975f5c5SAndroid Build Coastguard Worker                                                         kInvalidTextureCombine);
498*8975f5c5SAndroid Build Coastguard Worker                                 return false;
499*8975f5c5SAndroid Build Coastguard Worker                             }
500*8975f5c5SAndroid Build Coastguard Worker                             break;
501*8975f5c5SAndroid Build Coastguard Worker                         default:
502*8975f5c5SAndroid Build Coastguard Worker                             errors->validationError(entryPoint, GL_INVALID_VALUE,
503*8975f5c5SAndroid Build Coastguard Worker                                                     kInvalidTextureCombine);
504*8975f5c5SAndroid Build Coastguard Worker                             return false;
505*8975f5c5SAndroid Build Coastguard Worker                     }
506*8975f5c5SAndroid Build Coastguard Worker                     break;
507*8975f5c5SAndroid Build Coastguard Worker                 }
508*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::Src0Rgb:
509*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::Src1Rgb:
510*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::Src2Rgb:
511*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::Src0Alpha:
512*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::Src1Alpha:
513*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::Src2Alpha:
514*8975f5c5SAndroid Build Coastguard Worker                 {
515*8975f5c5SAndroid Build Coastguard Worker                     TextureSrc combine = FromGLenum<TextureSrc>(ConvertToGLenum(params[0]));
516*8975f5c5SAndroid Build Coastguard Worker                     switch (combine)
517*8975f5c5SAndroid Build Coastguard Worker                     {
518*8975f5c5SAndroid Build Coastguard Worker                         case TextureSrc::Constant:
519*8975f5c5SAndroid Build Coastguard Worker                         case TextureSrc::Previous:
520*8975f5c5SAndroid Build Coastguard Worker                         case TextureSrc::PrimaryColor:
521*8975f5c5SAndroid Build Coastguard Worker                         case TextureSrc::Texture:
522*8975f5c5SAndroid Build Coastguard Worker                             break;
523*8975f5c5SAndroid Build Coastguard Worker                         default:
524*8975f5c5SAndroid Build Coastguard Worker                             errors->validationError(entryPoint, GL_INVALID_VALUE,
525*8975f5c5SAndroid Build Coastguard Worker                                                     kInvalidTextureCombineSrc);
526*8975f5c5SAndroid Build Coastguard Worker                             return false;
527*8975f5c5SAndroid Build Coastguard Worker                     }
528*8975f5c5SAndroid Build Coastguard Worker                     break;
529*8975f5c5SAndroid Build Coastguard Worker                 }
530*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::Op0Rgb:
531*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::Op1Rgb:
532*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::Op2Rgb:
533*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::Op0Alpha:
534*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::Op1Alpha:
535*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::Op2Alpha:
536*8975f5c5SAndroid Build Coastguard Worker                 {
537*8975f5c5SAndroid Build Coastguard Worker                     TextureOp operand = FromGLenum<TextureOp>(ConvertToGLenum(params[0]));
538*8975f5c5SAndroid Build Coastguard Worker                     switch (operand)
539*8975f5c5SAndroid Build Coastguard Worker                     {
540*8975f5c5SAndroid Build Coastguard Worker                         case TextureOp::SrcAlpha:
541*8975f5c5SAndroid Build Coastguard Worker                         case TextureOp::OneMinusSrcAlpha:
542*8975f5c5SAndroid Build Coastguard Worker                             break;
543*8975f5c5SAndroid Build Coastguard Worker                         case TextureOp::SrcColor:
544*8975f5c5SAndroid Build Coastguard Worker                         case TextureOp::OneMinusSrcColor:
545*8975f5c5SAndroid Build Coastguard Worker                             if (pname == TextureEnvParameter::Op0Alpha ||
546*8975f5c5SAndroid Build Coastguard Worker                                 pname == TextureEnvParameter::Op1Alpha ||
547*8975f5c5SAndroid Build Coastguard Worker                                 pname == TextureEnvParameter::Op2Alpha)
548*8975f5c5SAndroid Build Coastguard Worker                             {
549*8975f5c5SAndroid Build Coastguard Worker                                 errors->validationError(entryPoint, GL_INVALID_VALUE,
550*8975f5c5SAndroid Build Coastguard Worker                                                         kInvalidTextureCombine);
551*8975f5c5SAndroid Build Coastguard Worker                                 return false;
552*8975f5c5SAndroid Build Coastguard Worker                             }
553*8975f5c5SAndroid Build Coastguard Worker                             break;
554*8975f5c5SAndroid Build Coastguard Worker                         default:
555*8975f5c5SAndroid Build Coastguard Worker                             errors->validationError(entryPoint, GL_INVALID_VALUE,
556*8975f5c5SAndroid Build Coastguard Worker                                                     kInvalidTextureCombineOp);
557*8975f5c5SAndroid Build Coastguard Worker                             return false;
558*8975f5c5SAndroid Build Coastguard Worker                     }
559*8975f5c5SAndroid Build Coastguard Worker                     break;
560*8975f5c5SAndroid Build Coastguard Worker                 }
561*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::RgbScale:
562*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::AlphaScale:
563*8975f5c5SAndroid Build Coastguard Worker                     if (params[0] != 1.0f && params[0] != 2.0f && params[0] != 4.0f)
564*8975f5c5SAndroid Build Coastguard Worker                     {
565*8975f5c5SAndroid Build Coastguard Worker                         errors->validationError(entryPoint, GL_INVALID_VALUE,
566*8975f5c5SAndroid Build Coastguard Worker                                                 kInvalidTextureEnvScale);
567*8975f5c5SAndroid Build Coastguard Worker                         return false;
568*8975f5c5SAndroid Build Coastguard Worker                     }
569*8975f5c5SAndroid Build Coastguard Worker                     break;
570*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::Color:
571*8975f5c5SAndroid Build Coastguard Worker                     break;
572*8975f5c5SAndroid Build Coastguard Worker                 default:
573*8975f5c5SAndroid Build Coastguard Worker                     errors->validationError(entryPoint, GL_INVALID_ENUM,
574*8975f5c5SAndroid Build Coastguard Worker                                             kInvalidTextureEnvParameter);
575*8975f5c5SAndroid Build Coastguard Worker                     return false;
576*8975f5c5SAndroid Build Coastguard Worker             }
577*8975f5c5SAndroid Build Coastguard Worker             break;
578*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvTarget::PointSprite:
579*8975f5c5SAndroid Build Coastguard Worker             if (!state.getExtensions().pointSpriteOES)
580*8975f5c5SAndroid Build Coastguard Worker             {
581*8975f5c5SAndroid Build Coastguard Worker                 errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidTextureEnvTarget);
582*8975f5c5SAndroid Build Coastguard Worker                 return false;
583*8975f5c5SAndroid Build Coastguard Worker             }
584*8975f5c5SAndroid Build Coastguard Worker             switch (pname)
585*8975f5c5SAndroid Build Coastguard Worker             {
586*8975f5c5SAndroid Build Coastguard Worker                 case TextureEnvParameter::PointCoordReplace:
587*8975f5c5SAndroid Build Coastguard Worker                     break;
588*8975f5c5SAndroid Build Coastguard Worker                 default:
589*8975f5c5SAndroid Build Coastguard Worker                     errors->validationError(entryPoint, GL_INVALID_ENUM,
590*8975f5c5SAndroid Build Coastguard Worker                                             kInvalidTextureEnvParameter);
591*8975f5c5SAndroid Build Coastguard Worker                     return false;
592*8975f5c5SAndroid Build Coastguard Worker             }
593*8975f5c5SAndroid Build Coastguard Worker             break;
594*8975f5c5SAndroid Build Coastguard Worker         default:
595*8975f5c5SAndroid Build Coastguard Worker             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidTextureEnvTarget);
596*8975f5c5SAndroid Build Coastguard Worker             return false;
597*8975f5c5SAndroid Build Coastguard Worker     }
598*8975f5c5SAndroid Build Coastguard Worker     return true;
599*8975f5c5SAndroid Build Coastguard Worker }
600*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetTexEnvCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname)601*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetTexEnvCommon(const PrivateState &state,
602*8975f5c5SAndroid Build Coastguard Worker                              ErrorSet *errors,
603*8975f5c5SAndroid Build Coastguard Worker                              angle::EntryPoint entryPoint,
604*8975f5c5SAndroid Build Coastguard Worker                              TextureEnvTarget target,
605*8975f5c5SAndroid Build Coastguard Worker                              TextureEnvParameter pname)
606*8975f5c5SAndroid Build Coastguard Worker {
607*8975f5c5SAndroid Build Coastguard Worker     GLfloat validateParams[4] = {};
608*8975f5c5SAndroid Build Coastguard Worker     switch (pname)
609*8975f5c5SAndroid Build Coastguard Worker     {
610*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::Mode:
611*8975f5c5SAndroid Build Coastguard Worker             ConvertPackedEnum(TextureEnvMode::Add, validateParams);
612*8975f5c5SAndroid Build Coastguard Worker             break;
613*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::CombineRgb:
614*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::CombineAlpha:
615*8975f5c5SAndroid Build Coastguard Worker             ConvertPackedEnum(TextureCombine::Add, validateParams);
616*8975f5c5SAndroid Build Coastguard Worker             break;
617*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::Src0Rgb:
618*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::Src1Rgb:
619*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::Src2Rgb:
620*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::Src0Alpha:
621*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::Src1Alpha:
622*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::Src2Alpha:
623*8975f5c5SAndroid Build Coastguard Worker             ConvertPackedEnum(TextureSrc::Constant, validateParams);
624*8975f5c5SAndroid Build Coastguard Worker             break;
625*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::Op0Rgb:
626*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::Op1Rgb:
627*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::Op2Rgb:
628*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::Op0Alpha:
629*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::Op1Alpha:
630*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::Op2Alpha:
631*8975f5c5SAndroid Build Coastguard Worker             ConvertPackedEnum(TextureOp::SrcAlpha, validateParams);
632*8975f5c5SAndroid Build Coastguard Worker             break;
633*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::RgbScale:
634*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::AlphaScale:
635*8975f5c5SAndroid Build Coastguard Worker         case TextureEnvParameter::PointCoordReplace:
636*8975f5c5SAndroid Build Coastguard Worker             validateParams[0] = 1.0f;
637*8975f5c5SAndroid Build Coastguard Worker             break;
638*8975f5c5SAndroid Build Coastguard Worker         default:
639*8975f5c5SAndroid Build Coastguard Worker             break;
640*8975f5c5SAndroid Build Coastguard Worker     }
641*8975f5c5SAndroid Build Coastguard Worker 
642*8975f5c5SAndroid Build Coastguard Worker     return ValidateTexEnvCommon(state, errors, entryPoint, target, pname, validateParams);
643*8975f5c5SAndroid Build Coastguard Worker }
644*8975f5c5SAndroid Build Coastguard Worker 
ValidatePointParameterCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,PointParameter pname,const GLfloat * params)645*8975f5c5SAndroid Build Coastguard Worker bool ValidatePointParameterCommon(const PrivateState &state,
646*8975f5c5SAndroid Build Coastguard Worker                                   ErrorSet *errors,
647*8975f5c5SAndroid Build Coastguard Worker                                   angle::EntryPoint entryPoint,
648*8975f5c5SAndroid Build Coastguard Worker                                   PointParameter pname,
649*8975f5c5SAndroid Build Coastguard Worker                                   const GLfloat *params)
650*8975f5c5SAndroid Build Coastguard Worker {
651*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
652*8975f5c5SAndroid Build Coastguard Worker 
653*8975f5c5SAndroid Build Coastguard Worker     switch (pname)
654*8975f5c5SAndroid Build Coastguard Worker     {
655*8975f5c5SAndroid Build Coastguard Worker         case PointParameter::PointSizeMin:
656*8975f5c5SAndroid Build Coastguard Worker         case PointParameter::PointSizeMax:
657*8975f5c5SAndroid Build Coastguard Worker         case PointParameter::PointFadeThresholdSize:
658*8975f5c5SAndroid Build Coastguard Worker         case PointParameter::PointDistanceAttenuation:
659*8975f5c5SAndroid Build Coastguard Worker             for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
660*8975f5c5SAndroid Build Coastguard Worker             {
661*8975f5c5SAndroid Build Coastguard Worker                 if (params[i] < 0.0f)
662*8975f5c5SAndroid Build Coastguard Worker                 {
663*8975f5c5SAndroid Build Coastguard Worker                     errors->validationError(entryPoint, GL_INVALID_VALUE,
664*8975f5c5SAndroid Build Coastguard Worker                                             kInvalidPointParameterValue);
665*8975f5c5SAndroid Build Coastguard Worker                     return false;
666*8975f5c5SAndroid Build Coastguard Worker                 }
667*8975f5c5SAndroid Build Coastguard Worker             }
668*8975f5c5SAndroid Build Coastguard Worker             break;
669*8975f5c5SAndroid Build Coastguard Worker         default:
670*8975f5c5SAndroid Build Coastguard Worker             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidPointParameter);
671*8975f5c5SAndroid Build Coastguard Worker             return false;
672*8975f5c5SAndroid Build Coastguard Worker     }
673*8975f5c5SAndroid Build Coastguard Worker 
674*8975f5c5SAndroid Build Coastguard Worker     return true;
675*8975f5c5SAndroid Build Coastguard Worker }
676*8975f5c5SAndroid Build Coastguard Worker 
ValidatePointSizeCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat size)677*8975f5c5SAndroid Build Coastguard Worker bool ValidatePointSizeCommon(const PrivateState &state,
678*8975f5c5SAndroid Build Coastguard Worker                              ErrorSet *errors,
679*8975f5c5SAndroid Build Coastguard Worker                              angle::EntryPoint entryPoint,
680*8975f5c5SAndroid Build Coastguard Worker                              GLfloat size)
681*8975f5c5SAndroid Build Coastguard Worker {
682*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
683*8975f5c5SAndroid Build Coastguard Worker 
684*8975f5c5SAndroid Build Coastguard Worker     if (size <= 0.0f)
685*8975f5c5SAndroid Build Coastguard Worker     {
686*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidPointSizeValue);
687*8975f5c5SAndroid Build Coastguard Worker         return false;
688*8975f5c5SAndroid Build Coastguard Worker     }
689*8975f5c5SAndroid Build Coastguard Worker 
690*8975f5c5SAndroid Build Coastguard Worker     return true;
691*8975f5c5SAndroid Build Coastguard Worker }
692*8975f5c5SAndroid Build Coastguard Worker 
ValidateDrawTexCommon(const Context * context,angle::EntryPoint entryPoint,float width,float height)693*8975f5c5SAndroid Build Coastguard Worker bool ValidateDrawTexCommon(const Context *context,
694*8975f5c5SAndroid Build Coastguard Worker                            angle::EntryPoint entryPoint,
695*8975f5c5SAndroid Build Coastguard Worker                            float width,
696*8975f5c5SAndroid Build Coastguard Worker                            float height)
697*8975f5c5SAndroid Build Coastguard Worker {
698*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint);
699*8975f5c5SAndroid Build Coastguard Worker 
700*8975f5c5SAndroid Build Coastguard Worker     if (width <= 0.0f || height <= 0.0f)
701*8975f5c5SAndroid Build Coastguard Worker     {
702*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNonPositiveDrawTextureDimension);
703*8975f5c5SAndroid Build Coastguard Worker         return false;
704*8975f5c5SAndroid Build Coastguard Worker     }
705*8975f5c5SAndroid Build Coastguard Worker 
706*8975f5c5SAndroid Build Coastguard Worker     return true;
707*8975f5c5SAndroid Build Coastguard Worker }
708*8975f5c5SAndroid Build Coastguard Worker 
709*8975f5c5SAndroid Build Coastguard Worker }  // namespace gl
710*8975f5c5SAndroid Build Coastguard Worker 
711*8975f5c5SAndroid Build Coastguard Worker namespace gl
712*8975f5c5SAndroid Build Coastguard Worker {
713*8975f5c5SAndroid Build Coastguard Worker 
ValidateAlphaFunc(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,AlphaTestFunc func,GLfloat ref)714*8975f5c5SAndroid Build Coastguard Worker bool ValidateAlphaFunc(const PrivateState &state,
715*8975f5c5SAndroid Build Coastguard Worker                        ErrorSet *errors,
716*8975f5c5SAndroid Build Coastguard Worker                        angle::EntryPoint entryPoint,
717*8975f5c5SAndroid Build Coastguard Worker                        AlphaTestFunc func,
718*8975f5c5SAndroid Build Coastguard Worker                        GLfloat ref)
719*8975f5c5SAndroid Build Coastguard Worker {
720*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
721*8975f5c5SAndroid Build Coastguard Worker     return ValidateAlphaFuncCommon(state, errors, entryPoint, func);
722*8975f5c5SAndroid Build Coastguard Worker }
723*8975f5c5SAndroid Build Coastguard Worker 
ValidateAlphaFuncx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,AlphaTestFunc func,GLfixed ref)724*8975f5c5SAndroid Build Coastguard Worker bool ValidateAlphaFuncx(const PrivateState &state,
725*8975f5c5SAndroid Build Coastguard Worker                         ErrorSet *errors,
726*8975f5c5SAndroid Build Coastguard Worker                         angle::EntryPoint entryPoint,
727*8975f5c5SAndroid Build Coastguard Worker                         AlphaTestFunc func,
728*8975f5c5SAndroid Build Coastguard Worker                         GLfixed ref)
729*8975f5c5SAndroid Build Coastguard Worker {
730*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
731*8975f5c5SAndroid Build Coastguard Worker     return ValidateAlphaFuncCommon(state, errors, entryPoint, func);
732*8975f5c5SAndroid Build Coastguard Worker }
733*8975f5c5SAndroid Build Coastguard Worker 
ValidateClearColorx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed red,GLfixed green,GLfixed blue,GLfixed alpha)734*8975f5c5SAndroid Build Coastguard Worker bool ValidateClearColorx(const PrivateState &state,
735*8975f5c5SAndroid Build Coastguard Worker                          ErrorSet *errors,
736*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
737*8975f5c5SAndroid Build Coastguard Worker                          GLfixed red,
738*8975f5c5SAndroid Build Coastguard Worker                          GLfixed green,
739*8975f5c5SAndroid Build Coastguard Worker                          GLfixed blue,
740*8975f5c5SAndroid Build Coastguard Worker                          GLfixed alpha)
741*8975f5c5SAndroid Build Coastguard Worker {
742*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
743*8975f5c5SAndroid Build Coastguard Worker     return true;
744*8975f5c5SAndroid Build Coastguard Worker }
745*8975f5c5SAndroid Build Coastguard Worker 
ValidateClearDepthx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed depth)746*8975f5c5SAndroid Build Coastguard Worker bool ValidateClearDepthx(const PrivateState &state,
747*8975f5c5SAndroid Build Coastguard Worker                          ErrorSet *errors,
748*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
749*8975f5c5SAndroid Build Coastguard Worker                          GLfixed depth)
750*8975f5c5SAndroid Build Coastguard Worker {
751*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
752*8975f5c5SAndroid Build Coastguard Worker     return true;
753*8975f5c5SAndroid Build Coastguard Worker }
754*8975f5c5SAndroid Build Coastguard Worker 
ValidateClientActiveTexture(const Context * context,angle::EntryPoint entryPoint,GLenum texture)755*8975f5c5SAndroid Build Coastguard Worker bool ValidateClientActiveTexture(const Context *context,
756*8975f5c5SAndroid Build Coastguard Worker                                  angle::EntryPoint entryPoint,
757*8975f5c5SAndroid Build Coastguard Worker                                  GLenum texture)
758*8975f5c5SAndroid Build Coastguard Worker {
759*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint);
760*8975f5c5SAndroid Build Coastguard Worker     return ValidateMultitextureUnit(context->getPrivateState(),
761*8975f5c5SAndroid Build Coastguard Worker                                     context->getMutableErrorSetForValidation(), entryPoint,
762*8975f5c5SAndroid Build Coastguard Worker                                     texture);
763*8975f5c5SAndroid Build Coastguard Worker }
764*8975f5c5SAndroid Build Coastguard Worker 
ValidateClipPlanef(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum plane,const GLfloat * eqn)765*8975f5c5SAndroid Build Coastguard Worker bool ValidateClipPlanef(const PrivateState &state,
766*8975f5c5SAndroid Build Coastguard Worker                         ErrorSet *errors,
767*8975f5c5SAndroid Build Coastguard Worker                         angle::EntryPoint entryPoint,
768*8975f5c5SAndroid Build Coastguard Worker                         GLenum plane,
769*8975f5c5SAndroid Build Coastguard Worker                         const GLfloat *eqn)
770*8975f5c5SAndroid Build Coastguard Worker {
771*8975f5c5SAndroid Build Coastguard Worker     return ValidateClipPlaneCommon(state, errors, entryPoint, plane);
772*8975f5c5SAndroid Build Coastguard Worker }
773*8975f5c5SAndroid Build Coastguard Worker 
ValidateClipPlanex(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum plane,const GLfixed * equation)774*8975f5c5SAndroid Build Coastguard Worker bool ValidateClipPlanex(const PrivateState &state,
775*8975f5c5SAndroid Build Coastguard Worker                         ErrorSet *errors,
776*8975f5c5SAndroid Build Coastguard Worker                         angle::EntryPoint entryPoint,
777*8975f5c5SAndroid Build Coastguard Worker                         GLenum plane,
778*8975f5c5SAndroid Build Coastguard Worker                         const GLfixed *equation)
779*8975f5c5SAndroid Build Coastguard Worker {
780*8975f5c5SAndroid Build Coastguard Worker     return ValidateClipPlaneCommon(state, errors, entryPoint, plane);
781*8975f5c5SAndroid Build Coastguard Worker }
782*8975f5c5SAndroid Build Coastguard Worker 
ValidateColor4f(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat red,GLfloat green,GLfloat blue,GLfloat alpha)783*8975f5c5SAndroid Build Coastguard Worker bool ValidateColor4f(const PrivateState &state,
784*8975f5c5SAndroid Build Coastguard Worker                      ErrorSet *errors,
785*8975f5c5SAndroid Build Coastguard Worker                      angle::EntryPoint entryPoint,
786*8975f5c5SAndroid Build Coastguard Worker                      GLfloat red,
787*8975f5c5SAndroid Build Coastguard Worker                      GLfloat green,
788*8975f5c5SAndroid Build Coastguard Worker                      GLfloat blue,
789*8975f5c5SAndroid Build Coastguard Worker                      GLfloat alpha)
790*8975f5c5SAndroid Build Coastguard Worker {
791*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
792*8975f5c5SAndroid Build Coastguard Worker     return true;
793*8975f5c5SAndroid Build Coastguard Worker }
794*8975f5c5SAndroid Build Coastguard Worker 
ValidateColor4ub(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLubyte red,GLubyte green,GLubyte blue,GLubyte alpha)795*8975f5c5SAndroid Build Coastguard Worker bool ValidateColor4ub(const PrivateState &state,
796*8975f5c5SAndroid Build Coastguard Worker                       ErrorSet *errors,
797*8975f5c5SAndroid Build Coastguard Worker                       angle::EntryPoint entryPoint,
798*8975f5c5SAndroid Build Coastguard Worker                       GLubyte red,
799*8975f5c5SAndroid Build Coastguard Worker                       GLubyte green,
800*8975f5c5SAndroid Build Coastguard Worker                       GLubyte blue,
801*8975f5c5SAndroid Build Coastguard Worker                       GLubyte alpha)
802*8975f5c5SAndroid Build Coastguard Worker {
803*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
804*8975f5c5SAndroid Build Coastguard Worker     return true;
805*8975f5c5SAndroid Build Coastguard Worker }
806*8975f5c5SAndroid Build Coastguard Worker 
ValidateColor4x(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed red,GLfixed green,GLfixed blue,GLfixed alpha)807*8975f5c5SAndroid Build Coastguard Worker bool ValidateColor4x(const PrivateState &state,
808*8975f5c5SAndroid Build Coastguard Worker                      ErrorSet *errors,
809*8975f5c5SAndroid Build Coastguard Worker                      angle::EntryPoint entryPoint,
810*8975f5c5SAndroid Build Coastguard Worker                      GLfixed red,
811*8975f5c5SAndroid Build Coastguard Worker                      GLfixed green,
812*8975f5c5SAndroid Build Coastguard Worker                      GLfixed blue,
813*8975f5c5SAndroid Build Coastguard Worker                      GLfixed alpha)
814*8975f5c5SAndroid Build Coastguard Worker {
815*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
816*8975f5c5SAndroid Build Coastguard Worker     return true;
817*8975f5c5SAndroid Build Coastguard Worker }
818*8975f5c5SAndroid Build Coastguard Worker 
ValidateColorPointer(const Context * context,angle::EntryPoint entryPoint,GLint size,VertexAttribType type,GLsizei stride,const void * pointer)819*8975f5c5SAndroid Build Coastguard Worker bool ValidateColorPointer(const Context *context,
820*8975f5c5SAndroid Build Coastguard Worker                           angle::EntryPoint entryPoint,
821*8975f5c5SAndroid Build Coastguard Worker                           GLint size,
822*8975f5c5SAndroid Build Coastguard Worker                           VertexAttribType type,
823*8975f5c5SAndroid Build Coastguard Worker                           GLsizei stride,
824*8975f5c5SAndroid Build Coastguard Worker                           const void *pointer)
825*8975f5c5SAndroid Build Coastguard Worker {
826*8975f5c5SAndroid Build Coastguard Worker     return ValidateBuiltinVertexAttributeCommon(context, entryPoint, ClientVertexArrayType::Color,
827*8975f5c5SAndroid Build Coastguard Worker                                                 size, type, stride, pointer);
828*8975f5c5SAndroid Build Coastguard Worker }
829*8975f5c5SAndroid Build Coastguard Worker 
ValidateCullFace(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum mode)830*8975f5c5SAndroid Build Coastguard Worker bool ValidateCullFace(const PrivateState &state,
831*8975f5c5SAndroid Build Coastguard Worker                       ErrorSet *errors,
832*8975f5c5SAndroid Build Coastguard Worker                       angle::EntryPoint entryPoint,
833*8975f5c5SAndroid Build Coastguard Worker                       GLenum mode)
834*8975f5c5SAndroid Build Coastguard Worker {
835*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
836*8975f5c5SAndroid Build Coastguard Worker     return true;
837*8975f5c5SAndroid Build Coastguard Worker }
838*8975f5c5SAndroid Build Coastguard Worker 
ValidateDepthRangex(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed n,GLfixed f)839*8975f5c5SAndroid Build Coastguard Worker bool ValidateDepthRangex(const PrivateState &state,
840*8975f5c5SAndroid Build Coastguard Worker                          ErrorSet *errors,
841*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
842*8975f5c5SAndroid Build Coastguard Worker                          GLfixed n,
843*8975f5c5SAndroid Build Coastguard Worker                          GLfixed f)
844*8975f5c5SAndroid Build Coastguard Worker {
845*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
846*8975f5c5SAndroid Build Coastguard Worker     if (state.isWebGL() && n > f)
847*8975f5c5SAndroid Build Coastguard Worker     {
848*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_OPERATION, kInvalidDepthRange);
849*8975f5c5SAndroid Build Coastguard Worker         return false;
850*8975f5c5SAndroid Build Coastguard Worker     }
851*8975f5c5SAndroid Build Coastguard Worker 
852*8975f5c5SAndroid Build Coastguard Worker     return true;
853*8975f5c5SAndroid Build Coastguard Worker }
854*8975f5c5SAndroid Build Coastguard Worker 
ValidateDisableClientState(const Context * context,angle::EntryPoint entryPoint,ClientVertexArrayType arrayType)855*8975f5c5SAndroid Build Coastguard Worker bool ValidateDisableClientState(const Context *context,
856*8975f5c5SAndroid Build Coastguard Worker                                 angle::EntryPoint entryPoint,
857*8975f5c5SAndroid Build Coastguard Worker                                 ClientVertexArrayType arrayType)
858*8975f5c5SAndroid Build Coastguard Worker {
859*8975f5c5SAndroid Build Coastguard Worker     return ValidateClientStateCommon(context, entryPoint, arrayType);
860*8975f5c5SAndroid Build Coastguard Worker }
861*8975f5c5SAndroid Build Coastguard Worker 
ValidateEnableClientState(const Context * context,angle::EntryPoint entryPoint,ClientVertexArrayType arrayType)862*8975f5c5SAndroid Build Coastguard Worker bool ValidateEnableClientState(const Context *context,
863*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
864*8975f5c5SAndroid Build Coastguard Worker                                ClientVertexArrayType arrayType)
865*8975f5c5SAndroid Build Coastguard Worker {
866*8975f5c5SAndroid Build Coastguard Worker     return ValidateClientStateCommon(context, entryPoint, arrayType);
867*8975f5c5SAndroid Build Coastguard Worker }
868*8975f5c5SAndroid Build Coastguard Worker 
ValidateFogf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,GLfloat param)869*8975f5c5SAndroid Build Coastguard Worker bool ValidateFogf(const PrivateState &state,
870*8975f5c5SAndroid Build Coastguard Worker                   ErrorSet *errors,
871*8975f5c5SAndroid Build Coastguard Worker                   angle::EntryPoint entryPoint,
872*8975f5c5SAndroid Build Coastguard Worker                   GLenum pname,
873*8975f5c5SAndroid Build Coastguard Worker                   GLfloat param)
874*8975f5c5SAndroid Build Coastguard Worker {
875*8975f5c5SAndroid Build Coastguard Worker     return ValidateFogCommon(state, errors, entryPoint, pname, &param);
876*8975f5c5SAndroid Build Coastguard Worker }
877*8975f5c5SAndroid Build Coastguard Worker 
ValidateFogfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,const GLfloat * params)878*8975f5c5SAndroid Build Coastguard Worker bool ValidateFogfv(const PrivateState &state,
879*8975f5c5SAndroid Build Coastguard Worker                    ErrorSet *errors,
880*8975f5c5SAndroid Build Coastguard Worker                    angle::EntryPoint entryPoint,
881*8975f5c5SAndroid Build Coastguard Worker                    GLenum pname,
882*8975f5c5SAndroid Build Coastguard Worker                    const GLfloat *params)
883*8975f5c5SAndroid Build Coastguard Worker {
884*8975f5c5SAndroid Build Coastguard Worker     return ValidateFogCommon(state, errors, entryPoint, pname, params);
885*8975f5c5SAndroid Build Coastguard Worker }
886*8975f5c5SAndroid Build Coastguard Worker 
ValidateFogx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,GLfixed param)887*8975f5c5SAndroid Build Coastguard Worker bool ValidateFogx(const PrivateState &state,
888*8975f5c5SAndroid Build Coastguard Worker                   ErrorSet *errors,
889*8975f5c5SAndroid Build Coastguard Worker                   angle::EntryPoint entryPoint,
890*8975f5c5SAndroid Build Coastguard Worker                   GLenum pname,
891*8975f5c5SAndroid Build Coastguard Worker                   GLfixed param)
892*8975f5c5SAndroid Build Coastguard Worker {
893*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
894*8975f5c5SAndroid Build Coastguard Worker     GLfloat asFloat =
895*8975f5c5SAndroid Build Coastguard Worker         pname == GL_FOG_MODE ? static_cast<GLfloat>(param) : ConvertFixedToFloat(param);
896*8975f5c5SAndroid Build Coastguard Worker     return ValidateFogCommon(state, errors, entryPoint, pname, &asFloat);
897*8975f5c5SAndroid Build Coastguard Worker }
898*8975f5c5SAndroid Build Coastguard Worker 
ValidateFogxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,const GLfixed * params)899*8975f5c5SAndroid Build Coastguard Worker bool ValidateFogxv(const PrivateState &state,
900*8975f5c5SAndroid Build Coastguard Worker                    ErrorSet *errors,
901*8975f5c5SAndroid Build Coastguard Worker                    angle::EntryPoint entryPoint,
902*8975f5c5SAndroid Build Coastguard Worker                    GLenum pname,
903*8975f5c5SAndroid Build Coastguard Worker                    const GLfixed *params)
904*8975f5c5SAndroid Build Coastguard Worker {
905*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
906*8975f5c5SAndroid Build Coastguard Worker     unsigned int paramCount = GetFogParameterCount(pname);
907*8975f5c5SAndroid Build Coastguard Worker     GLfloat paramsf[4]      = {};
908*8975f5c5SAndroid Build Coastguard Worker 
909*8975f5c5SAndroid Build Coastguard Worker     if (pname == GL_FOG_MODE)
910*8975f5c5SAndroid Build Coastguard Worker     {
911*8975f5c5SAndroid Build Coastguard Worker         paramsf[0] = static_cast<GLfloat>(params[0]);
912*8975f5c5SAndroid Build Coastguard Worker     }
913*8975f5c5SAndroid Build Coastguard Worker     else
914*8975f5c5SAndroid Build Coastguard Worker     {
915*8975f5c5SAndroid Build Coastguard Worker         for (unsigned int i = 0; i < paramCount; i++)
916*8975f5c5SAndroid Build Coastguard Worker         {
917*8975f5c5SAndroid Build Coastguard Worker             paramsf[i] = ConvertFixedToFloat(params[i]);
918*8975f5c5SAndroid Build Coastguard Worker         }
919*8975f5c5SAndroid Build Coastguard Worker     }
920*8975f5c5SAndroid Build Coastguard Worker 
921*8975f5c5SAndroid Build Coastguard Worker     return ValidateFogCommon(state, errors, entryPoint, pname, paramsf);
922*8975f5c5SAndroid Build Coastguard Worker }
923*8975f5c5SAndroid Build Coastguard Worker 
ValidateFrustumf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat l,GLfloat r,GLfloat b,GLfloat t,GLfloat n,GLfloat f)924*8975f5c5SAndroid Build Coastguard Worker bool ValidateFrustumf(const PrivateState &state,
925*8975f5c5SAndroid Build Coastguard Worker                       ErrorSet *errors,
926*8975f5c5SAndroid Build Coastguard Worker                       angle::EntryPoint entryPoint,
927*8975f5c5SAndroid Build Coastguard Worker                       GLfloat l,
928*8975f5c5SAndroid Build Coastguard Worker                       GLfloat r,
929*8975f5c5SAndroid Build Coastguard Worker                       GLfloat b,
930*8975f5c5SAndroid Build Coastguard Worker                       GLfloat t,
931*8975f5c5SAndroid Build Coastguard Worker                       GLfloat n,
932*8975f5c5SAndroid Build Coastguard Worker                       GLfloat f)
933*8975f5c5SAndroid Build Coastguard Worker {
934*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
935*8975f5c5SAndroid Build Coastguard Worker     if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f)
936*8975f5c5SAndroid Build Coastguard Worker     {
937*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidProjectionMatrix);
938*8975f5c5SAndroid Build Coastguard Worker         return false;
939*8975f5c5SAndroid Build Coastguard Worker     }
940*8975f5c5SAndroid Build Coastguard Worker     return true;
941*8975f5c5SAndroid Build Coastguard Worker }
942*8975f5c5SAndroid Build Coastguard Worker 
ValidateFrustumx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed l,GLfixed r,GLfixed b,GLfixed t,GLfixed n,GLfixed f)943*8975f5c5SAndroid Build Coastguard Worker bool ValidateFrustumx(const PrivateState &state,
944*8975f5c5SAndroid Build Coastguard Worker                       ErrorSet *errors,
945*8975f5c5SAndroid Build Coastguard Worker                       angle::EntryPoint entryPoint,
946*8975f5c5SAndroid Build Coastguard Worker                       GLfixed l,
947*8975f5c5SAndroid Build Coastguard Worker                       GLfixed r,
948*8975f5c5SAndroid Build Coastguard Worker                       GLfixed b,
949*8975f5c5SAndroid Build Coastguard Worker                       GLfixed t,
950*8975f5c5SAndroid Build Coastguard Worker                       GLfixed n,
951*8975f5c5SAndroid Build Coastguard Worker                       GLfixed f)
952*8975f5c5SAndroid Build Coastguard Worker {
953*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
954*8975f5c5SAndroid Build Coastguard Worker     if (l == r || b == t || n == f || n <= 0 || f <= 0)
955*8975f5c5SAndroid Build Coastguard Worker     {
956*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidProjectionMatrix);
957*8975f5c5SAndroid Build Coastguard Worker         return false;
958*8975f5c5SAndroid Build Coastguard Worker     }
959*8975f5c5SAndroid Build Coastguard Worker     return true;
960*8975f5c5SAndroid Build Coastguard Worker }
961*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetBufferParameteriv(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum pname,const GLint * params)962*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetBufferParameteriv(const Context *context,
963*8975f5c5SAndroid Build Coastguard Worker                                   angle::EntryPoint entryPoint,
964*8975f5c5SAndroid Build Coastguard Worker                                   GLenum target,
965*8975f5c5SAndroid Build Coastguard Worker                                   GLenum pname,
966*8975f5c5SAndroid Build Coastguard Worker                                   const GLint *params)
967*8975f5c5SAndroid Build Coastguard Worker {
968*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
969*8975f5c5SAndroid Build Coastguard Worker     return true;
970*8975f5c5SAndroid Build Coastguard Worker }
971*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetClipPlanef(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum plane,const GLfloat * equation)972*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetClipPlanef(const PrivateState &state,
973*8975f5c5SAndroid Build Coastguard Worker                            ErrorSet *errors,
974*8975f5c5SAndroid Build Coastguard Worker                            angle::EntryPoint entryPoint,
975*8975f5c5SAndroid Build Coastguard Worker                            GLenum plane,
976*8975f5c5SAndroid Build Coastguard Worker                            const GLfloat *equation)
977*8975f5c5SAndroid Build Coastguard Worker {
978*8975f5c5SAndroid Build Coastguard Worker     return ValidateClipPlaneCommon(state, errors, entryPoint, plane);
979*8975f5c5SAndroid Build Coastguard Worker }
980*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetClipPlanex(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum plane,const GLfixed * equation)981*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetClipPlanex(const PrivateState &state,
982*8975f5c5SAndroid Build Coastguard Worker                            ErrorSet *errors,
983*8975f5c5SAndroid Build Coastguard Worker                            angle::EntryPoint entryPoint,
984*8975f5c5SAndroid Build Coastguard Worker                            GLenum plane,
985*8975f5c5SAndroid Build Coastguard Worker                            const GLfixed *equation)
986*8975f5c5SAndroid Build Coastguard Worker {
987*8975f5c5SAndroid Build Coastguard Worker     return ValidateClipPlaneCommon(state, errors, entryPoint, plane);
988*8975f5c5SAndroid Build Coastguard Worker }
989*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetFixedv(const Context * context,angle::EntryPoint entryPoint,GLenum pname,const GLfixed * params)990*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetFixedv(const Context *context,
991*8975f5c5SAndroid Build Coastguard Worker                        angle::EntryPoint entryPoint,
992*8975f5c5SAndroid Build Coastguard Worker                        GLenum pname,
993*8975f5c5SAndroid Build Coastguard Worker                        const GLfixed *params)
994*8975f5c5SAndroid Build Coastguard Worker {
995*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint);
996*8975f5c5SAndroid Build Coastguard Worker     GLenum nativeType;
997*8975f5c5SAndroid Build Coastguard Worker     unsigned int numParams = 0;
998*8975f5c5SAndroid Build Coastguard Worker     return ValidateStateQuery(context, entryPoint, pname, &nativeType, &numParams);
999*8975f5c5SAndroid Build Coastguard Worker }
1000*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetLightfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light,LightParameter pname,const GLfloat * params)1001*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetLightfv(const PrivateState &state,
1002*8975f5c5SAndroid Build Coastguard Worker                         ErrorSet *errors,
1003*8975f5c5SAndroid Build Coastguard Worker                         angle::EntryPoint entryPoint,
1004*8975f5c5SAndroid Build Coastguard Worker                         GLenum light,
1005*8975f5c5SAndroid Build Coastguard Worker                         LightParameter pname,
1006*8975f5c5SAndroid Build Coastguard Worker                         const GLfloat *params)
1007*8975f5c5SAndroid Build Coastguard Worker {
1008*8975f5c5SAndroid Build Coastguard Worker     GLfloat validateParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
1009*8975f5c5SAndroid Build Coastguard Worker     return ValidateLightCommon(state, errors, entryPoint, light, pname, validateParams);
1010*8975f5c5SAndroid Build Coastguard Worker }
1011*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetLightxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light,LightParameter pname,const GLfixed * params)1012*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetLightxv(const PrivateState &state,
1013*8975f5c5SAndroid Build Coastguard Worker                         ErrorSet *errors,
1014*8975f5c5SAndroid Build Coastguard Worker                         angle::EntryPoint entryPoint,
1015*8975f5c5SAndroid Build Coastguard Worker                         GLenum light,
1016*8975f5c5SAndroid Build Coastguard Worker                         LightParameter pname,
1017*8975f5c5SAndroid Build Coastguard Worker                         const GLfixed *params)
1018*8975f5c5SAndroid Build Coastguard Worker {
1019*8975f5c5SAndroid Build Coastguard Worker     GLfloat validateParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
1020*8975f5c5SAndroid Build Coastguard Worker     return ValidateLightCommon(state, errors, entryPoint, light, pname, validateParams);
1021*8975f5c5SAndroid Build Coastguard Worker }
1022*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetMaterialfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,const GLfloat * params)1023*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetMaterialfv(const PrivateState &state,
1024*8975f5c5SAndroid Build Coastguard Worker                            ErrorSet *errors,
1025*8975f5c5SAndroid Build Coastguard Worker                            angle::EntryPoint entryPoint,
1026*8975f5c5SAndroid Build Coastguard Worker                            GLenum face,
1027*8975f5c5SAndroid Build Coastguard Worker                            MaterialParameter pname,
1028*8975f5c5SAndroid Build Coastguard Worker                            const GLfloat *params)
1029*8975f5c5SAndroid Build Coastguard Worker {
1030*8975f5c5SAndroid Build Coastguard Worker     return ValidateMaterialQuery(state, errors, entryPoint, face, pname);
1031*8975f5c5SAndroid Build Coastguard Worker }
1032*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetMaterialxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,const GLfixed * params)1033*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetMaterialxv(const PrivateState &state,
1034*8975f5c5SAndroid Build Coastguard Worker                            ErrorSet *errors,
1035*8975f5c5SAndroid Build Coastguard Worker                            angle::EntryPoint entryPoint,
1036*8975f5c5SAndroid Build Coastguard Worker                            GLenum face,
1037*8975f5c5SAndroid Build Coastguard Worker                            MaterialParameter pname,
1038*8975f5c5SAndroid Build Coastguard Worker                            const GLfixed *params)
1039*8975f5c5SAndroid Build Coastguard Worker {
1040*8975f5c5SAndroid Build Coastguard Worker     return ValidateMaterialQuery(state, errors, entryPoint, face, pname);
1041*8975f5c5SAndroid Build Coastguard Worker }
1042*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetTexEnvfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,const GLfloat * params)1043*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetTexEnvfv(const PrivateState &state,
1044*8975f5c5SAndroid Build Coastguard Worker                          ErrorSet *errors,
1045*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
1046*8975f5c5SAndroid Build Coastguard Worker                          TextureEnvTarget target,
1047*8975f5c5SAndroid Build Coastguard Worker                          TextureEnvParameter pname,
1048*8975f5c5SAndroid Build Coastguard Worker                          const GLfloat *params)
1049*8975f5c5SAndroid Build Coastguard Worker {
1050*8975f5c5SAndroid Build Coastguard Worker     return ValidateGetTexEnvCommon(state, errors, entryPoint, target, pname);
1051*8975f5c5SAndroid Build Coastguard Worker }
1052*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetTexEnviv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,const GLint * params)1053*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetTexEnviv(const PrivateState &state,
1054*8975f5c5SAndroid Build Coastguard Worker                          ErrorSet *errors,
1055*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
1056*8975f5c5SAndroid Build Coastguard Worker                          TextureEnvTarget target,
1057*8975f5c5SAndroid Build Coastguard Worker                          TextureEnvParameter pname,
1058*8975f5c5SAndroid Build Coastguard Worker                          const GLint *params)
1059*8975f5c5SAndroid Build Coastguard Worker {
1060*8975f5c5SAndroid Build Coastguard Worker     return ValidateGetTexEnvCommon(state, errors, entryPoint, target, pname);
1061*8975f5c5SAndroid Build Coastguard Worker }
1062*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetTexEnvxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,const GLfixed * params)1063*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetTexEnvxv(const PrivateState &state,
1064*8975f5c5SAndroid Build Coastguard Worker                          ErrorSet *errors,
1065*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
1066*8975f5c5SAndroid Build Coastguard Worker                          TextureEnvTarget target,
1067*8975f5c5SAndroid Build Coastguard Worker                          TextureEnvParameter pname,
1068*8975f5c5SAndroid Build Coastguard Worker                          const GLfixed *params)
1069*8975f5c5SAndroid Build Coastguard Worker {
1070*8975f5c5SAndroid Build Coastguard Worker     return ValidateGetTexEnvCommon(state, errors, entryPoint, target, pname);
1071*8975f5c5SAndroid Build Coastguard Worker }
1072*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetTexParameterxv(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLenum pname,const GLfixed * params)1073*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetTexParameterxv(const Context *context,
1074*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
1075*8975f5c5SAndroid Build Coastguard Worker                                TextureType target,
1076*8975f5c5SAndroid Build Coastguard Worker                                GLenum pname,
1077*8975f5c5SAndroid Build Coastguard Worker                                const GLfixed *params)
1078*8975f5c5SAndroid Build Coastguard Worker {
1079*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint);
1080*8975f5c5SAndroid Build Coastguard Worker 
1081*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateGetTexParameterBase(context, entryPoint, target, pname, nullptr))
1082*8975f5c5SAndroid Build Coastguard Worker     {
1083*8975f5c5SAndroid Build Coastguard Worker         return false;
1084*8975f5c5SAndroid Build Coastguard Worker     }
1085*8975f5c5SAndroid Build Coastguard Worker 
1086*8975f5c5SAndroid Build Coastguard Worker     return true;
1087*8975f5c5SAndroid Build Coastguard Worker }
1088*8975f5c5SAndroid Build Coastguard Worker 
ValidateLightModelf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,GLfloat param)1089*8975f5c5SAndroid Build Coastguard Worker bool ValidateLightModelf(const PrivateState &state,
1090*8975f5c5SAndroid Build Coastguard Worker                          ErrorSet *errors,
1091*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
1092*8975f5c5SAndroid Build Coastguard Worker                          GLenum pname,
1093*8975f5c5SAndroid Build Coastguard Worker                          GLfloat param)
1094*8975f5c5SAndroid Build Coastguard Worker {
1095*8975f5c5SAndroid Build Coastguard Worker     return ValidateLightModelSingleComponent(state, errors, entryPoint, pname);
1096*8975f5c5SAndroid Build Coastguard Worker }
1097*8975f5c5SAndroid Build Coastguard Worker 
ValidateLightModelfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,const GLfloat * params)1098*8975f5c5SAndroid Build Coastguard Worker bool ValidateLightModelfv(const PrivateState &state,
1099*8975f5c5SAndroid Build Coastguard Worker                           ErrorSet *errors,
1100*8975f5c5SAndroid Build Coastguard Worker                           angle::EntryPoint entryPoint,
1101*8975f5c5SAndroid Build Coastguard Worker                           GLenum pname,
1102*8975f5c5SAndroid Build Coastguard Worker                           const GLfloat *params)
1103*8975f5c5SAndroid Build Coastguard Worker {
1104*8975f5c5SAndroid Build Coastguard Worker     return ValidateLightModelCommon(state, errors, entryPoint, pname);
1105*8975f5c5SAndroid Build Coastguard Worker }
1106*8975f5c5SAndroid Build Coastguard Worker 
ValidateLightModelx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,GLfixed param)1107*8975f5c5SAndroid Build Coastguard Worker bool ValidateLightModelx(const PrivateState &state,
1108*8975f5c5SAndroid Build Coastguard Worker                          ErrorSet *errors,
1109*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
1110*8975f5c5SAndroid Build Coastguard Worker                          GLenum pname,
1111*8975f5c5SAndroid Build Coastguard Worker                          GLfixed param)
1112*8975f5c5SAndroid Build Coastguard Worker {
1113*8975f5c5SAndroid Build Coastguard Worker     return ValidateLightModelSingleComponent(state, errors, entryPoint, pname);
1114*8975f5c5SAndroid Build Coastguard Worker }
1115*8975f5c5SAndroid Build Coastguard Worker 
ValidateLightModelxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,const GLfixed * param)1116*8975f5c5SAndroid Build Coastguard Worker bool ValidateLightModelxv(const PrivateState &state,
1117*8975f5c5SAndroid Build Coastguard Worker                           ErrorSet *errors,
1118*8975f5c5SAndroid Build Coastguard Worker                           angle::EntryPoint entryPoint,
1119*8975f5c5SAndroid Build Coastguard Worker                           GLenum pname,
1120*8975f5c5SAndroid Build Coastguard Worker                           const GLfixed *param)
1121*8975f5c5SAndroid Build Coastguard Worker {
1122*8975f5c5SAndroid Build Coastguard Worker     return ValidateLightModelCommon(state, errors, entryPoint, pname);
1123*8975f5c5SAndroid Build Coastguard Worker }
1124*8975f5c5SAndroid Build Coastguard Worker 
ValidateLightf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light,LightParameter pname,GLfloat param)1125*8975f5c5SAndroid Build Coastguard Worker bool ValidateLightf(const PrivateState &state,
1126*8975f5c5SAndroid Build Coastguard Worker                     ErrorSet *errors,
1127*8975f5c5SAndroid Build Coastguard Worker                     angle::EntryPoint entryPoint,
1128*8975f5c5SAndroid Build Coastguard Worker                     GLenum light,
1129*8975f5c5SAndroid Build Coastguard Worker                     LightParameter pname,
1130*8975f5c5SAndroid Build Coastguard Worker                     GLfloat param)
1131*8975f5c5SAndroid Build Coastguard Worker {
1132*8975f5c5SAndroid Build Coastguard Worker     return ValidateLightSingleComponent(state, errors, entryPoint, light, pname, param);
1133*8975f5c5SAndroid Build Coastguard Worker }
1134*8975f5c5SAndroid Build Coastguard Worker 
ValidateLightfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light,LightParameter pname,const GLfloat * params)1135*8975f5c5SAndroid Build Coastguard Worker bool ValidateLightfv(const PrivateState &state,
1136*8975f5c5SAndroid Build Coastguard Worker                      ErrorSet *errors,
1137*8975f5c5SAndroid Build Coastguard Worker                      angle::EntryPoint entryPoint,
1138*8975f5c5SAndroid Build Coastguard Worker                      GLenum light,
1139*8975f5c5SAndroid Build Coastguard Worker                      LightParameter pname,
1140*8975f5c5SAndroid Build Coastguard Worker                      const GLfloat *params)
1141*8975f5c5SAndroid Build Coastguard Worker {
1142*8975f5c5SAndroid Build Coastguard Worker     return ValidateLightCommon(state, errors, entryPoint, light, pname, params);
1143*8975f5c5SAndroid Build Coastguard Worker }
1144*8975f5c5SAndroid Build Coastguard Worker 
ValidateLightx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light,LightParameter pname,GLfixed param)1145*8975f5c5SAndroid Build Coastguard Worker bool ValidateLightx(const PrivateState &state,
1146*8975f5c5SAndroid Build Coastguard Worker                     ErrorSet *errors,
1147*8975f5c5SAndroid Build Coastguard Worker                     angle::EntryPoint entryPoint,
1148*8975f5c5SAndroid Build Coastguard Worker                     GLenum light,
1149*8975f5c5SAndroid Build Coastguard Worker                     LightParameter pname,
1150*8975f5c5SAndroid Build Coastguard Worker                     GLfixed param)
1151*8975f5c5SAndroid Build Coastguard Worker {
1152*8975f5c5SAndroid Build Coastguard Worker     return ValidateLightSingleComponent(state, errors, entryPoint, light, pname,
1153*8975f5c5SAndroid Build Coastguard Worker                                         ConvertFixedToFloat(param));
1154*8975f5c5SAndroid Build Coastguard Worker }
1155*8975f5c5SAndroid Build Coastguard Worker 
ValidateLightxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light,LightParameter pname,const GLfixed * params)1156*8975f5c5SAndroid Build Coastguard Worker bool ValidateLightxv(const PrivateState &state,
1157*8975f5c5SAndroid Build Coastguard Worker                      ErrorSet *errors,
1158*8975f5c5SAndroid Build Coastguard Worker                      angle::EntryPoint entryPoint,
1159*8975f5c5SAndroid Build Coastguard Worker                      GLenum light,
1160*8975f5c5SAndroid Build Coastguard Worker                      LightParameter pname,
1161*8975f5c5SAndroid Build Coastguard Worker                      const GLfixed *params)
1162*8975f5c5SAndroid Build Coastguard Worker {
1163*8975f5c5SAndroid Build Coastguard Worker     GLfloat paramsf[4];
1164*8975f5c5SAndroid Build Coastguard Worker     for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
1165*8975f5c5SAndroid Build Coastguard Worker     {
1166*8975f5c5SAndroid Build Coastguard Worker         paramsf[i] = ConvertFixedToFloat(params[i]);
1167*8975f5c5SAndroid Build Coastguard Worker     }
1168*8975f5c5SAndroid Build Coastguard Worker 
1169*8975f5c5SAndroid Build Coastguard Worker     return ValidateLightCommon(state, errors, entryPoint, light, pname, paramsf);
1170*8975f5c5SAndroid Build Coastguard Worker }
1171*8975f5c5SAndroid Build Coastguard Worker 
ValidateLineWidthx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed width)1172*8975f5c5SAndroid Build Coastguard Worker bool ValidateLineWidthx(const PrivateState &state,
1173*8975f5c5SAndroid Build Coastguard Worker                         ErrorSet *errors,
1174*8975f5c5SAndroid Build Coastguard Worker                         angle::EntryPoint entryPoint,
1175*8975f5c5SAndroid Build Coastguard Worker                         GLfixed width)
1176*8975f5c5SAndroid Build Coastguard Worker {
1177*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1178*8975f5c5SAndroid Build Coastguard Worker     if (width <= 0)
1179*8975f5c5SAndroid Build Coastguard Worker     {
1180*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidWidth);
1181*8975f5c5SAndroid Build Coastguard Worker         return false;
1182*8975f5c5SAndroid Build Coastguard Worker     }
1183*8975f5c5SAndroid Build Coastguard Worker 
1184*8975f5c5SAndroid Build Coastguard Worker     return true;
1185*8975f5c5SAndroid Build Coastguard Worker }
1186*8975f5c5SAndroid Build Coastguard Worker 
ValidateLoadIdentity(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint)1187*8975f5c5SAndroid Build Coastguard Worker bool ValidateLoadIdentity(const PrivateState &state, ErrorSet *errors, angle::EntryPoint entryPoint)
1188*8975f5c5SAndroid Build Coastguard Worker {
1189*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1190*8975f5c5SAndroid Build Coastguard Worker     return true;
1191*8975f5c5SAndroid Build Coastguard Worker }
1192*8975f5c5SAndroid Build Coastguard Worker 
ValidateLoadMatrixf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,const GLfloat * m)1193*8975f5c5SAndroid Build Coastguard Worker bool ValidateLoadMatrixf(const PrivateState &state,
1194*8975f5c5SAndroid Build Coastguard Worker                          ErrorSet *errors,
1195*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
1196*8975f5c5SAndroid Build Coastguard Worker                          const GLfloat *m)
1197*8975f5c5SAndroid Build Coastguard Worker {
1198*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1199*8975f5c5SAndroid Build Coastguard Worker     return true;
1200*8975f5c5SAndroid Build Coastguard Worker }
1201*8975f5c5SAndroid Build Coastguard Worker 
ValidateLoadMatrixx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,const GLfixed * m)1202*8975f5c5SAndroid Build Coastguard Worker bool ValidateLoadMatrixx(const PrivateState &state,
1203*8975f5c5SAndroid Build Coastguard Worker                          ErrorSet *errors,
1204*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
1205*8975f5c5SAndroid Build Coastguard Worker                          const GLfixed *m)
1206*8975f5c5SAndroid Build Coastguard Worker {
1207*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1208*8975f5c5SAndroid Build Coastguard Worker     return true;
1209*8975f5c5SAndroid Build Coastguard Worker }
1210*8975f5c5SAndroid Build Coastguard Worker 
ValidateLogicOp(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,LogicalOperation opcode)1211*8975f5c5SAndroid Build Coastguard Worker bool ValidateLogicOp(const PrivateState &state,
1212*8975f5c5SAndroid Build Coastguard Worker                      ErrorSet *errors,
1213*8975f5c5SAndroid Build Coastguard Worker                      angle::EntryPoint entryPoint,
1214*8975f5c5SAndroid Build Coastguard Worker                      LogicalOperation opcode)
1215*8975f5c5SAndroid Build Coastguard Worker {
1216*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1217*8975f5c5SAndroid Build Coastguard Worker     return ValidateLogicOpCommon(state, errors, entryPoint, opcode);
1218*8975f5c5SAndroid Build Coastguard Worker }
1219*8975f5c5SAndroid Build Coastguard Worker 
ValidateMaterialf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,GLfloat param)1220*8975f5c5SAndroid Build Coastguard Worker bool ValidateMaterialf(const PrivateState &state,
1221*8975f5c5SAndroid Build Coastguard Worker                        ErrorSet *errors,
1222*8975f5c5SAndroid Build Coastguard Worker                        angle::EntryPoint entryPoint,
1223*8975f5c5SAndroid Build Coastguard Worker                        GLenum face,
1224*8975f5c5SAndroid Build Coastguard Worker                        MaterialParameter pname,
1225*8975f5c5SAndroid Build Coastguard Worker                        GLfloat param)
1226*8975f5c5SAndroid Build Coastguard Worker {
1227*8975f5c5SAndroid Build Coastguard Worker     return ValidateMaterialSingleComponent(state, errors, entryPoint, face, pname, param);
1228*8975f5c5SAndroid Build Coastguard Worker }
1229*8975f5c5SAndroid Build Coastguard Worker 
ValidateMaterialfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,const GLfloat * params)1230*8975f5c5SAndroid Build Coastguard Worker bool ValidateMaterialfv(const PrivateState &state,
1231*8975f5c5SAndroid Build Coastguard Worker                         ErrorSet *errors,
1232*8975f5c5SAndroid Build Coastguard Worker                         angle::EntryPoint entryPoint,
1233*8975f5c5SAndroid Build Coastguard Worker                         GLenum face,
1234*8975f5c5SAndroid Build Coastguard Worker                         MaterialParameter pname,
1235*8975f5c5SAndroid Build Coastguard Worker                         const GLfloat *params)
1236*8975f5c5SAndroid Build Coastguard Worker {
1237*8975f5c5SAndroid Build Coastguard Worker     return ValidateMaterialSetting(state, errors, entryPoint, face, pname, params);
1238*8975f5c5SAndroid Build Coastguard Worker }
1239*8975f5c5SAndroid Build Coastguard Worker 
ValidateMaterialx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,GLfixed param)1240*8975f5c5SAndroid Build Coastguard Worker bool ValidateMaterialx(const PrivateState &state,
1241*8975f5c5SAndroid Build Coastguard Worker                        ErrorSet *errors,
1242*8975f5c5SAndroid Build Coastguard Worker                        angle::EntryPoint entryPoint,
1243*8975f5c5SAndroid Build Coastguard Worker                        GLenum face,
1244*8975f5c5SAndroid Build Coastguard Worker                        MaterialParameter pname,
1245*8975f5c5SAndroid Build Coastguard Worker                        GLfixed param)
1246*8975f5c5SAndroid Build Coastguard Worker {
1247*8975f5c5SAndroid Build Coastguard Worker     return ValidateMaterialSingleComponent(state, errors, entryPoint, face, pname,
1248*8975f5c5SAndroid Build Coastguard Worker                                            ConvertFixedToFloat(param));
1249*8975f5c5SAndroid Build Coastguard Worker }
1250*8975f5c5SAndroid Build Coastguard Worker 
ValidateMaterialxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,const GLfixed * params)1251*8975f5c5SAndroid Build Coastguard Worker bool ValidateMaterialxv(const PrivateState &state,
1252*8975f5c5SAndroid Build Coastguard Worker                         ErrorSet *errors,
1253*8975f5c5SAndroid Build Coastguard Worker                         angle::EntryPoint entryPoint,
1254*8975f5c5SAndroid Build Coastguard Worker                         GLenum face,
1255*8975f5c5SAndroid Build Coastguard Worker                         MaterialParameter pname,
1256*8975f5c5SAndroid Build Coastguard Worker                         const GLfixed *params)
1257*8975f5c5SAndroid Build Coastguard Worker {
1258*8975f5c5SAndroid Build Coastguard Worker     GLfloat paramsf[4];
1259*8975f5c5SAndroid Build Coastguard Worker 
1260*8975f5c5SAndroid Build Coastguard Worker     for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
1261*8975f5c5SAndroid Build Coastguard Worker     {
1262*8975f5c5SAndroid Build Coastguard Worker         paramsf[i] = ConvertFixedToFloat(params[i]);
1263*8975f5c5SAndroid Build Coastguard Worker     }
1264*8975f5c5SAndroid Build Coastguard Worker 
1265*8975f5c5SAndroid Build Coastguard Worker     return ValidateMaterialSetting(state, errors, entryPoint, face, pname, paramsf);
1266*8975f5c5SAndroid Build Coastguard Worker }
1267*8975f5c5SAndroid Build Coastguard Worker 
ValidateMatrixMode(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,MatrixType mode)1268*8975f5c5SAndroid Build Coastguard Worker bool ValidateMatrixMode(const PrivateState &state,
1269*8975f5c5SAndroid Build Coastguard Worker                         ErrorSet *errors,
1270*8975f5c5SAndroid Build Coastguard Worker                         angle::EntryPoint entryPoint,
1271*8975f5c5SAndroid Build Coastguard Worker                         MatrixType mode)
1272*8975f5c5SAndroid Build Coastguard Worker {
1273*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1274*8975f5c5SAndroid Build Coastguard Worker     switch (mode)
1275*8975f5c5SAndroid Build Coastguard Worker     {
1276*8975f5c5SAndroid Build Coastguard Worker         case MatrixType::Projection:
1277*8975f5c5SAndroid Build Coastguard Worker         case MatrixType::Modelview:
1278*8975f5c5SAndroid Build Coastguard Worker         case MatrixType::Texture:
1279*8975f5c5SAndroid Build Coastguard Worker             return true;
1280*8975f5c5SAndroid Build Coastguard Worker         default:
1281*8975f5c5SAndroid Build Coastguard Worker             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidMatrixMode);
1282*8975f5c5SAndroid Build Coastguard Worker             return false;
1283*8975f5c5SAndroid Build Coastguard Worker     }
1284*8975f5c5SAndroid Build Coastguard Worker }
1285*8975f5c5SAndroid Build Coastguard Worker 
ValidateMultMatrixf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,const GLfloat * m)1286*8975f5c5SAndroid Build Coastguard Worker bool ValidateMultMatrixf(const PrivateState &state,
1287*8975f5c5SAndroid Build Coastguard Worker                          ErrorSet *errors,
1288*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
1289*8975f5c5SAndroid Build Coastguard Worker                          const GLfloat *m)
1290*8975f5c5SAndroid Build Coastguard Worker {
1291*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1292*8975f5c5SAndroid Build Coastguard Worker     return true;
1293*8975f5c5SAndroid Build Coastguard Worker }
1294*8975f5c5SAndroid Build Coastguard Worker 
ValidateMultMatrixx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,const GLfixed * m)1295*8975f5c5SAndroid Build Coastguard Worker bool ValidateMultMatrixx(const PrivateState &state,
1296*8975f5c5SAndroid Build Coastguard Worker                          ErrorSet *errors,
1297*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
1298*8975f5c5SAndroid Build Coastguard Worker                          const GLfixed *m)
1299*8975f5c5SAndroid Build Coastguard Worker {
1300*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1301*8975f5c5SAndroid Build Coastguard Worker     return true;
1302*8975f5c5SAndroid Build Coastguard Worker }
1303*8975f5c5SAndroid Build Coastguard Worker 
ValidateMultiTexCoord4f(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum target,GLfloat s,GLfloat t,GLfloat r,GLfloat q)1304*8975f5c5SAndroid Build Coastguard Worker bool ValidateMultiTexCoord4f(const PrivateState &state,
1305*8975f5c5SAndroid Build Coastguard Worker                              ErrorSet *errors,
1306*8975f5c5SAndroid Build Coastguard Worker                              angle::EntryPoint entryPoint,
1307*8975f5c5SAndroid Build Coastguard Worker                              GLenum target,
1308*8975f5c5SAndroid Build Coastguard Worker                              GLfloat s,
1309*8975f5c5SAndroid Build Coastguard Worker                              GLfloat t,
1310*8975f5c5SAndroid Build Coastguard Worker                              GLfloat r,
1311*8975f5c5SAndroid Build Coastguard Worker                              GLfloat q)
1312*8975f5c5SAndroid Build Coastguard Worker {
1313*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1314*8975f5c5SAndroid Build Coastguard Worker     return ValidateMultitextureUnit(state, errors, entryPoint, target);
1315*8975f5c5SAndroid Build Coastguard Worker }
1316*8975f5c5SAndroid Build Coastguard Worker 
ValidateMultiTexCoord4x(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum target,GLfixed s,GLfixed t,GLfixed r,GLfixed q)1317*8975f5c5SAndroid Build Coastguard Worker bool ValidateMultiTexCoord4x(const PrivateState &state,
1318*8975f5c5SAndroid Build Coastguard Worker                              ErrorSet *errors,
1319*8975f5c5SAndroid Build Coastguard Worker                              angle::EntryPoint entryPoint,
1320*8975f5c5SAndroid Build Coastguard Worker                              GLenum target,
1321*8975f5c5SAndroid Build Coastguard Worker                              GLfixed s,
1322*8975f5c5SAndroid Build Coastguard Worker                              GLfixed t,
1323*8975f5c5SAndroid Build Coastguard Worker                              GLfixed r,
1324*8975f5c5SAndroid Build Coastguard Worker                              GLfixed q)
1325*8975f5c5SAndroid Build Coastguard Worker {
1326*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1327*8975f5c5SAndroid Build Coastguard Worker     return ValidateMultitextureUnit(state, errors, entryPoint, target);
1328*8975f5c5SAndroid Build Coastguard Worker }
1329*8975f5c5SAndroid Build Coastguard Worker 
ValidateNormal3f(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat nx,GLfloat ny,GLfloat nz)1330*8975f5c5SAndroid Build Coastguard Worker bool ValidateNormal3f(const PrivateState &state,
1331*8975f5c5SAndroid Build Coastguard Worker                       ErrorSet *errors,
1332*8975f5c5SAndroid Build Coastguard Worker                       angle::EntryPoint entryPoint,
1333*8975f5c5SAndroid Build Coastguard Worker                       GLfloat nx,
1334*8975f5c5SAndroid Build Coastguard Worker                       GLfloat ny,
1335*8975f5c5SAndroid Build Coastguard Worker                       GLfloat nz)
1336*8975f5c5SAndroid Build Coastguard Worker {
1337*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1338*8975f5c5SAndroid Build Coastguard Worker     return true;
1339*8975f5c5SAndroid Build Coastguard Worker }
1340*8975f5c5SAndroid Build Coastguard Worker 
ValidateNormal3x(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed nx,GLfixed ny,GLfixed nz)1341*8975f5c5SAndroid Build Coastguard Worker bool ValidateNormal3x(const PrivateState &state,
1342*8975f5c5SAndroid Build Coastguard Worker                       ErrorSet *errors,
1343*8975f5c5SAndroid Build Coastguard Worker                       angle::EntryPoint entryPoint,
1344*8975f5c5SAndroid Build Coastguard Worker                       GLfixed nx,
1345*8975f5c5SAndroid Build Coastguard Worker                       GLfixed ny,
1346*8975f5c5SAndroid Build Coastguard Worker                       GLfixed nz)
1347*8975f5c5SAndroid Build Coastguard Worker {
1348*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1349*8975f5c5SAndroid Build Coastguard Worker     return true;
1350*8975f5c5SAndroid Build Coastguard Worker }
1351*8975f5c5SAndroid Build Coastguard Worker 
ValidateNormalPointer(const Context * context,angle::EntryPoint entryPoint,VertexAttribType type,GLsizei stride,const void * pointer)1352*8975f5c5SAndroid Build Coastguard Worker bool ValidateNormalPointer(const Context *context,
1353*8975f5c5SAndroid Build Coastguard Worker                            angle::EntryPoint entryPoint,
1354*8975f5c5SAndroid Build Coastguard Worker                            VertexAttribType type,
1355*8975f5c5SAndroid Build Coastguard Worker                            GLsizei stride,
1356*8975f5c5SAndroid Build Coastguard Worker                            const void *pointer)
1357*8975f5c5SAndroid Build Coastguard Worker {
1358*8975f5c5SAndroid Build Coastguard Worker     return ValidateBuiltinVertexAttributeCommon(context, entryPoint, ClientVertexArrayType::Normal,
1359*8975f5c5SAndroid Build Coastguard Worker                                                 3, type, stride, pointer);
1360*8975f5c5SAndroid Build Coastguard Worker }
1361*8975f5c5SAndroid Build Coastguard Worker 
ValidateOrthof(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat l,GLfloat r,GLfloat b,GLfloat t,GLfloat n,GLfloat f)1362*8975f5c5SAndroid Build Coastguard Worker bool ValidateOrthof(const PrivateState &state,
1363*8975f5c5SAndroid Build Coastguard Worker                     ErrorSet *errors,
1364*8975f5c5SAndroid Build Coastguard Worker                     angle::EntryPoint entryPoint,
1365*8975f5c5SAndroid Build Coastguard Worker                     GLfloat l,
1366*8975f5c5SAndroid Build Coastguard Worker                     GLfloat r,
1367*8975f5c5SAndroid Build Coastguard Worker                     GLfloat b,
1368*8975f5c5SAndroid Build Coastguard Worker                     GLfloat t,
1369*8975f5c5SAndroid Build Coastguard Worker                     GLfloat n,
1370*8975f5c5SAndroid Build Coastguard Worker                     GLfloat f)
1371*8975f5c5SAndroid Build Coastguard Worker {
1372*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1373*8975f5c5SAndroid Build Coastguard Worker     // [OpenGL ES 1.1.12] section 2.10.2 page 31:
1374*8975f5c5SAndroid Build Coastguard Worker     // If l is equal to r, b is equal to t, or n is equal to f, the
1375*8975f5c5SAndroid Build Coastguard Worker     // error INVALID VALUE results.
1376*8975f5c5SAndroid Build Coastguard Worker     if (l == r || b == t || n == f)
1377*8975f5c5SAndroid Build Coastguard Worker     {
1378*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidProjectionMatrix);
1379*8975f5c5SAndroid Build Coastguard Worker         return false;
1380*8975f5c5SAndroid Build Coastguard Worker     }
1381*8975f5c5SAndroid Build Coastguard Worker     return true;
1382*8975f5c5SAndroid Build Coastguard Worker }
1383*8975f5c5SAndroid Build Coastguard Worker 
ValidateOrthox(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed l,GLfixed r,GLfixed b,GLfixed t,GLfixed n,GLfixed f)1384*8975f5c5SAndroid Build Coastguard Worker bool ValidateOrthox(const PrivateState &state,
1385*8975f5c5SAndroid Build Coastguard Worker                     ErrorSet *errors,
1386*8975f5c5SAndroid Build Coastguard Worker                     angle::EntryPoint entryPoint,
1387*8975f5c5SAndroid Build Coastguard Worker                     GLfixed l,
1388*8975f5c5SAndroid Build Coastguard Worker                     GLfixed r,
1389*8975f5c5SAndroid Build Coastguard Worker                     GLfixed b,
1390*8975f5c5SAndroid Build Coastguard Worker                     GLfixed t,
1391*8975f5c5SAndroid Build Coastguard Worker                     GLfixed n,
1392*8975f5c5SAndroid Build Coastguard Worker                     GLfixed f)
1393*8975f5c5SAndroid Build Coastguard Worker {
1394*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1395*8975f5c5SAndroid Build Coastguard Worker     if (l == r || b == t || n == f)
1396*8975f5c5SAndroid Build Coastguard Worker     {
1397*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidProjectionMatrix);
1398*8975f5c5SAndroid Build Coastguard Worker         return false;
1399*8975f5c5SAndroid Build Coastguard Worker     }
1400*8975f5c5SAndroid Build Coastguard Worker     return true;
1401*8975f5c5SAndroid Build Coastguard Worker }
1402*8975f5c5SAndroid Build Coastguard Worker 
ValidatePointParameterf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,PointParameter pname,GLfloat param)1403*8975f5c5SAndroid Build Coastguard Worker bool ValidatePointParameterf(const PrivateState &state,
1404*8975f5c5SAndroid Build Coastguard Worker                              ErrorSet *errors,
1405*8975f5c5SAndroid Build Coastguard Worker                              angle::EntryPoint entryPoint,
1406*8975f5c5SAndroid Build Coastguard Worker                              PointParameter pname,
1407*8975f5c5SAndroid Build Coastguard Worker                              GLfloat param)
1408*8975f5c5SAndroid Build Coastguard Worker {
1409*8975f5c5SAndroid Build Coastguard Worker     unsigned int paramCount = GetPointParameterCount(pname);
1410*8975f5c5SAndroid Build Coastguard Worker     if (paramCount != 1)
1411*8975f5c5SAndroid Build Coastguard Worker     {
1412*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidPointParameter);
1413*8975f5c5SAndroid Build Coastguard Worker         return false;
1414*8975f5c5SAndroid Build Coastguard Worker     }
1415*8975f5c5SAndroid Build Coastguard Worker 
1416*8975f5c5SAndroid Build Coastguard Worker     return ValidatePointParameterCommon(state, errors, entryPoint, pname, &param);
1417*8975f5c5SAndroid Build Coastguard Worker }
1418*8975f5c5SAndroid Build Coastguard Worker 
ValidatePointParameterfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,PointParameter pname,const GLfloat * params)1419*8975f5c5SAndroid Build Coastguard Worker bool ValidatePointParameterfv(const PrivateState &state,
1420*8975f5c5SAndroid Build Coastguard Worker                               ErrorSet *errors,
1421*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
1422*8975f5c5SAndroid Build Coastguard Worker                               PointParameter pname,
1423*8975f5c5SAndroid Build Coastguard Worker                               const GLfloat *params)
1424*8975f5c5SAndroid Build Coastguard Worker {
1425*8975f5c5SAndroid Build Coastguard Worker     return ValidatePointParameterCommon(state, errors, entryPoint, pname, params);
1426*8975f5c5SAndroid Build Coastguard Worker }
1427*8975f5c5SAndroid Build Coastguard Worker 
ValidatePointParameterx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,PointParameter pname,GLfixed param)1428*8975f5c5SAndroid Build Coastguard Worker bool ValidatePointParameterx(const PrivateState &state,
1429*8975f5c5SAndroid Build Coastguard Worker                              ErrorSet *errors,
1430*8975f5c5SAndroid Build Coastguard Worker                              angle::EntryPoint entryPoint,
1431*8975f5c5SAndroid Build Coastguard Worker                              PointParameter pname,
1432*8975f5c5SAndroid Build Coastguard Worker                              GLfixed param)
1433*8975f5c5SAndroid Build Coastguard Worker {
1434*8975f5c5SAndroid Build Coastguard Worker     unsigned int paramCount = GetPointParameterCount(pname);
1435*8975f5c5SAndroid Build Coastguard Worker     if (paramCount != 1)
1436*8975f5c5SAndroid Build Coastguard Worker     {
1437*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidPointParameter);
1438*8975f5c5SAndroid Build Coastguard Worker         return false;
1439*8975f5c5SAndroid Build Coastguard Worker     }
1440*8975f5c5SAndroid Build Coastguard Worker 
1441*8975f5c5SAndroid Build Coastguard Worker     GLfloat paramf = ConvertFixedToFloat(param);
1442*8975f5c5SAndroid Build Coastguard Worker     return ValidatePointParameterCommon(state, errors, entryPoint, pname, &paramf);
1443*8975f5c5SAndroid Build Coastguard Worker }
1444*8975f5c5SAndroid Build Coastguard Worker 
ValidatePointParameterxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,PointParameter pname,const GLfixed * params)1445*8975f5c5SAndroid Build Coastguard Worker bool ValidatePointParameterxv(const PrivateState &state,
1446*8975f5c5SAndroid Build Coastguard Worker                               ErrorSet *errors,
1447*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
1448*8975f5c5SAndroid Build Coastguard Worker                               PointParameter pname,
1449*8975f5c5SAndroid Build Coastguard Worker                               const GLfixed *params)
1450*8975f5c5SAndroid Build Coastguard Worker {
1451*8975f5c5SAndroid Build Coastguard Worker     GLfloat paramsf[4] = {};
1452*8975f5c5SAndroid Build Coastguard Worker     for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
1453*8975f5c5SAndroid Build Coastguard Worker     {
1454*8975f5c5SAndroid Build Coastguard Worker         paramsf[i] = ConvertFixedToFloat(params[i]);
1455*8975f5c5SAndroid Build Coastguard Worker     }
1456*8975f5c5SAndroid Build Coastguard Worker     return ValidatePointParameterCommon(state, errors, entryPoint, pname, paramsf);
1457*8975f5c5SAndroid Build Coastguard Worker }
1458*8975f5c5SAndroid Build Coastguard Worker 
ValidatePointSize(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat size)1459*8975f5c5SAndroid Build Coastguard Worker bool ValidatePointSize(const PrivateState &state,
1460*8975f5c5SAndroid Build Coastguard Worker                        ErrorSet *errors,
1461*8975f5c5SAndroid Build Coastguard Worker                        angle::EntryPoint entryPoint,
1462*8975f5c5SAndroid Build Coastguard Worker                        GLfloat size)
1463*8975f5c5SAndroid Build Coastguard Worker {
1464*8975f5c5SAndroid Build Coastguard Worker     return ValidatePointSizeCommon(state, errors, entryPoint, size);
1465*8975f5c5SAndroid Build Coastguard Worker }
1466*8975f5c5SAndroid Build Coastguard Worker 
ValidatePointSizex(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed size)1467*8975f5c5SAndroid Build Coastguard Worker bool ValidatePointSizex(const PrivateState &state,
1468*8975f5c5SAndroid Build Coastguard Worker                         ErrorSet *errors,
1469*8975f5c5SAndroid Build Coastguard Worker                         angle::EntryPoint entryPoint,
1470*8975f5c5SAndroid Build Coastguard Worker                         GLfixed size)
1471*8975f5c5SAndroid Build Coastguard Worker {
1472*8975f5c5SAndroid Build Coastguard Worker     return ValidatePointSizeCommon(state, errors, entryPoint, ConvertFixedToFloat(size));
1473*8975f5c5SAndroid Build Coastguard Worker }
1474*8975f5c5SAndroid Build Coastguard Worker 
ValidatePolygonOffsetx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed factor,GLfixed units)1475*8975f5c5SAndroid Build Coastguard Worker bool ValidatePolygonOffsetx(const PrivateState &state,
1476*8975f5c5SAndroid Build Coastguard Worker                             ErrorSet *errors,
1477*8975f5c5SAndroid Build Coastguard Worker                             angle::EntryPoint entryPoint,
1478*8975f5c5SAndroid Build Coastguard Worker                             GLfixed factor,
1479*8975f5c5SAndroid Build Coastguard Worker                             GLfixed units)
1480*8975f5c5SAndroid Build Coastguard Worker {
1481*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1482*8975f5c5SAndroid Build Coastguard Worker     return true;
1483*8975f5c5SAndroid Build Coastguard Worker }
1484*8975f5c5SAndroid Build Coastguard Worker 
ValidatePopMatrix(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint)1485*8975f5c5SAndroid Build Coastguard Worker bool ValidatePopMatrix(const PrivateState &state, ErrorSet *errors, angle::EntryPoint entryPoint)
1486*8975f5c5SAndroid Build Coastguard Worker {
1487*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1488*8975f5c5SAndroid Build Coastguard Worker     const auto &stack = state.gles1().currentMatrixStack();
1489*8975f5c5SAndroid Build Coastguard Worker     if (stack.size() == 1)
1490*8975f5c5SAndroid Build Coastguard Worker     {
1491*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_STACK_UNDERFLOW, kMatrixStackUnderflow);
1492*8975f5c5SAndroid Build Coastguard Worker         return false;
1493*8975f5c5SAndroid Build Coastguard Worker     }
1494*8975f5c5SAndroid Build Coastguard Worker     return true;
1495*8975f5c5SAndroid Build Coastguard Worker }
1496*8975f5c5SAndroid Build Coastguard Worker 
ValidatePushMatrix(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint)1497*8975f5c5SAndroid Build Coastguard Worker bool ValidatePushMatrix(const PrivateState &state, ErrorSet *errors, angle::EntryPoint entryPoint)
1498*8975f5c5SAndroid Build Coastguard Worker {
1499*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1500*8975f5c5SAndroid Build Coastguard Worker     const auto &stack = state.gles1().currentMatrixStack();
1501*8975f5c5SAndroid Build Coastguard Worker     if (stack.size() == stack.max_size())
1502*8975f5c5SAndroid Build Coastguard Worker     {
1503*8975f5c5SAndroid Build Coastguard Worker         errors->validationError(entryPoint, GL_STACK_OVERFLOW, kMatrixStackOverflow);
1504*8975f5c5SAndroid Build Coastguard Worker         return false;
1505*8975f5c5SAndroid Build Coastguard Worker     }
1506*8975f5c5SAndroid Build Coastguard Worker     return true;
1507*8975f5c5SAndroid Build Coastguard Worker }
1508*8975f5c5SAndroid Build Coastguard Worker 
ValidateRotatef(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat angle,GLfloat x,GLfloat y,GLfloat z)1509*8975f5c5SAndroid Build Coastguard Worker bool ValidateRotatef(const PrivateState &state,
1510*8975f5c5SAndroid Build Coastguard Worker                      ErrorSet *errors,
1511*8975f5c5SAndroid Build Coastguard Worker                      angle::EntryPoint entryPoint,
1512*8975f5c5SAndroid Build Coastguard Worker                      GLfloat angle,
1513*8975f5c5SAndroid Build Coastguard Worker                      GLfloat x,
1514*8975f5c5SAndroid Build Coastguard Worker                      GLfloat y,
1515*8975f5c5SAndroid Build Coastguard Worker                      GLfloat z)
1516*8975f5c5SAndroid Build Coastguard Worker {
1517*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1518*8975f5c5SAndroid Build Coastguard Worker     return true;
1519*8975f5c5SAndroid Build Coastguard Worker }
1520*8975f5c5SAndroid Build Coastguard Worker 
ValidateRotatex(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed angle,GLfixed x,GLfixed y,GLfixed z)1521*8975f5c5SAndroid Build Coastguard Worker bool ValidateRotatex(const PrivateState &state,
1522*8975f5c5SAndroid Build Coastguard Worker                      ErrorSet *errors,
1523*8975f5c5SAndroid Build Coastguard Worker                      angle::EntryPoint entryPoint,
1524*8975f5c5SAndroid Build Coastguard Worker                      GLfixed angle,
1525*8975f5c5SAndroid Build Coastguard Worker                      GLfixed x,
1526*8975f5c5SAndroid Build Coastguard Worker                      GLfixed y,
1527*8975f5c5SAndroid Build Coastguard Worker                      GLfixed z)
1528*8975f5c5SAndroid Build Coastguard Worker {
1529*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1530*8975f5c5SAndroid Build Coastguard Worker     return true;
1531*8975f5c5SAndroid Build Coastguard Worker }
1532*8975f5c5SAndroid Build Coastguard Worker 
ValidateSampleCoveragex(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLclampx value,GLboolean invert)1533*8975f5c5SAndroid Build Coastguard Worker bool ValidateSampleCoveragex(const PrivateState &state,
1534*8975f5c5SAndroid Build Coastguard Worker                              ErrorSet *errors,
1535*8975f5c5SAndroid Build Coastguard Worker                              angle::EntryPoint entryPoint,
1536*8975f5c5SAndroid Build Coastguard Worker                              GLclampx value,
1537*8975f5c5SAndroid Build Coastguard Worker                              GLboolean invert)
1538*8975f5c5SAndroid Build Coastguard Worker {
1539*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1540*8975f5c5SAndroid Build Coastguard Worker     return true;
1541*8975f5c5SAndroid Build Coastguard Worker }
1542*8975f5c5SAndroid Build Coastguard Worker 
ValidateScalef(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat x,GLfloat y,GLfloat z)1543*8975f5c5SAndroid Build Coastguard Worker bool ValidateScalef(const PrivateState &state,
1544*8975f5c5SAndroid Build Coastguard Worker                     ErrorSet *errors,
1545*8975f5c5SAndroid Build Coastguard Worker                     angle::EntryPoint entryPoint,
1546*8975f5c5SAndroid Build Coastguard Worker                     GLfloat x,
1547*8975f5c5SAndroid Build Coastguard Worker                     GLfloat y,
1548*8975f5c5SAndroid Build Coastguard Worker                     GLfloat z)
1549*8975f5c5SAndroid Build Coastguard Worker {
1550*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1551*8975f5c5SAndroid Build Coastguard Worker     return true;
1552*8975f5c5SAndroid Build Coastguard Worker }
1553*8975f5c5SAndroid Build Coastguard Worker 
ValidateScalex(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed x,GLfixed y,GLfixed z)1554*8975f5c5SAndroid Build Coastguard Worker bool ValidateScalex(const PrivateState &state,
1555*8975f5c5SAndroid Build Coastguard Worker                     ErrorSet *errors,
1556*8975f5c5SAndroid Build Coastguard Worker                     angle::EntryPoint entryPoint,
1557*8975f5c5SAndroid Build Coastguard Worker                     GLfixed x,
1558*8975f5c5SAndroid Build Coastguard Worker                     GLfixed y,
1559*8975f5c5SAndroid Build Coastguard Worker                     GLfixed z)
1560*8975f5c5SAndroid Build Coastguard Worker {
1561*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1562*8975f5c5SAndroid Build Coastguard Worker     return true;
1563*8975f5c5SAndroid Build Coastguard Worker }
1564*8975f5c5SAndroid Build Coastguard Worker 
ValidateShadeModel(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,ShadingModel mode)1565*8975f5c5SAndroid Build Coastguard Worker bool ValidateShadeModel(const PrivateState &state,
1566*8975f5c5SAndroid Build Coastguard Worker                         ErrorSet *errors,
1567*8975f5c5SAndroid Build Coastguard Worker                         angle::EntryPoint entryPoint,
1568*8975f5c5SAndroid Build Coastguard Worker                         ShadingModel mode)
1569*8975f5c5SAndroid Build Coastguard Worker {
1570*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1571*8975f5c5SAndroid Build Coastguard Worker     switch (mode)
1572*8975f5c5SAndroid Build Coastguard Worker     {
1573*8975f5c5SAndroid Build Coastguard Worker         case ShadingModel::Flat:
1574*8975f5c5SAndroid Build Coastguard Worker         case ShadingModel::Smooth:
1575*8975f5c5SAndroid Build Coastguard Worker             return true;
1576*8975f5c5SAndroid Build Coastguard Worker         default:
1577*8975f5c5SAndroid Build Coastguard Worker             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidShadingModel);
1578*8975f5c5SAndroid Build Coastguard Worker             return false;
1579*8975f5c5SAndroid Build Coastguard Worker     }
1580*8975f5c5SAndroid Build Coastguard Worker }
1581*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexCoordPointer(const Context * context,angle::EntryPoint entryPoint,GLint size,VertexAttribType type,GLsizei stride,const void * pointer)1582*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexCoordPointer(const Context *context,
1583*8975f5c5SAndroid Build Coastguard Worker                              angle::EntryPoint entryPoint,
1584*8975f5c5SAndroid Build Coastguard Worker                              GLint size,
1585*8975f5c5SAndroid Build Coastguard Worker                              VertexAttribType type,
1586*8975f5c5SAndroid Build Coastguard Worker                              GLsizei stride,
1587*8975f5c5SAndroid Build Coastguard Worker                              const void *pointer)
1588*8975f5c5SAndroid Build Coastguard Worker {
1589*8975f5c5SAndroid Build Coastguard Worker     return ValidateBuiltinVertexAttributeCommon(
1590*8975f5c5SAndroid Build Coastguard Worker         context, entryPoint, ClientVertexArrayType::TextureCoord, size, type, stride, pointer);
1591*8975f5c5SAndroid Build Coastguard Worker }
1592*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexEnvf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,GLfloat param)1593*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexEnvf(const PrivateState &state,
1594*8975f5c5SAndroid Build Coastguard Worker                      ErrorSet *errors,
1595*8975f5c5SAndroid Build Coastguard Worker                      angle::EntryPoint entryPoint,
1596*8975f5c5SAndroid Build Coastguard Worker                      TextureEnvTarget target,
1597*8975f5c5SAndroid Build Coastguard Worker                      TextureEnvParameter pname,
1598*8975f5c5SAndroid Build Coastguard Worker                      GLfloat param)
1599*8975f5c5SAndroid Build Coastguard Worker {
1600*8975f5c5SAndroid Build Coastguard Worker     return ValidateTexEnvCommon(state, errors, entryPoint, target, pname, &param);
1601*8975f5c5SAndroid Build Coastguard Worker }
1602*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexEnvfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,const GLfloat * params)1603*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexEnvfv(const PrivateState &state,
1604*8975f5c5SAndroid Build Coastguard Worker                       ErrorSet *errors,
1605*8975f5c5SAndroid Build Coastguard Worker                       angle::EntryPoint entryPoint,
1606*8975f5c5SAndroid Build Coastguard Worker                       TextureEnvTarget target,
1607*8975f5c5SAndroid Build Coastguard Worker                       TextureEnvParameter pname,
1608*8975f5c5SAndroid Build Coastguard Worker                       const GLfloat *params)
1609*8975f5c5SAndroid Build Coastguard Worker {
1610*8975f5c5SAndroid Build Coastguard Worker     return ValidateTexEnvCommon(state, errors, entryPoint, target, pname, params);
1611*8975f5c5SAndroid Build Coastguard Worker }
1612*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexEnvi(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,GLint param)1613*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexEnvi(const PrivateState &state,
1614*8975f5c5SAndroid Build Coastguard Worker                      ErrorSet *errors,
1615*8975f5c5SAndroid Build Coastguard Worker                      angle::EntryPoint entryPoint,
1616*8975f5c5SAndroid Build Coastguard Worker                      TextureEnvTarget target,
1617*8975f5c5SAndroid Build Coastguard Worker                      TextureEnvParameter pname,
1618*8975f5c5SAndroid Build Coastguard Worker                      GLint param)
1619*8975f5c5SAndroid Build Coastguard Worker {
1620*8975f5c5SAndroid Build Coastguard Worker     GLfloat paramf = static_cast<GLfloat>(param);
1621*8975f5c5SAndroid Build Coastguard Worker     return ValidateTexEnvCommon(state, errors, entryPoint, target, pname, &paramf);
1622*8975f5c5SAndroid Build Coastguard Worker }
1623*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexEnviv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,const GLint * params)1624*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexEnviv(const PrivateState &state,
1625*8975f5c5SAndroid Build Coastguard Worker                       ErrorSet *errors,
1626*8975f5c5SAndroid Build Coastguard Worker                       angle::EntryPoint entryPoint,
1627*8975f5c5SAndroid Build Coastguard Worker                       TextureEnvTarget target,
1628*8975f5c5SAndroid Build Coastguard Worker                       TextureEnvParameter pname,
1629*8975f5c5SAndroid Build Coastguard Worker                       const GLint *params)
1630*8975f5c5SAndroid Build Coastguard Worker {
1631*8975f5c5SAndroid Build Coastguard Worker     GLfloat paramsf[4];
1632*8975f5c5SAndroid Build Coastguard Worker     for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
1633*8975f5c5SAndroid Build Coastguard Worker     {
1634*8975f5c5SAndroid Build Coastguard Worker         paramsf[i] = static_cast<GLfloat>(params[i]);
1635*8975f5c5SAndroid Build Coastguard Worker     }
1636*8975f5c5SAndroid Build Coastguard Worker     return ValidateTexEnvCommon(state, errors, entryPoint, target, pname, paramsf);
1637*8975f5c5SAndroid Build Coastguard Worker }
1638*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexEnvx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,GLfixed param)1639*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexEnvx(const PrivateState &state,
1640*8975f5c5SAndroid Build Coastguard Worker                      ErrorSet *errors,
1641*8975f5c5SAndroid Build Coastguard Worker                      angle::EntryPoint entryPoint,
1642*8975f5c5SAndroid Build Coastguard Worker                      TextureEnvTarget target,
1643*8975f5c5SAndroid Build Coastguard Worker                      TextureEnvParameter pname,
1644*8975f5c5SAndroid Build Coastguard Worker                      GLfixed param)
1645*8975f5c5SAndroid Build Coastguard Worker {
1646*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1647*8975f5c5SAndroid Build Coastguard Worker     GLfloat paramsf[4] = {};
1648*8975f5c5SAndroid Build Coastguard Worker     ConvertTextureEnvFromFixed(pname, &param, paramsf);
1649*8975f5c5SAndroid Build Coastguard Worker     return ValidateTexEnvCommon(state, errors, entryPoint, target, pname, paramsf);
1650*8975f5c5SAndroid Build Coastguard Worker }
1651*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexEnvxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,const GLfixed * params)1652*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexEnvxv(const PrivateState &state,
1653*8975f5c5SAndroid Build Coastguard Worker                       ErrorSet *errors,
1654*8975f5c5SAndroid Build Coastguard Worker                       angle::EntryPoint entryPoint,
1655*8975f5c5SAndroid Build Coastguard Worker                       TextureEnvTarget target,
1656*8975f5c5SAndroid Build Coastguard Worker                       TextureEnvParameter pname,
1657*8975f5c5SAndroid Build Coastguard Worker                       const GLfixed *params)
1658*8975f5c5SAndroid Build Coastguard Worker {
1659*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1660*8975f5c5SAndroid Build Coastguard Worker     GLfloat paramsf[4] = {};
1661*8975f5c5SAndroid Build Coastguard Worker     ConvertTextureEnvFromFixed(pname, params, paramsf);
1662*8975f5c5SAndroid Build Coastguard Worker     return ValidateTexEnvCommon(state, errors, entryPoint, target, pname, paramsf);
1663*8975f5c5SAndroid Build Coastguard Worker }
1664*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexParameterBaseForGLfixed(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLenum pname,GLsizei bufSize,bool vectorParams,const GLfixed * params)1665*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexParameterBaseForGLfixed(const Context *context,
1666*8975f5c5SAndroid Build Coastguard Worker                                         angle::EntryPoint entryPoint,
1667*8975f5c5SAndroid Build Coastguard Worker                                         TextureType target,
1668*8975f5c5SAndroid Build Coastguard Worker                                         GLenum pname,
1669*8975f5c5SAndroid Build Coastguard Worker                                         GLsizei bufSize,
1670*8975f5c5SAndroid Build Coastguard Worker                                         bool vectorParams,
1671*8975f5c5SAndroid Build Coastguard Worker                                         const GLfixed *params)
1672*8975f5c5SAndroid Build Coastguard Worker {
1673*8975f5c5SAndroid Build Coastguard Worker     // Convert GLfixed parameter for GL_TEXTURE_MAX_ANISOTROPY_EXT independently
1674*8975f5c5SAndroid Build Coastguard Worker     // since it compares against 1 and maxTextureAnisotropy instead of just 0
1675*8975f5c5SAndroid Build Coastguard Worker     // (other values are fine to leave unconverted since they only check positive or negative or
1676*8975f5c5SAndroid Build Coastguard Worker     // are used as enums)
1677*8975f5c5SAndroid Build Coastguard Worker     GLfloat paramValue;
1678*8975f5c5SAndroid Build Coastguard Worker     if (pname == GL_TEXTURE_MAX_ANISOTROPY_EXT)
1679*8975f5c5SAndroid Build Coastguard Worker     {
1680*8975f5c5SAndroid Build Coastguard Worker         paramValue = ConvertFixedToFloat(static_cast<GLfixed>(params[0]));
1681*8975f5c5SAndroid Build Coastguard Worker     }
1682*8975f5c5SAndroid Build Coastguard Worker     else
1683*8975f5c5SAndroid Build Coastguard Worker     {
1684*8975f5c5SAndroid Build Coastguard Worker         paramValue = static_cast<GLfloat>(params[0]);
1685*8975f5c5SAndroid Build Coastguard Worker     }
1686*8975f5c5SAndroid Build Coastguard Worker     return ValidateTexParameterBase(context, entryPoint, target, pname, bufSize, vectorParams,
1687*8975f5c5SAndroid Build Coastguard Worker                                     &paramValue);
1688*8975f5c5SAndroid Build Coastguard Worker }
1689*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexParameterx(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLenum pname,GLfixed param)1690*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexParameterx(const Context *context,
1691*8975f5c5SAndroid Build Coastguard Worker                            angle::EntryPoint entryPoint,
1692*8975f5c5SAndroid Build Coastguard Worker                            TextureType target,
1693*8975f5c5SAndroid Build Coastguard Worker                            GLenum pname,
1694*8975f5c5SAndroid Build Coastguard Worker                            GLfixed param)
1695*8975f5c5SAndroid Build Coastguard Worker {
1696*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint);
1697*8975f5c5SAndroid Build Coastguard Worker     return ValidateTexParameterBaseForGLfixed(context, entryPoint, target, pname, -1, false,
1698*8975f5c5SAndroid Build Coastguard Worker                                               &param);
1699*8975f5c5SAndroid Build Coastguard Worker }
1700*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexParameterxv(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLenum pname,const GLfixed * params)1701*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexParameterxv(const Context *context,
1702*8975f5c5SAndroid Build Coastguard Worker                             angle::EntryPoint entryPoint,
1703*8975f5c5SAndroid Build Coastguard Worker                             TextureType target,
1704*8975f5c5SAndroid Build Coastguard Worker                             GLenum pname,
1705*8975f5c5SAndroid Build Coastguard Worker                             const GLfixed *params)
1706*8975f5c5SAndroid Build Coastguard Worker {
1707*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint);
1708*8975f5c5SAndroid Build Coastguard Worker     return ValidateTexParameterBaseForGLfixed(context, entryPoint, target, pname, -1, true, params);
1709*8975f5c5SAndroid Build Coastguard Worker }
1710*8975f5c5SAndroid Build Coastguard Worker 
ValidateTranslatef(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat x,GLfloat y,GLfloat z)1711*8975f5c5SAndroid Build Coastguard Worker bool ValidateTranslatef(const PrivateState &state,
1712*8975f5c5SAndroid Build Coastguard Worker                         ErrorSet *errors,
1713*8975f5c5SAndroid Build Coastguard Worker                         angle::EntryPoint entryPoint,
1714*8975f5c5SAndroid Build Coastguard Worker                         GLfloat x,
1715*8975f5c5SAndroid Build Coastguard Worker                         GLfloat y,
1716*8975f5c5SAndroid Build Coastguard Worker                         GLfloat z)
1717*8975f5c5SAndroid Build Coastguard Worker {
1718*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1719*8975f5c5SAndroid Build Coastguard Worker     return true;
1720*8975f5c5SAndroid Build Coastguard Worker }
1721*8975f5c5SAndroid Build Coastguard Worker 
ValidateTranslatex(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed x,GLfixed y,GLfixed z)1722*8975f5c5SAndroid Build Coastguard Worker bool ValidateTranslatex(const PrivateState &state,
1723*8975f5c5SAndroid Build Coastguard Worker                         ErrorSet *errors,
1724*8975f5c5SAndroid Build Coastguard Worker                         angle::EntryPoint entryPoint,
1725*8975f5c5SAndroid Build Coastguard Worker                         GLfixed x,
1726*8975f5c5SAndroid Build Coastguard Worker                         GLfixed y,
1727*8975f5c5SAndroid Build Coastguard Worker                         GLfixed z)
1728*8975f5c5SAndroid Build Coastguard Worker {
1729*8975f5c5SAndroid Build Coastguard Worker     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1730*8975f5c5SAndroid Build Coastguard Worker     return true;
1731*8975f5c5SAndroid Build Coastguard Worker }
1732*8975f5c5SAndroid Build Coastguard Worker 
ValidateVertexPointer(const Context * context,angle::EntryPoint entryPoint,GLint size,VertexAttribType type,GLsizei stride,const void * pointer)1733*8975f5c5SAndroid Build Coastguard Worker bool ValidateVertexPointer(const Context *context,
1734*8975f5c5SAndroid Build Coastguard Worker                            angle::EntryPoint entryPoint,
1735*8975f5c5SAndroid Build Coastguard Worker                            GLint size,
1736*8975f5c5SAndroid Build Coastguard Worker                            VertexAttribType type,
1737*8975f5c5SAndroid Build Coastguard Worker                            GLsizei stride,
1738*8975f5c5SAndroid Build Coastguard Worker                            const void *pointer)
1739*8975f5c5SAndroid Build Coastguard Worker {
1740*8975f5c5SAndroid Build Coastguard Worker     return ValidateBuiltinVertexAttributeCommon(context, entryPoint, ClientVertexArrayType::Vertex,
1741*8975f5c5SAndroid Build Coastguard Worker                                                 size, type, stride, pointer);
1742*8975f5c5SAndroid Build Coastguard Worker }
1743*8975f5c5SAndroid Build Coastguard Worker 
ValidateDrawTexfOES(const Context * context,angle::EntryPoint entryPoint,GLfloat x,GLfloat y,GLfloat z,GLfloat width,GLfloat height)1744*8975f5c5SAndroid Build Coastguard Worker bool ValidateDrawTexfOES(const Context *context,
1745*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
1746*8975f5c5SAndroid Build Coastguard Worker                          GLfloat x,
1747*8975f5c5SAndroid Build Coastguard Worker                          GLfloat y,
1748*8975f5c5SAndroid Build Coastguard Worker                          GLfloat z,
1749*8975f5c5SAndroid Build Coastguard Worker                          GLfloat width,
1750*8975f5c5SAndroid Build Coastguard Worker                          GLfloat height)
1751*8975f5c5SAndroid Build Coastguard Worker {
1752*8975f5c5SAndroid Build Coastguard Worker     return ValidateDrawTexCommon(context, entryPoint, width, height);
1753*8975f5c5SAndroid Build Coastguard Worker }
1754*8975f5c5SAndroid Build Coastguard Worker 
ValidateDrawTexfvOES(const Context * context,angle::EntryPoint entryPoint,const GLfloat * coords)1755*8975f5c5SAndroid Build Coastguard Worker bool ValidateDrawTexfvOES(const Context *context,
1756*8975f5c5SAndroid Build Coastguard Worker                           angle::EntryPoint entryPoint,
1757*8975f5c5SAndroid Build Coastguard Worker                           const GLfloat *coords)
1758*8975f5c5SAndroid Build Coastguard Worker {
1759*8975f5c5SAndroid Build Coastguard Worker     return ValidateDrawTexCommon(context, entryPoint, coords[3], coords[4]);
1760*8975f5c5SAndroid Build Coastguard Worker }
1761*8975f5c5SAndroid Build Coastguard Worker 
ValidateDrawTexiOES(const Context * context,angle::EntryPoint entryPoint,GLint x,GLint y,GLint z,GLint width,GLint height)1762*8975f5c5SAndroid Build Coastguard Worker bool ValidateDrawTexiOES(const Context *context,
1763*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
1764*8975f5c5SAndroid Build Coastguard Worker                          GLint x,
1765*8975f5c5SAndroid Build Coastguard Worker                          GLint y,
1766*8975f5c5SAndroid Build Coastguard Worker                          GLint z,
1767*8975f5c5SAndroid Build Coastguard Worker                          GLint width,
1768*8975f5c5SAndroid Build Coastguard Worker                          GLint height)
1769*8975f5c5SAndroid Build Coastguard Worker {
1770*8975f5c5SAndroid Build Coastguard Worker     return ValidateDrawTexCommon(context, entryPoint, static_cast<GLfloat>(width),
1771*8975f5c5SAndroid Build Coastguard Worker                                  static_cast<GLfloat>(height));
1772*8975f5c5SAndroid Build Coastguard Worker }
1773*8975f5c5SAndroid Build Coastguard Worker 
ValidateDrawTexivOES(const Context * context,angle::EntryPoint entryPoint,const GLint * coords)1774*8975f5c5SAndroid Build Coastguard Worker bool ValidateDrawTexivOES(const Context *context, angle::EntryPoint entryPoint, const GLint *coords)
1775*8975f5c5SAndroid Build Coastguard Worker {
1776*8975f5c5SAndroid Build Coastguard Worker     return ValidateDrawTexCommon(context, entryPoint, static_cast<GLfloat>(coords[3]),
1777*8975f5c5SAndroid Build Coastguard Worker                                  static_cast<GLfloat>(coords[4]));
1778*8975f5c5SAndroid Build Coastguard Worker }
1779*8975f5c5SAndroid Build Coastguard Worker 
ValidateDrawTexsOES(const Context * context,angle::EntryPoint entryPoint,GLshort x,GLshort y,GLshort z,GLshort width,GLshort height)1780*8975f5c5SAndroid Build Coastguard Worker bool ValidateDrawTexsOES(const Context *context,
1781*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
1782*8975f5c5SAndroid Build Coastguard Worker                          GLshort x,
1783*8975f5c5SAndroid Build Coastguard Worker                          GLshort y,
1784*8975f5c5SAndroid Build Coastguard Worker                          GLshort z,
1785*8975f5c5SAndroid Build Coastguard Worker                          GLshort width,
1786*8975f5c5SAndroid Build Coastguard Worker                          GLshort height)
1787*8975f5c5SAndroid Build Coastguard Worker {
1788*8975f5c5SAndroid Build Coastguard Worker     return ValidateDrawTexCommon(context, entryPoint, static_cast<GLfloat>(width),
1789*8975f5c5SAndroid Build Coastguard Worker                                  static_cast<GLfloat>(height));
1790*8975f5c5SAndroid Build Coastguard Worker }
1791*8975f5c5SAndroid Build Coastguard Worker 
ValidateDrawTexsvOES(const Context * context,angle::EntryPoint entryPoint,const GLshort * coords)1792*8975f5c5SAndroid Build Coastguard Worker bool ValidateDrawTexsvOES(const Context *context,
1793*8975f5c5SAndroid Build Coastguard Worker                           angle::EntryPoint entryPoint,
1794*8975f5c5SAndroid Build Coastguard Worker                           const GLshort *coords)
1795*8975f5c5SAndroid Build Coastguard Worker {
1796*8975f5c5SAndroid Build Coastguard Worker     return ValidateDrawTexCommon(context, entryPoint, static_cast<GLfloat>(coords[3]),
1797*8975f5c5SAndroid Build Coastguard Worker                                  static_cast<GLfloat>(coords[4]));
1798*8975f5c5SAndroid Build Coastguard Worker }
1799*8975f5c5SAndroid Build Coastguard Worker 
ValidateDrawTexxOES(const Context * context,angle::EntryPoint entryPoint,GLfixed x,GLfixed y,GLfixed z,GLfixed width,GLfixed height)1800*8975f5c5SAndroid Build Coastguard Worker bool ValidateDrawTexxOES(const Context *context,
1801*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
1802*8975f5c5SAndroid Build Coastguard Worker                          GLfixed x,
1803*8975f5c5SAndroid Build Coastguard Worker                          GLfixed y,
1804*8975f5c5SAndroid Build Coastguard Worker                          GLfixed z,
1805*8975f5c5SAndroid Build Coastguard Worker                          GLfixed width,
1806*8975f5c5SAndroid Build Coastguard Worker                          GLfixed height)
1807*8975f5c5SAndroid Build Coastguard Worker {
1808*8975f5c5SAndroid Build Coastguard Worker     return ValidateDrawTexCommon(context, entryPoint, ConvertFixedToFloat(width),
1809*8975f5c5SAndroid Build Coastguard Worker                                  ConvertFixedToFloat(height));
1810*8975f5c5SAndroid Build Coastguard Worker }
1811*8975f5c5SAndroid Build Coastguard Worker 
ValidateDrawTexxvOES(const Context * context,angle::EntryPoint entryPoint,const GLfixed * coords)1812*8975f5c5SAndroid Build Coastguard Worker bool ValidateDrawTexxvOES(const Context *context,
1813*8975f5c5SAndroid Build Coastguard Worker                           angle::EntryPoint entryPoint,
1814*8975f5c5SAndroid Build Coastguard Worker                           const GLfixed *coords)
1815*8975f5c5SAndroid Build Coastguard Worker {
1816*8975f5c5SAndroid Build Coastguard Worker     return ValidateDrawTexCommon(context, entryPoint, ConvertFixedToFloat(coords[3]),
1817*8975f5c5SAndroid Build Coastguard Worker                                  ConvertFixedToFloat(coords[4]));
1818*8975f5c5SAndroid Build Coastguard Worker }
1819*8975f5c5SAndroid Build Coastguard Worker 
ValidateCurrentPaletteMatrixOES(const Context * context,angle::EntryPoint entryPoint,GLuint matrixpaletteindex)1820*8975f5c5SAndroid Build Coastguard Worker bool ValidateCurrentPaletteMatrixOES(const Context *context,
1821*8975f5c5SAndroid Build Coastguard Worker                                      angle::EntryPoint entryPoint,
1822*8975f5c5SAndroid Build Coastguard Worker                                      GLuint matrixpaletteindex)
1823*8975f5c5SAndroid Build Coastguard Worker {
1824*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
1825*8975f5c5SAndroid Build Coastguard Worker     return true;
1826*8975f5c5SAndroid Build Coastguard Worker }
1827*8975f5c5SAndroid Build Coastguard Worker 
ValidateLoadPaletteFromModelViewMatrixOES(const Context * context,angle::EntryPoint entryPoint)1828*8975f5c5SAndroid Build Coastguard Worker bool ValidateLoadPaletteFromModelViewMatrixOES(const Context *context, angle::EntryPoint entryPoint)
1829*8975f5c5SAndroid Build Coastguard Worker {
1830*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
1831*8975f5c5SAndroid Build Coastguard Worker     return true;
1832*8975f5c5SAndroid Build Coastguard Worker }
1833*8975f5c5SAndroid Build Coastguard Worker 
ValidateMatrixIndexPointerOES(const Context * context,angle::EntryPoint entryPoint,GLint size,GLenum type,GLsizei stride,const void * pointer)1834*8975f5c5SAndroid Build Coastguard Worker bool ValidateMatrixIndexPointerOES(const Context *context,
1835*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
1836*8975f5c5SAndroid Build Coastguard Worker                                    GLint size,
1837*8975f5c5SAndroid Build Coastguard Worker                                    GLenum type,
1838*8975f5c5SAndroid Build Coastguard Worker                                    GLsizei stride,
1839*8975f5c5SAndroid Build Coastguard Worker                                    const void *pointer)
1840*8975f5c5SAndroid Build Coastguard Worker {
1841*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
1842*8975f5c5SAndroid Build Coastguard Worker     return true;
1843*8975f5c5SAndroid Build Coastguard Worker }
1844*8975f5c5SAndroid Build Coastguard Worker 
ValidateWeightPointerOES(const Context * context,angle::EntryPoint entryPoint,GLint size,GLenum type,GLsizei stride,const void * pointer)1845*8975f5c5SAndroid Build Coastguard Worker bool ValidateWeightPointerOES(const Context *context,
1846*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
1847*8975f5c5SAndroid Build Coastguard Worker                               GLint size,
1848*8975f5c5SAndroid Build Coastguard Worker                               GLenum type,
1849*8975f5c5SAndroid Build Coastguard Worker                               GLsizei stride,
1850*8975f5c5SAndroid Build Coastguard Worker                               const void *pointer)
1851*8975f5c5SAndroid Build Coastguard Worker {
1852*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
1853*8975f5c5SAndroid Build Coastguard Worker     return true;
1854*8975f5c5SAndroid Build Coastguard Worker }
1855*8975f5c5SAndroid Build Coastguard Worker 
ValidatePointSizePointerOES(const Context * context,angle::EntryPoint entryPoint,VertexAttribType type,GLsizei stride,const void * pointer)1856*8975f5c5SAndroid Build Coastguard Worker bool ValidatePointSizePointerOES(const Context *context,
1857*8975f5c5SAndroid Build Coastguard Worker                                  angle::EntryPoint entryPoint,
1858*8975f5c5SAndroid Build Coastguard Worker                                  VertexAttribType type,
1859*8975f5c5SAndroid Build Coastguard Worker                                  GLsizei stride,
1860*8975f5c5SAndroid Build Coastguard Worker                                  const void *pointer)
1861*8975f5c5SAndroid Build Coastguard Worker {
1862*8975f5c5SAndroid Build Coastguard Worker     return ValidateBuiltinVertexAttributeCommon(
1863*8975f5c5SAndroid Build Coastguard Worker         context, entryPoint, ClientVertexArrayType::PointSize, 1, type, stride, pointer);
1864*8975f5c5SAndroid Build Coastguard Worker }
1865*8975f5c5SAndroid Build Coastguard Worker 
ValidateQueryMatrixxOES(const Context * context,angle::EntryPoint entryPoint,const GLfixed * mantissa,const GLint * exponent)1866*8975f5c5SAndroid Build Coastguard Worker bool ValidateQueryMatrixxOES(const Context *context,
1867*8975f5c5SAndroid Build Coastguard Worker                              angle::EntryPoint entryPoint,
1868*8975f5c5SAndroid Build Coastguard Worker                              const GLfixed *mantissa,
1869*8975f5c5SAndroid Build Coastguard Worker                              const GLint *exponent)
1870*8975f5c5SAndroid Build Coastguard Worker {
1871*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
1872*8975f5c5SAndroid Build Coastguard Worker     return true;
1873*8975f5c5SAndroid Build Coastguard Worker }
1874*8975f5c5SAndroid Build Coastguard Worker 
ValidateGenFramebuffersOES(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const FramebufferID * framebuffers)1875*8975f5c5SAndroid Build Coastguard Worker bool ValidateGenFramebuffersOES(const Context *context,
1876*8975f5c5SAndroid Build Coastguard Worker                                 angle::EntryPoint entryPoint,
1877*8975f5c5SAndroid Build Coastguard Worker                                 GLsizei n,
1878*8975f5c5SAndroid Build Coastguard Worker                                 const FramebufferID *framebuffers)
1879*8975f5c5SAndroid Build Coastguard Worker {
1880*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().framebufferObjectOES)
1881*8975f5c5SAndroid Build Coastguard Worker     {
1882*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
1883*8975f5c5SAndroid Build Coastguard Worker         return false;
1884*8975f5c5SAndroid Build Coastguard Worker     }
1885*8975f5c5SAndroid Build Coastguard Worker 
1886*8975f5c5SAndroid Build Coastguard Worker     return ValidateGenOrDelete(context, entryPoint, n);
1887*8975f5c5SAndroid Build Coastguard Worker }
1888*8975f5c5SAndroid Build Coastguard Worker 
ValidateDeleteFramebuffersOES(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const FramebufferID * framebuffers)1889*8975f5c5SAndroid Build Coastguard Worker bool ValidateDeleteFramebuffersOES(const Context *context,
1890*8975f5c5SAndroid Build Coastguard Worker                                    angle::EntryPoint entryPoint,
1891*8975f5c5SAndroid Build Coastguard Worker                                    GLsizei n,
1892*8975f5c5SAndroid Build Coastguard Worker                                    const FramebufferID *framebuffers)
1893*8975f5c5SAndroid Build Coastguard Worker {
1894*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().framebufferObjectOES)
1895*8975f5c5SAndroid Build Coastguard Worker     {
1896*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
1897*8975f5c5SAndroid Build Coastguard Worker         return false;
1898*8975f5c5SAndroid Build Coastguard Worker     }
1899*8975f5c5SAndroid Build Coastguard Worker 
1900*8975f5c5SAndroid Build Coastguard Worker     return ValidateGenOrDelete(context, entryPoint, n);
1901*8975f5c5SAndroid Build Coastguard Worker }
1902*8975f5c5SAndroid Build Coastguard Worker 
ValidateGenRenderbuffersOES(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const RenderbufferID * renderbuffers)1903*8975f5c5SAndroid Build Coastguard Worker bool ValidateGenRenderbuffersOES(const Context *context,
1904*8975f5c5SAndroid Build Coastguard Worker                                  angle::EntryPoint entryPoint,
1905*8975f5c5SAndroid Build Coastguard Worker                                  GLsizei n,
1906*8975f5c5SAndroid Build Coastguard Worker                                  const RenderbufferID *renderbuffers)
1907*8975f5c5SAndroid Build Coastguard Worker {
1908*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().framebufferObjectOES)
1909*8975f5c5SAndroid Build Coastguard Worker     {
1910*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
1911*8975f5c5SAndroid Build Coastguard Worker         return false;
1912*8975f5c5SAndroid Build Coastguard Worker     }
1913*8975f5c5SAndroid Build Coastguard Worker 
1914*8975f5c5SAndroid Build Coastguard Worker     return ValidateGenOrDelete(context, entryPoint, n);
1915*8975f5c5SAndroid Build Coastguard Worker }
1916*8975f5c5SAndroid Build Coastguard Worker 
ValidateDeleteRenderbuffersOES(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const RenderbufferID * renderbuffers)1917*8975f5c5SAndroid Build Coastguard Worker bool ValidateDeleteRenderbuffersOES(const Context *context,
1918*8975f5c5SAndroid Build Coastguard Worker                                     angle::EntryPoint entryPoint,
1919*8975f5c5SAndroid Build Coastguard Worker                                     GLsizei n,
1920*8975f5c5SAndroid Build Coastguard Worker                                     const RenderbufferID *renderbuffers)
1921*8975f5c5SAndroid Build Coastguard Worker {
1922*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().framebufferObjectOES)
1923*8975f5c5SAndroid Build Coastguard Worker     {
1924*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
1925*8975f5c5SAndroid Build Coastguard Worker         return false;
1926*8975f5c5SAndroid Build Coastguard Worker     }
1927*8975f5c5SAndroid Build Coastguard Worker 
1928*8975f5c5SAndroid Build Coastguard Worker     return ValidateGenOrDelete(context, entryPoint, n);
1929*8975f5c5SAndroid Build Coastguard Worker }
1930*8975f5c5SAndroid Build Coastguard Worker 
ValidateBindFramebufferOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,FramebufferID framebuffer)1931*8975f5c5SAndroid Build Coastguard Worker bool ValidateBindFramebufferOES(const Context *context,
1932*8975f5c5SAndroid Build Coastguard Worker                                 angle::EntryPoint entryPoint,
1933*8975f5c5SAndroid Build Coastguard Worker                                 GLenum target,
1934*8975f5c5SAndroid Build Coastguard Worker                                 FramebufferID framebuffer)
1935*8975f5c5SAndroid Build Coastguard Worker {
1936*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().framebufferObjectOES)
1937*8975f5c5SAndroid Build Coastguard Worker     {
1938*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
1939*8975f5c5SAndroid Build Coastguard Worker         return false;
1940*8975f5c5SAndroid Build Coastguard Worker     }
1941*8975f5c5SAndroid Build Coastguard Worker 
1942*8975f5c5SAndroid Build Coastguard Worker     return ValidateBindFramebufferBase(context, entryPoint, target, framebuffer);
1943*8975f5c5SAndroid Build Coastguard Worker }
1944*8975f5c5SAndroid Build Coastguard Worker 
ValidateBindRenderbufferOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,RenderbufferID renderbuffer)1945*8975f5c5SAndroid Build Coastguard Worker bool ValidateBindRenderbufferOES(const Context *context,
1946*8975f5c5SAndroid Build Coastguard Worker                                  angle::EntryPoint entryPoint,
1947*8975f5c5SAndroid Build Coastguard Worker                                  GLenum target,
1948*8975f5c5SAndroid Build Coastguard Worker                                  RenderbufferID renderbuffer)
1949*8975f5c5SAndroid Build Coastguard Worker {
1950*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().framebufferObjectOES)
1951*8975f5c5SAndroid Build Coastguard Worker     {
1952*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
1953*8975f5c5SAndroid Build Coastguard Worker         return false;
1954*8975f5c5SAndroid Build Coastguard Worker     }
1955*8975f5c5SAndroid Build Coastguard Worker 
1956*8975f5c5SAndroid Build Coastguard Worker     return ValidateBindRenderbufferBase(context, entryPoint, target, renderbuffer);
1957*8975f5c5SAndroid Build Coastguard Worker }
1958*8975f5c5SAndroid Build Coastguard Worker 
ValidateCheckFramebufferStatusOES(const Context * context,angle::EntryPoint entryPoint,GLenum target)1959*8975f5c5SAndroid Build Coastguard Worker bool ValidateCheckFramebufferStatusOES(const Context *context,
1960*8975f5c5SAndroid Build Coastguard Worker                                        angle::EntryPoint entryPoint,
1961*8975f5c5SAndroid Build Coastguard Worker                                        GLenum target)
1962*8975f5c5SAndroid Build Coastguard Worker {
1963*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().framebufferObjectOES)
1964*8975f5c5SAndroid Build Coastguard Worker     {
1965*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
1966*8975f5c5SAndroid Build Coastguard Worker         return false;
1967*8975f5c5SAndroid Build Coastguard Worker     }
1968*8975f5c5SAndroid Build Coastguard Worker 
1969*8975f5c5SAndroid Build Coastguard Worker     if (!ValidFramebufferTarget(context, target))
1970*8975f5c5SAndroid Build Coastguard Worker     {
1971*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidFramebufferTarget);
1972*8975f5c5SAndroid Build Coastguard Worker         return false;
1973*8975f5c5SAndroid Build Coastguard Worker     }
1974*8975f5c5SAndroid Build Coastguard Worker 
1975*8975f5c5SAndroid Build Coastguard Worker     return true;
1976*8975f5c5SAndroid Build Coastguard Worker }
1977*8975f5c5SAndroid Build Coastguard Worker 
ValidateFramebufferRenderbufferOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum attachment,GLenum rbtarget,RenderbufferID renderbuffer)1978*8975f5c5SAndroid Build Coastguard Worker bool ValidateFramebufferRenderbufferOES(const Context *context,
1979*8975f5c5SAndroid Build Coastguard Worker                                         angle::EntryPoint entryPoint,
1980*8975f5c5SAndroid Build Coastguard Worker                                         GLenum target,
1981*8975f5c5SAndroid Build Coastguard Worker                                         GLenum attachment,
1982*8975f5c5SAndroid Build Coastguard Worker                                         GLenum rbtarget,
1983*8975f5c5SAndroid Build Coastguard Worker                                         RenderbufferID renderbuffer)
1984*8975f5c5SAndroid Build Coastguard Worker {
1985*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().framebufferObjectOES)
1986*8975f5c5SAndroid Build Coastguard Worker     {
1987*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
1988*8975f5c5SAndroid Build Coastguard Worker         return false;
1989*8975f5c5SAndroid Build Coastguard Worker     }
1990*8975f5c5SAndroid Build Coastguard Worker 
1991*8975f5c5SAndroid Build Coastguard Worker     return ValidateFramebufferRenderbufferBase(context, entryPoint, target, attachment, rbtarget,
1992*8975f5c5SAndroid Build Coastguard Worker                                                renderbuffer);
1993*8975f5c5SAndroid Build Coastguard Worker }
1994*8975f5c5SAndroid Build Coastguard Worker 
ValidateFramebufferTexture2DOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum attachment,TextureTarget textarget,TextureID texture,GLint level)1995*8975f5c5SAndroid Build Coastguard Worker bool ValidateFramebufferTexture2DOES(const Context *context,
1996*8975f5c5SAndroid Build Coastguard Worker                                      angle::EntryPoint entryPoint,
1997*8975f5c5SAndroid Build Coastguard Worker                                      GLenum target,
1998*8975f5c5SAndroid Build Coastguard Worker                                      GLenum attachment,
1999*8975f5c5SAndroid Build Coastguard Worker                                      TextureTarget textarget,
2000*8975f5c5SAndroid Build Coastguard Worker                                      TextureID texture,
2001*8975f5c5SAndroid Build Coastguard Worker                                      GLint level)
2002*8975f5c5SAndroid Build Coastguard Worker {
2003*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().framebufferObjectOES)
2004*8975f5c5SAndroid Build Coastguard Worker     {
2005*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
2006*8975f5c5SAndroid Build Coastguard Worker         return false;
2007*8975f5c5SAndroid Build Coastguard Worker     }
2008*8975f5c5SAndroid Build Coastguard Worker 
2009*8975f5c5SAndroid Build Coastguard Worker     if (level != 0)
2010*8975f5c5SAndroid Build Coastguard Worker     {
2011*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidFramebufferTextureLevel);
2012*8975f5c5SAndroid Build Coastguard Worker         return false;
2013*8975f5c5SAndroid Build Coastguard Worker     }
2014*8975f5c5SAndroid Build Coastguard Worker 
2015*8975f5c5SAndroid Build Coastguard Worker     if (!ValidateFramebufferTextureBase(context, entryPoint, target, attachment, texture, level))
2016*8975f5c5SAndroid Build Coastguard Worker     {
2017*8975f5c5SAndroid Build Coastguard Worker         return false;
2018*8975f5c5SAndroid Build Coastguard Worker     }
2019*8975f5c5SAndroid Build Coastguard Worker 
2020*8975f5c5SAndroid Build Coastguard Worker     if (texture.value != 0)
2021*8975f5c5SAndroid Build Coastguard Worker     {
2022*8975f5c5SAndroid Build Coastguard Worker         Texture *tex = context->getTexture(texture);
2023*8975f5c5SAndroid Build Coastguard Worker         ASSERT(tex);
2024*8975f5c5SAndroid Build Coastguard Worker 
2025*8975f5c5SAndroid Build Coastguard Worker         const Caps &caps = context->getCaps();
2026*8975f5c5SAndroid Build Coastguard Worker 
2027*8975f5c5SAndroid Build Coastguard Worker         switch (textarget)
2028*8975f5c5SAndroid Build Coastguard Worker         {
2029*8975f5c5SAndroid Build Coastguard Worker             case TextureTarget::_2D:
2030*8975f5c5SAndroid Build Coastguard Worker             {
2031*8975f5c5SAndroid Build Coastguard Worker                 if (level > log2(caps.max2DTextureSize))
2032*8975f5c5SAndroid Build Coastguard Worker                 {
2033*8975f5c5SAndroid Build Coastguard Worker                     ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidMipLevel);
2034*8975f5c5SAndroid Build Coastguard Worker                     return false;
2035*8975f5c5SAndroid Build Coastguard Worker                 }
2036*8975f5c5SAndroid Build Coastguard Worker                 if (tex->getType() != TextureType::_2D)
2037*8975f5c5SAndroid Build Coastguard Worker                 {
2038*8975f5c5SAndroid Build Coastguard Worker                     ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidTextureTarget);
2039*8975f5c5SAndroid Build Coastguard Worker                     return false;
2040*8975f5c5SAndroid Build Coastguard Worker                 }
2041*8975f5c5SAndroid Build Coastguard Worker             }
2042*8975f5c5SAndroid Build Coastguard Worker             break;
2043*8975f5c5SAndroid Build Coastguard Worker 
2044*8975f5c5SAndroid Build Coastguard Worker             case TextureTarget::CubeMapNegativeX:
2045*8975f5c5SAndroid Build Coastguard Worker             case TextureTarget::CubeMapNegativeY:
2046*8975f5c5SAndroid Build Coastguard Worker             case TextureTarget::CubeMapNegativeZ:
2047*8975f5c5SAndroid Build Coastguard Worker             case TextureTarget::CubeMapPositiveX:
2048*8975f5c5SAndroid Build Coastguard Worker             case TextureTarget::CubeMapPositiveY:
2049*8975f5c5SAndroid Build Coastguard Worker             case TextureTarget::CubeMapPositiveZ:
2050*8975f5c5SAndroid Build Coastguard Worker             {
2051*8975f5c5SAndroid Build Coastguard Worker                 if (!context->getExtensions().textureCubeMapOES)
2052*8975f5c5SAndroid Build Coastguard Worker                 {
2053*8975f5c5SAndroid Build Coastguard Worker                     ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidTextureTarget);
2054*8975f5c5SAndroid Build Coastguard Worker                     return false;
2055*8975f5c5SAndroid Build Coastguard Worker                 }
2056*8975f5c5SAndroid Build Coastguard Worker 
2057*8975f5c5SAndroid Build Coastguard Worker                 if (level > log2(caps.maxCubeMapTextureSize))
2058*8975f5c5SAndroid Build Coastguard Worker                 {
2059*8975f5c5SAndroid Build Coastguard Worker                     ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidMipLevel);
2060*8975f5c5SAndroid Build Coastguard Worker                     return false;
2061*8975f5c5SAndroid Build Coastguard Worker                 }
2062*8975f5c5SAndroid Build Coastguard Worker                 if (tex->getType() != TextureType::CubeMap)
2063*8975f5c5SAndroid Build Coastguard Worker                 {
2064*8975f5c5SAndroid Build Coastguard Worker                     ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kTextureTargetMismatch);
2065*8975f5c5SAndroid Build Coastguard Worker                     return false;
2066*8975f5c5SAndroid Build Coastguard Worker                 }
2067*8975f5c5SAndroid Build Coastguard Worker             }
2068*8975f5c5SAndroid Build Coastguard Worker             break;
2069*8975f5c5SAndroid Build Coastguard Worker 
2070*8975f5c5SAndroid Build Coastguard Worker             default:
2071*8975f5c5SAndroid Build Coastguard Worker                 ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidTextureTarget);
2072*8975f5c5SAndroid Build Coastguard Worker                 return false;
2073*8975f5c5SAndroid Build Coastguard Worker         }
2074*8975f5c5SAndroid Build Coastguard Worker     }
2075*8975f5c5SAndroid Build Coastguard Worker 
2076*8975f5c5SAndroid Build Coastguard Worker     return true;
2077*8975f5c5SAndroid Build Coastguard Worker }
2078*8975f5c5SAndroid Build Coastguard Worker 
ValidateGenerateMipmapOES(const Context * context,angle::EntryPoint entryPoint,TextureType target)2079*8975f5c5SAndroid Build Coastguard Worker bool ValidateGenerateMipmapOES(const Context *context,
2080*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
2081*8975f5c5SAndroid Build Coastguard Worker                                TextureType target)
2082*8975f5c5SAndroid Build Coastguard Worker {
2083*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().framebufferObjectOES)
2084*8975f5c5SAndroid Build Coastguard Worker     {
2085*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
2086*8975f5c5SAndroid Build Coastguard Worker         return false;
2087*8975f5c5SAndroid Build Coastguard Worker     }
2088*8975f5c5SAndroid Build Coastguard Worker 
2089*8975f5c5SAndroid Build Coastguard Worker     return ValidateGenerateMipmapBase(context, entryPoint, target);
2090*8975f5c5SAndroid Build Coastguard Worker }
2091*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetFramebufferAttachmentParameterivOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum attachment,GLenum pname,const GLint * params)2092*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetFramebufferAttachmentParameterivOES(const Context *context,
2093*8975f5c5SAndroid Build Coastguard Worker                                                     angle::EntryPoint entryPoint,
2094*8975f5c5SAndroid Build Coastguard Worker                                                     GLenum target,
2095*8975f5c5SAndroid Build Coastguard Worker                                                     GLenum attachment,
2096*8975f5c5SAndroid Build Coastguard Worker                                                     GLenum pname,
2097*8975f5c5SAndroid Build Coastguard Worker                                                     const GLint *params)
2098*8975f5c5SAndroid Build Coastguard Worker {
2099*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().framebufferObjectOES)
2100*8975f5c5SAndroid Build Coastguard Worker     {
2101*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
2102*8975f5c5SAndroid Build Coastguard Worker         return false;
2103*8975f5c5SAndroid Build Coastguard Worker     }
2104*8975f5c5SAndroid Build Coastguard Worker 
2105*8975f5c5SAndroid Build Coastguard Worker     return ValidateGetFramebufferAttachmentParameterivBase(context, entryPoint, target, attachment,
2106*8975f5c5SAndroid Build Coastguard Worker                                                            pname, nullptr);
2107*8975f5c5SAndroid Build Coastguard Worker }
2108*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetRenderbufferParameterivOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum pname,const GLint * params)2109*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetRenderbufferParameterivOES(const Context *context,
2110*8975f5c5SAndroid Build Coastguard Worker                                            angle::EntryPoint entryPoint,
2111*8975f5c5SAndroid Build Coastguard Worker                                            GLenum target,
2112*8975f5c5SAndroid Build Coastguard Worker                                            GLenum pname,
2113*8975f5c5SAndroid Build Coastguard Worker                                            const GLint *params)
2114*8975f5c5SAndroid Build Coastguard Worker {
2115*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().framebufferObjectOES)
2116*8975f5c5SAndroid Build Coastguard Worker     {
2117*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
2118*8975f5c5SAndroid Build Coastguard Worker         return false;
2119*8975f5c5SAndroid Build Coastguard Worker     }
2120*8975f5c5SAndroid Build Coastguard Worker 
2121*8975f5c5SAndroid Build Coastguard Worker     return ValidateGetRenderbufferParameterivBase(context, entryPoint, target, pname, nullptr);
2122*8975f5c5SAndroid Build Coastguard Worker }
2123*8975f5c5SAndroid Build Coastguard Worker 
ValidateIsFramebufferOES(const Context * context,angle::EntryPoint entryPoint,FramebufferID framebuffer)2124*8975f5c5SAndroid Build Coastguard Worker bool ValidateIsFramebufferOES(const Context *context,
2125*8975f5c5SAndroid Build Coastguard Worker                               angle::EntryPoint entryPoint,
2126*8975f5c5SAndroid Build Coastguard Worker                               FramebufferID framebuffer)
2127*8975f5c5SAndroid Build Coastguard Worker {
2128*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().framebufferObjectOES)
2129*8975f5c5SAndroid Build Coastguard Worker     {
2130*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
2131*8975f5c5SAndroid Build Coastguard Worker         return false;
2132*8975f5c5SAndroid Build Coastguard Worker     }
2133*8975f5c5SAndroid Build Coastguard Worker 
2134*8975f5c5SAndroid Build Coastguard Worker     return true;
2135*8975f5c5SAndroid Build Coastguard Worker }
2136*8975f5c5SAndroid Build Coastguard Worker 
ValidateIsRenderbufferOES(const Context * context,angle::EntryPoint entryPoint,RenderbufferID renderbuffer)2137*8975f5c5SAndroid Build Coastguard Worker bool ValidateIsRenderbufferOES(const Context *context,
2138*8975f5c5SAndroid Build Coastguard Worker                                angle::EntryPoint entryPoint,
2139*8975f5c5SAndroid Build Coastguard Worker                                RenderbufferID renderbuffer)
2140*8975f5c5SAndroid Build Coastguard Worker {
2141*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().framebufferObjectOES)
2142*8975f5c5SAndroid Build Coastguard Worker     {
2143*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
2144*8975f5c5SAndroid Build Coastguard Worker         return false;
2145*8975f5c5SAndroid Build Coastguard Worker     }
2146*8975f5c5SAndroid Build Coastguard Worker 
2147*8975f5c5SAndroid Build Coastguard Worker     return true;
2148*8975f5c5SAndroid Build Coastguard Worker }
2149*8975f5c5SAndroid Build Coastguard Worker 
ValidateRenderbufferStorageOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum internalformat,GLsizei width,GLsizei height)2150*8975f5c5SAndroid Build Coastguard Worker bool ValidateRenderbufferStorageOES(const Context *context,
2151*8975f5c5SAndroid Build Coastguard Worker                                     angle::EntryPoint entryPoint,
2152*8975f5c5SAndroid Build Coastguard Worker                                     GLenum target,
2153*8975f5c5SAndroid Build Coastguard Worker                                     GLenum internalformat,
2154*8975f5c5SAndroid Build Coastguard Worker                                     GLsizei width,
2155*8975f5c5SAndroid Build Coastguard Worker                                     GLsizei height)
2156*8975f5c5SAndroid Build Coastguard Worker {
2157*8975f5c5SAndroid Build Coastguard Worker     if (!context->getExtensions().framebufferObjectOES)
2158*8975f5c5SAndroid Build Coastguard Worker     {
2159*8975f5c5SAndroid Build Coastguard Worker         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
2160*8975f5c5SAndroid Build Coastguard Worker         return false;
2161*8975f5c5SAndroid Build Coastguard Worker     }
2162*8975f5c5SAndroid Build Coastguard Worker 
2163*8975f5c5SAndroid Build Coastguard Worker     return ValidateRenderbufferStorageParametersBase(context, entryPoint, target, 0, internalformat,
2164*8975f5c5SAndroid Build Coastguard Worker                                                      width, height);
2165*8975f5c5SAndroid Build Coastguard Worker }
2166*8975f5c5SAndroid Build Coastguard Worker 
2167*8975f5c5SAndroid Build Coastguard Worker // GL_OES_texture_cube_map
2168*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetTexGenfvOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,const GLfloat * params)2169*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetTexGenfvOES(const Context *context,
2170*8975f5c5SAndroid Build Coastguard Worker                             angle::EntryPoint entryPoint,
2171*8975f5c5SAndroid Build Coastguard Worker                             GLenum coord,
2172*8975f5c5SAndroid Build Coastguard Worker                             GLenum pname,
2173*8975f5c5SAndroid Build Coastguard Worker                             const GLfloat *params)
2174*8975f5c5SAndroid Build Coastguard Worker {
2175*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
2176*8975f5c5SAndroid Build Coastguard Worker     return true;
2177*8975f5c5SAndroid Build Coastguard Worker }
2178*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetTexGenivOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,const int * params)2179*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetTexGenivOES(const Context *context,
2180*8975f5c5SAndroid Build Coastguard Worker                             angle::EntryPoint entryPoint,
2181*8975f5c5SAndroid Build Coastguard Worker                             GLenum coord,
2182*8975f5c5SAndroid Build Coastguard Worker                             GLenum pname,
2183*8975f5c5SAndroid Build Coastguard Worker                             const int *params)
2184*8975f5c5SAndroid Build Coastguard Worker {
2185*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
2186*8975f5c5SAndroid Build Coastguard Worker     return true;
2187*8975f5c5SAndroid Build Coastguard Worker }
2188*8975f5c5SAndroid Build Coastguard Worker 
ValidateGetTexGenxvOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,const GLfixed * params)2189*8975f5c5SAndroid Build Coastguard Worker bool ValidateGetTexGenxvOES(const Context *context,
2190*8975f5c5SAndroid Build Coastguard Worker                             angle::EntryPoint entryPoint,
2191*8975f5c5SAndroid Build Coastguard Worker                             GLenum coord,
2192*8975f5c5SAndroid Build Coastguard Worker                             GLenum pname,
2193*8975f5c5SAndroid Build Coastguard Worker                             const GLfixed *params)
2194*8975f5c5SAndroid Build Coastguard Worker {
2195*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
2196*8975f5c5SAndroid Build Coastguard Worker     return true;
2197*8975f5c5SAndroid Build Coastguard Worker }
2198*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexGenfvOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,const GLfloat * params)2199*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexGenfvOES(const Context *context,
2200*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
2201*8975f5c5SAndroid Build Coastguard Worker                          GLenum coord,
2202*8975f5c5SAndroid Build Coastguard Worker                          GLenum pname,
2203*8975f5c5SAndroid Build Coastguard Worker                          const GLfloat *params)
2204*8975f5c5SAndroid Build Coastguard Worker {
2205*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
2206*8975f5c5SAndroid Build Coastguard Worker     return true;
2207*8975f5c5SAndroid Build Coastguard Worker }
2208*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexGenivOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,const GLint * param)2209*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexGenivOES(const Context *context,
2210*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
2211*8975f5c5SAndroid Build Coastguard Worker                          GLenum coord,
2212*8975f5c5SAndroid Build Coastguard Worker                          GLenum pname,
2213*8975f5c5SAndroid Build Coastguard Worker                          const GLint *param)
2214*8975f5c5SAndroid Build Coastguard Worker {
2215*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
2216*8975f5c5SAndroid Build Coastguard Worker     return true;
2217*8975f5c5SAndroid Build Coastguard Worker }
2218*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexGenxvOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,const GLint * param)2219*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexGenxvOES(const Context *context,
2220*8975f5c5SAndroid Build Coastguard Worker                          angle::EntryPoint entryPoint,
2221*8975f5c5SAndroid Build Coastguard Worker                          GLenum coord,
2222*8975f5c5SAndroid Build Coastguard Worker                          GLenum pname,
2223*8975f5c5SAndroid Build Coastguard Worker                          const GLint *param)
2224*8975f5c5SAndroid Build Coastguard Worker {
2225*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
2226*8975f5c5SAndroid Build Coastguard Worker     return true;
2227*8975f5c5SAndroid Build Coastguard Worker }
2228*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexGenfOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,GLfloat param)2229*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexGenfOES(const Context *context,
2230*8975f5c5SAndroid Build Coastguard Worker                         angle::EntryPoint entryPoint,
2231*8975f5c5SAndroid Build Coastguard Worker                         GLenum coord,
2232*8975f5c5SAndroid Build Coastguard Worker                         GLenum pname,
2233*8975f5c5SAndroid Build Coastguard Worker                         GLfloat param)
2234*8975f5c5SAndroid Build Coastguard Worker {
2235*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
2236*8975f5c5SAndroid Build Coastguard Worker     return true;
2237*8975f5c5SAndroid Build Coastguard Worker }
2238*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexGeniOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,GLint param)2239*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexGeniOES(const Context *context,
2240*8975f5c5SAndroid Build Coastguard Worker                         angle::EntryPoint entryPoint,
2241*8975f5c5SAndroid Build Coastguard Worker                         GLenum coord,
2242*8975f5c5SAndroid Build Coastguard Worker                         GLenum pname,
2243*8975f5c5SAndroid Build Coastguard Worker                         GLint param)
2244*8975f5c5SAndroid Build Coastguard Worker {
2245*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
2246*8975f5c5SAndroid Build Coastguard Worker     return true;
2247*8975f5c5SAndroid Build Coastguard Worker }
2248*8975f5c5SAndroid Build Coastguard Worker 
ValidateTexGenxOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,GLfixed param)2249*8975f5c5SAndroid Build Coastguard Worker bool ValidateTexGenxOES(const Context *context,
2250*8975f5c5SAndroid Build Coastguard Worker                         angle::EntryPoint entryPoint,
2251*8975f5c5SAndroid Build Coastguard Worker                         GLenum coord,
2252*8975f5c5SAndroid Build Coastguard Worker                         GLenum pname,
2253*8975f5c5SAndroid Build Coastguard Worker                         GLfixed param)
2254*8975f5c5SAndroid Build Coastguard Worker {
2255*8975f5c5SAndroid Build Coastguard Worker     UNIMPLEMENTED();
2256*8975f5c5SAndroid Build Coastguard Worker     return true;
2257*8975f5c5SAndroid Build Coastguard Worker }
2258*8975f5c5SAndroid Build Coastguard Worker 
2259*8975f5c5SAndroid Build Coastguard Worker }  // namespace gl
2260