• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2018 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // Context_gles_1_0.cpp: Implements the GLES1-specific parts of Context.
8 
9 #include "libANGLE/Context.h"
10 
11 #include "common/mathutil.h"
12 #include "common/utilities.h"
13 
14 #include "libANGLE/GLES1Renderer.h"
15 #include "libANGLE/queryconversions.h"
16 #include "libANGLE/queryutils.h"
17 
18 namespace
19 {
20 
FixedMatrixToMat4(const GLfixed * m)21 angle::Mat4 FixedMatrixToMat4(const GLfixed *m)
22 {
23     angle::Mat4 matrixAsFloat;
24     GLfloat *floatData = matrixAsFloat.data();
25 
26     for (int i = 0; i < 16; i++)
27     {
28         floatData[i] = gl::FixedToFloat(m[i]);
29     }
30 
31     return matrixAsFloat;
32 }
33 
34 }  // namespace
35 
36 namespace gl
37 {
38 
alphaFunc(AlphaTestFunc func,GLfloat ref)39 void Context::alphaFunc(AlphaTestFunc func, GLfloat ref)
40 {
41     mState.gles1().setAlphaFunc(func, ref);
42 }
43 
alphaFuncx(AlphaTestFunc func,GLfixed ref)44 void Context::alphaFuncx(AlphaTestFunc func, GLfixed ref)
45 {
46     mState.gles1().setAlphaFunc(func, FixedToFloat(ref));
47 }
48 
clearColorx(GLfixed red,GLfixed green,GLfixed blue,GLfixed alpha)49 void Context::clearColorx(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
50 {
51     UNIMPLEMENTED();
52 }
53 
clearDepthx(GLfixed depth)54 void Context::clearDepthx(GLfixed depth)
55 {
56     UNIMPLEMENTED();
57 }
58 
clientActiveTexture(GLenum texture)59 void Context::clientActiveTexture(GLenum texture)
60 {
61     mState.gles1().setClientTextureUnit(texture - GL_TEXTURE0);
62     mStateCache.onGLES1ClientStateChange(this);
63 }
64 
clipPlanef(GLenum p,const GLfloat * eqn)65 void Context::clipPlanef(GLenum p, const GLfloat *eqn)
66 {
67     mState.gles1().setClipPlane(p - GL_CLIP_PLANE0, eqn);
68 }
69 
clipPlanex(GLenum plane,const GLfixed * equation)70 void Context::clipPlanex(GLenum plane, const GLfixed *equation)
71 {
72     const GLfloat equationf[4] = {
73         FixedToFloat(equation[0]),
74         FixedToFloat(equation[1]),
75         FixedToFloat(equation[2]),
76         FixedToFloat(equation[3]),
77     };
78 
79     mState.gles1().setClipPlane(plane - GL_CLIP_PLANE0, equationf);
80 }
81 
color4f(GLfloat red,GLfloat green,GLfloat blue,GLfloat alpha)82 void Context::color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
83 {
84     mState.gles1().setCurrentColor({red, green, blue, alpha});
85 }
86 
color4ub(GLubyte red,GLubyte green,GLubyte blue,GLubyte alpha)87 void Context::color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
88 {
89     mState.gles1().setCurrentColor(
90         {normalizedToFloat<uint8_t>(red), normalizedToFloat<uint8_t>(green),
91          normalizedToFloat<uint8_t>(blue), normalizedToFloat<uint8_t>(alpha)});
92 }
93 
color4x(GLfixed red,GLfixed green,GLfixed blue,GLfixed alpha)94 void Context::color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
95 {
96     mState.gles1().setCurrentColor(
97         {FixedToFloat(red), FixedToFloat(green), FixedToFloat(blue), FixedToFloat(alpha)});
98 }
99 
colorPointer(GLint size,VertexAttribType type,GLsizei stride,const void * ptr)100 void Context::colorPointer(GLint size, VertexAttribType type, GLsizei stride, const void *ptr)
101 {
102     vertexAttribPointer(vertexArrayIndex(ClientVertexArrayType::Color), size, type, GL_FALSE,
103                         stride, ptr);
104 }
105 
depthRangex(GLfixed n,GLfixed f)106 void Context::depthRangex(GLfixed n, GLfixed f)
107 {
108     UNIMPLEMENTED();
109 }
110 
disableClientState(ClientVertexArrayType clientState)111 void Context::disableClientState(ClientVertexArrayType clientState)
112 {
113     mState.gles1().setClientStateEnabled(clientState, false);
114     disableVertexAttribArray(vertexArrayIndex(clientState));
115     mStateCache.onGLES1ClientStateChange(this);
116 }
117 
enableClientState(ClientVertexArrayType clientState)118 void Context::enableClientState(ClientVertexArrayType clientState)
119 {
120     mState.gles1().setClientStateEnabled(clientState, true);
121     enableVertexAttribArray(vertexArrayIndex(clientState));
122     mStateCache.onGLES1ClientStateChange(this);
123 }
124 
fogf(GLenum pname,GLfloat param)125 void Context::fogf(GLenum pname, GLfloat param)
126 {
127     SetFogParameters(&mState.gles1(), pname, &param);
128 }
129 
fogfv(GLenum pname,const GLfloat * params)130 void Context::fogfv(GLenum pname, const GLfloat *params)
131 {
132     SetFogParameters(&mState.gles1(), pname, params);
133 }
134 
fogx(GLenum pname,GLfixed param)135 void Context::fogx(GLenum pname, GLfixed param)
136 {
137     if (GetFogParameterCount(pname) == 1)
138     {
139         GLfloat paramf = pname == GL_FOG_MODE ? ConvertToGLenum(param) : FixedToFloat(param);
140         fogf(pname, paramf);
141     }
142     else
143     {
144         UNREACHABLE();
145     }
146 }
147 
fogxv(GLenum pname,const GLfixed * params)148 void Context::fogxv(GLenum pname, const GLfixed *params)
149 {
150     int paramCount = GetFogParameterCount(pname);
151 
152     if (paramCount > 0)
153     {
154         GLfloat paramsf[4];
155         for (int i = 0; i < paramCount; i++)
156         {
157             paramsf[i] =
158                 pname == GL_FOG_MODE ? ConvertToGLenum(params[i]) : FixedToFloat(params[i]);
159         }
160         fogfv(pname, paramsf);
161     }
162     else
163     {
164         UNREACHABLE();
165     }
166 }
167 
frustumf(GLfloat l,GLfloat r,GLfloat b,GLfloat t,GLfloat n,GLfloat f)168 void Context::frustumf(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f)
169 {
170     mState.gles1().multMatrix(angle::Mat4::Frustum(l, r, b, t, n, f));
171 }
172 
frustumx(GLfixed l,GLfixed r,GLfixed b,GLfixed t,GLfixed n,GLfixed f)173 void Context::frustumx(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f)
174 {
175     mState.gles1().multMatrix(angle::Mat4::Frustum(FixedToFloat(l), FixedToFloat(r),
176                                                    FixedToFloat(b), FixedToFloat(t),
177                                                    FixedToFloat(n), FixedToFloat(f)));
178 }
179 
getClipPlanef(GLenum plane,GLfloat * equation)180 void Context::getClipPlanef(GLenum plane, GLfloat *equation)
181 {
182     mState.gles1().getClipPlane(plane - GL_CLIP_PLANE0, equation);
183 }
184 
getClipPlanex(GLenum plane,GLfixed * equation)185 void Context::getClipPlanex(GLenum plane, GLfixed *equation)
186 {
187     GLfloat equationf[4] = {};
188 
189     mState.gles1().getClipPlane(plane - GL_CLIP_PLANE0, equationf);
190 
191     for (int i = 0; i < 4; i++)
192     {
193         equation[i] = FloatToFixed(equationf[i]);
194     }
195 }
196 
getFixedv(GLenum pname,GLfixed * params)197 void Context::getFixedv(GLenum pname, GLfixed *params)
198 {
199     UNIMPLEMENTED();
200 }
201 
getLightfv(GLenum light,LightParameter pname,GLfloat * params)202 void Context::getLightfv(GLenum light, LightParameter pname, GLfloat *params)
203 {
204     GetLightParameters(&mState.gles1(), light, pname, params);
205 }
206 
getLightxv(GLenum light,LightParameter pname,GLfixed * params)207 void Context::getLightxv(GLenum light, LightParameter pname, GLfixed *params)
208 {
209     GLfloat paramsf[4];
210     getLightfv(light, pname, paramsf);
211 
212     for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
213     {
214         params[i] = FloatToFixed(paramsf[i]);
215     }
216 }
217 
getMaterialfv(GLenum face,MaterialParameter pname,GLfloat * params)218 void Context::getMaterialfv(GLenum face, MaterialParameter pname, GLfloat *params)
219 {
220     GetMaterialParameters(&mState.gles1(), face, pname, params);
221 }
222 
getMaterialxv(GLenum face,MaterialParameter pname,GLfixed * params)223 void Context::getMaterialxv(GLenum face, MaterialParameter pname, GLfixed *params)
224 {
225     GLfloat paramsf[4];
226     getMaterialfv(face, pname, paramsf);
227 
228     for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
229     {
230         params[i] = FloatToFixed(paramsf[i]);
231     }
232 }
233 
getTexEnvfv(TextureEnvTarget target,TextureEnvParameter pname,GLfloat * params)234 void Context::getTexEnvfv(TextureEnvTarget target, TextureEnvParameter pname, GLfloat *params)
235 {
236     GetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, params);
237 }
238 
getTexEnviv(TextureEnvTarget target,TextureEnvParameter pname,GLint * params)239 void Context::getTexEnviv(TextureEnvTarget target, TextureEnvParameter pname, GLint *params)
240 {
241     GLfloat paramsf[4];
242     GetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, paramsf);
243     ConvertTextureEnvToInt(pname, paramsf, params);
244 }
245 
getTexEnvxv(TextureEnvTarget target,TextureEnvParameter pname,GLfixed * params)246 void Context::getTexEnvxv(TextureEnvTarget target, TextureEnvParameter pname, GLfixed *params)
247 {
248     GLfloat paramsf[4];
249     GetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, paramsf);
250     ConvertTextureEnvToFixed(pname, paramsf, params);
251 }
252 
getTexParameterxv(TextureType target,GLenum pname,GLfixed * params)253 void Context::getTexParameterxv(TextureType target, GLenum pname, GLfixed *params)
254 {
255     UNIMPLEMENTED();
256 }
257 
lightModelf(GLenum pname,GLfloat param)258 void Context::lightModelf(GLenum pname, GLfloat param)
259 {
260     SetLightModelParameters(&mState.gles1(), pname, &param);
261 }
262 
lightModelfv(GLenum pname,const GLfloat * params)263 void Context::lightModelfv(GLenum pname, const GLfloat *params)
264 {
265     SetLightModelParameters(&mState.gles1(), pname, params);
266 }
267 
lightModelx(GLenum pname,GLfixed param)268 void Context::lightModelx(GLenum pname, GLfixed param)
269 {
270     lightModelf(pname, FixedToFloat(param));
271 }
272 
lightModelxv(GLenum pname,const GLfixed * param)273 void Context::lightModelxv(GLenum pname, const GLfixed *param)
274 {
275     GLfloat paramsf[4];
276 
277     for (unsigned int i = 0; i < GetLightModelParameterCount(pname); i++)
278     {
279         paramsf[i] = FixedToFloat(param[i]);
280     }
281 
282     lightModelfv(pname, paramsf);
283 }
284 
lightf(GLenum light,LightParameter pname,GLfloat param)285 void Context::lightf(GLenum light, LightParameter pname, GLfloat param)
286 {
287     SetLightParameters(&mState.gles1(), light, pname, &param);
288 }
289 
lightfv(GLenum light,LightParameter pname,const GLfloat * params)290 void Context::lightfv(GLenum light, LightParameter pname, const GLfloat *params)
291 {
292     SetLightParameters(&mState.gles1(), light, pname, params);
293 }
294 
lightx(GLenum light,LightParameter pname,GLfixed param)295 void Context::lightx(GLenum light, LightParameter pname, GLfixed param)
296 {
297     lightf(light, pname, FixedToFloat(param));
298 }
299 
lightxv(GLenum light,LightParameter pname,const GLfixed * params)300 void Context::lightxv(GLenum light, LightParameter pname, const GLfixed *params)
301 {
302     GLfloat paramsf[4];
303 
304     for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
305     {
306         paramsf[i] = FixedToFloat(params[i]);
307     }
308 
309     lightfv(light, pname, paramsf);
310 }
311 
lineWidthx(GLfixed width)312 void Context::lineWidthx(GLfixed width)
313 {
314     UNIMPLEMENTED();
315 }
316 
loadIdentity()317 void Context::loadIdentity()
318 {
319     mState.gles1().loadMatrix(angle::Mat4());
320 }
321 
loadMatrixf(const GLfloat * m)322 void Context::loadMatrixf(const GLfloat *m)
323 {
324     mState.gles1().loadMatrix(angle::Mat4(m));
325 }
326 
loadMatrixx(const GLfixed * m)327 void Context::loadMatrixx(const GLfixed *m)
328 {
329     mState.gles1().loadMatrix(FixedMatrixToMat4(m));
330 }
331 
logicOp(LogicalOperation opcodePacked)332 void Context::logicOp(LogicalOperation opcodePacked)
333 {
334     mState.gles1().setLogicOp(opcodePacked);
335 }
336 
materialf(GLenum face,MaterialParameter pname,GLfloat param)337 void Context::materialf(GLenum face, MaterialParameter pname, GLfloat param)
338 {
339     SetMaterialParameters(&mState.gles1(), face, pname, &param);
340 }
341 
materialfv(GLenum face,MaterialParameter pname,const GLfloat * params)342 void Context::materialfv(GLenum face, MaterialParameter pname, const GLfloat *params)
343 {
344     SetMaterialParameters(&mState.gles1(), face, pname, params);
345 }
346 
materialx(GLenum face,MaterialParameter pname,GLfixed param)347 void Context::materialx(GLenum face, MaterialParameter pname, GLfixed param)
348 {
349     materialf(face, pname, FixedToFloat(param));
350 }
351 
materialxv(GLenum face,MaterialParameter pname,const GLfixed * param)352 void Context::materialxv(GLenum face, MaterialParameter pname, const GLfixed *param)
353 {
354     GLfloat paramsf[4];
355 
356     for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
357     {
358         paramsf[i] = FixedToFloat(param[i]);
359     }
360 
361     materialfv(face, pname, paramsf);
362 }
363 
matrixMode(MatrixType mode)364 void Context::matrixMode(MatrixType mode)
365 {
366     mState.gles1().setMatrixMode(mode);
367 }
368 
multMatrixf(const GLfloat * m)369 void Context::multMatrixf(const GLfloat *m)
370 {
371     mState.gles1().multMatrix(angle::Mat4(m));
372 }
373 
multMatrixx(const GLfixed * m)374 void Context::multMatrixx(const GLfixed *m)
375 {
376     mState.gles1().multMatrix(FixedMatrixToMat4(m));
377 }
378 
multiTexCoord4f(GLenum target,GLfloat s,GLfloat t,GLfloat r,GLfloat q)379 void Context::multiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
380 {
381     unsigned int unit = target - GL_TEXTURE0;
382     ASSERT(target >= GL_TEXTURE0 && unit < getCaps().maxMultitextureUnits);
383     mState.gles1().setCurrentTextureCoords(unit, {s, t, r, q});
384 }
385 
multiTexCoord4x(GLenum target,GLfixed s,GLfixed t,GLfixed r,GLfixed q)386 void Context::multiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
387 {
388     unsigned int unit = target - GL_TEXTURE0;
389     ASSERT(target >= GL_TEXTURE0 && unit < getCaps().maxMultitextureUnits);
390     mState.gles1().setCurrentTextureCoords(
391         unit, {FixedToFloat(s), FixedToFloat(t), FixedToFloat(r), FixedToFloat(q)});
392 }
393 
normal3f(GLfloat nx,GLfloat ny,GLfloat nz)394 void Context::normal3f(GLfloat nx, GLfloat ny, GLfloat nz)
395 {
396     mState.gles1().setCurrentNormal({nx, ny, nz});
397 }
398 
normal3x(GLfixed nx,GLfixed ny,GLfixed nz)399 void Context::normal3x(GLfixed nx, GLfixed ny, GLfixed nz)
400 {
401     mState.gles1().setCurrentNormal({FixedToFloat(nx), FixedToFloat(ny), FixedToFloat(nz)});
402 }
403 
normalPointer(VertexAttribType type,GLsizei stride,const void * ptr)404 void Context::normalPointer(VertexAttribType type, GLsizei stride, const void *ptr)
405 {
406     vertexAttribPointer(vertexArrayIndex(ClientVertexArrayType::Normal), 3, type, GL_FALSE, stride,
407                         ptr);
408 }
409 
orthof(GLfloat left,GLfloat right,GLfloat bottom,GLfloat top,GLfloat zNear,GLfloat zFar)410 void Context::orthof(GLfloat left,
411                      GLfloat right,
412                      GLfloat bottom,
413                      GLfloat top,
414                      GLfloat zNear,
415                      GLfloat zFar)
416 {
417     mState.gles1().multMatrix(angle::Mat4::Ortho(left, right, bottom, top, zNear, zFar));
418 }
419 
orthox(GLfixed l,GLfixed r,GLfixed b,GLfixed t,GLfixed n,GLfixed f)420 void Context::orthox(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f)
421 {
422     mState.gles1().multMatrix(angle::Mat4::Ortho(FixedToFloat(l), FixedToFloat(r), FixedToFloat(b),
423                                                  FixedToFloat(t), FixedToFloat(n),
424                                                  FixedToFloat(f)));
425 }
426 
pointParameterf(PointParameter pname,GLfloat param)427 void Context::pointParameterf(PointParameter pname, GLfloat param)
428 {
429     SetPointParameter(&mState.gles1(), pname, &param);
430 }
431 
pointParameterfv(PointParameter pname,const GLfloat * params)432 void Context::pointParameterfv(PointParameter pname, const GLfloat *params)
433 {
434     SetPointParameter(&mState.gles1(), pname, params);
435 }
436 
pointParameterx(PointParameter pname,GLfixed param)437 void Context::pointParameterx(PointParameter pname, GLfixed param)
438 {
439     GLfloat paramf = FixedToFloat(param);
440     SetPointParameter(&mState.gles1(), pname, &paramf);
441 }
442 
pointParameterxv(PointParameter pname,const GLfixed * params)443 void Context::pointParameterxv(PointParameter pname, const GLfixed *params)
444 {
445     GLfloat paramsf[4] = {};
446     for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
447     {
448         paramsf[i] = FixedToFloat(params[i]);
449     }
450     SetPointParameter(&mState.gles1(), pname, paramsf);
451 }
452 
pointSize(GLfloat size)453 void Context::pointSize(GLfloat size)
454 {
455     SetPointSize(&mState.gles1(), size);
456 }
457 
pointSizex(GLfixed size)458 void Context::pointSizex(GLfixed size)
459 {
460     SetPointSize(&mState.gles1(), FixedToFloat(size));
461 }
462 
polygonOffsetx(GLfixed factor,GLfixed units)463 void Context::polygonOffsetx(GLfixed factor, GLfixed units)
464 {
465     UNIMPLEMENTED();
466 }
467 
popMatrix()468 void Context::popMatrix()
469 {
470     mState.gles1().popMatrix();
471 }
472 
pushMatrix()473 void Context::pushMatrix()
474 {
475     mState.gles1().pushMatrix();
476 }
477 
rotatef(float angle,float x,float y,float z)478 void Context::rotatef(float angle, float x, float y, float z)
479 {
480     mState.gles1().multMatrix(angle::Mat4::Rotate(angle, angle::Vector3(x, y, z)));
481 }
482 
rotatex(GLfixed angle,GLfixed x,GLfixed y,GLfixed z)483 void Context::rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
484 {
485     mState.gles1().multMatrix(angle::Mat4::Rotate(
486         FixedToFloat(angle), angle::Vector3(FixedToFloat(x), FixedToFloat(y), FixedToFloat(z))));
487 }
488 
sampleCoveragex(GLclampx value,GLboolean invert)489 void Context::sampleCoveragex(GLclampx value, GLboolean invert)
490 {
491     UNIMPLEMENTED();
492 }
493 
scalef(float x,float y,float z)494 void Context::scalef(float x, float y, float z)
495 {
496     mState.gles1().multMatrix(angle::Mat4::Scale(angle::Vector3(x, y, z)));
497 }
498 
scalex(GLfixed x,GLfixed y,GLfixed z)499 void Context::scalex(GLfixed x, GLfixed y, GLfixed z)
500 {
501     mState.gles1().multMatrix(
502         angle::Mat4::Scale(angle::Vector3(FixedToFloat(x), FixedToFloat(y), FixedToFloat(z))));
503 }
504 
shadeModel(ShadingModel model)505 void Context::shadeModel(ShadingModel model)
506 {
507     mState.gles1().setShadeModel(model);
508 }
509 
texCoordPointer(GLint size,VertexAttribType type,GLsizei stride,const void * ptr)510 void Context::texCoordPointer(GLint size, VertexAttribType type, GLsizei stride, const void *ptr)
511 {
512     vertexAttribPointer(vertexArrayIndex(ClientVertexArrayType::TextureCoord), size, type, GL_FALSE,
513                         stride, ptr);
514 }
515 
texEnvf(TextureEnvTarget target,TextureEnvParameter pname,GLfloat param)516 void Context::texEnvf(TextureEnvTarget target, TextureEnvParameter pname, GLfloat param)
517 {
518     SetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, &param);
519 }
520 
texEnvfv(TextureEnvTarget target,TextureEnvParameter pname,const GLfloat * params)521 void Context::texEnvfv(TextureEnvTarget target, TextureEnvParameter pname, const GLfloat *params)
522 {
523     SetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, params);
524 }
525 
texEnvi(TextureEnvTarget target,TextureEnvParameter pname,GLint param)526 void Context::texEnvi(TextureEnvTarget target, TextureEnvParameter pname, GLint param)
527 {
528     GLfloat paramsf[4] = {};
529     ConvertTextureEnvFromInt(pname, &param, paramsf);
530     SetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, paramsf);
531 }
532 
texEnviv(TextureEnvTarget target,TextureEnvParameter pname,const GLint * params)533 void Context::texEnviv(TextureEnvTarget target, TextureEnvParameter pname, const GLint *params)
534 {
535     GLfloat paramsf[4] = {};
536     ConvertTextureEnvFromInt(pname, params, paramsf);
537     SetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, paramsf);
538 }
539 
texEnvx(TextureEnvTarget target,TextureEnvParameter pname,GLfixed param)540 void Context::texEnvx(TextureEnvTarget target, TextureEnvParameter pname, GLfixed param)
541 {
542     GLfloat paramsf[4] = {};
543     ConvertTextureEnvFromFixed(pname, &param, paramsf);
544     SetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, paramsf);
545 }
546 
texEnvxv(TextureEnvTarget target,TextureEnvParameter pname,const GLfixed * params)547 void Context::texEnvxv(TextureEnvTarget target, TextureEnvParameter pname, const GLfixed *params)
548 {
549     GLfloat paramsf[4] = {};
550     ConvertTextureEnvFromFixed(pname, params, paramsf);
551     SetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, paramsf);
552 }
553 
texParameterx(TextureType target,GLenum pname,GLfixed param)554 void Context::texParameterx(TextureType target, GLenum pname, GLfixed param)
555 {
556     UNIMPLEMENTED();
557 }
558 
texParameterxv(TextureType target,GLenum pname,const GLfixed * params)559 void Context::texParameterxv(TextureType target, GLenum pname, const GLfixed *params)
560 {
561     UNIMPLEMENTED();
562 }
563 
translatef(float x,float y,float z)564 void Context::translatef(float x, float y, float z)
565 {
566     mState.gles1().multMatrix(angle::Mat4::Translate(angle::Vector3(x, y, z)));
567 }
568 
translatex(GLfixed x,GLfixed y,GLfixed z)569 void Context::translatex(GLfixed x, GLfixed y, GLfixed z)
570 {
571     mState.gles1().multMatrix(
572         angle::Mat4::Translate(angle::Vector3(FixedToFloat(x), FixedToFloat(y), FixedToFloat(z))));
573 }
574 
vertexPointer(GLint size,VertexAttribType type,GLsizei stride,const void * ptr)575 void Context::vertexPointer(GLint size, VertexAttribType type, GLsizei stride, const void *ptr)
576 {
577     vertexAttribPointer(vertexArrayIndex(ClientVertexArrayType::Vertex), size, type, GL_FALSE,
578                         stride, ptr);
579 }
580 
581 // GL_OES_draw_texture
drawTexf(float x,float y,float z,float width,float height)582 void Context::drawTexf(float x, float y, float z, float width, float height)
583 {
584     mGLES1Renderer->drawTexture(this, &mState, x, y, z, width, height);
585 }
586 
drawTexfv(const GLfloat * coords)587 void Context::drawTexfv(const GLfloat *coords)
588 {
589     mGLES1Renderer->drawTexture(this, &mState, coords[0], coords[1], coords[2], coords[3],
590                                 coords[4]);
591 }
592 
drawTexi(GLint x,GLint y,GLint z,GLint width,GLint height)593 void Context::drawTexi(GLint x, GLint y, GLint z, GLint width, GLint height)
594 {
595     mGLES1Renderer->drawTexture(this, &mState, static_cast<GLfloat>(x), static_cast<GLfloat>(y),
596                                 static_cast<GLfloat>(z), static_cast<GLfloat>(width),
597                                 static_cast<GLfloat>(height));
598 }
599 
drawTexiv(const GLint * coords)600 void Context::drawTexiv(const GLint *coords)
601 {
602     mGLES1Renderer->drawTexture(this, &mState, static_cast<GLfloat>(coords[0]),
603                                 static_cast<GLfloat>(coords[1]), static_cast<GLfloat>(coords[2]),
604                                 static_cast<GLfloat>(coords[3]), static_cast<GLfloat>(coords[4]));
605 }
606 
drawTexs(GLshort x,GLshort y,GLshort z,GLshort width,GLshort height)607 void Context::drawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
608 {
609     mGLES1Renderer->drawTexture(this, &mState, static_cast<GLfloat>(x), static_cast<GLfloat>(y),
610                                 static_cast<GLfloat>(z), static_cast<GLfloat>(width),
611                                 static_cast<GLfloat>(height));
612 }
613 
drawTexsv(const GLshort * coords)614 void Context::drawTexsv(const GLshort *coords)
615 {
616     mGLES1Renderer->drawTexture(this, &mState, static_cast<GLfloat>(coords[0]),
617                                 static_cast<GLfloat>(coords[1]), static_cast<GLfloat>(coords[2]),
618                                 static_cast<GLfloat>(coords[3]), static_cast<GLfloat>(coords[4]));
619 }
620 
drawTexx(GLfixed x,GLfixed y,GLfixed z,GLfixed width,GLfixed height)621 void Context::drawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
622 {
623     mGLES1Renderer->drawTexture(this, &mState, FixedToFloat(x), FixedToFloat(y), FixedToFloat(z),
624                                 FixedToFloat(width), FixedToFloat(height));
625 }
626 
drawTexxv(const GLfixed * coords)627 void Context::drawTexxv(const GLfixed *coords)
628 {
629     mGLES1Renderer->drawTexture(this, &mState, FixedToFloat(coords[0]), FixedToFloat(coords[1]),
630                                 FixedToFloat(coords[2]), FixedToFloat(coords[3]),
631                                 FixedToFloat(coords[4]));
632 }
633 
634 // GL_OES_matrix_palette
currentPaletteMatrix(GLuint matrixpaletteindex)635 void Context::currentPaletteMatrix(GLuint matrixpaletteindex)
636 {
637     UNIMPLEMENTED();
638 }
639 
loadPaletteFromModelViewMatrix()640 void Context::loadPaletteFromModelViewMatrix()
641 {
642     UNIMPLEMENTED();
643 }
644 
matrixIndexPointer(GLint size,GLenum type,GLsizei stride,const void * pointer)645 void Context::matrixIndexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
646 {
647     UNIMPLEMENTED();
648 }
649 
weightPointer(GLint size,GLenum type,GLsizei stride,const void * pointer)650 void Context::weightPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
651 {
652     UNIMPLEMENTED();
653 }
654 
655 // GL_OES_point_size_array
pointSizePointer(VertexAttribType type,GLsizei stride,const void * ptr)656 void Context::pointSizePointer(VertexAttribType type, GLsizei stride, const void *ptr)
657 {
658     vertexAttribPointer(vertexArrayIndex(ClientVertexArrayType::PointSize), 1, type, GL_FALSE,
659                         stride, ptr);
660 }
661 
662 // GL_OES_query_matrix
queryMatrixx(GLfixed * mantissa,GLint * exponent)663 GLbitfield Context::queryMatrixx(GLfixed *mantissa, GLint *exponent)
664 {
665     UNIMPLEMENTED();
666     return 0;
667 }
668 
669 // GL_OES_texture_cube_map
getTexGenfv(GLenum coord,GLenum pname,GLfloat * params)670 void Context::getTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
671 {
672     UNIMPLEMENTED();
673 }
674 
getTexGeniv(GLenum coord,GLenum pname,GLint * params)675 void Context::getTexGeniv(GLenum coord, GLenum pname, GLint *params)
676 {
677     UNIMPLEMENTED();
678 }
679 
getTexGenxv(GLenum coord,GLenum pname,GLfixed * params)680 void Context::getTexGenxv(GLenum coord, GLenum pname, GLfixed *params)
681 {
682     UNIMPLEMENTED();
683 }
684 
texGenf(GLenum coord,GLenum pname,GLfloat param)685 void Context::texGenf(GLenum coord, GLenum pname, GLfloat param)
686 {
687     UNIMPLEMENTED();
688 }
689 
texGenfv(GLenum coord,GLenum pname,const GLfloat * params)690 void Context::texGenfv(GLenum coord, GLenum pname, const GLfloat *params)
691 {
692     UNIMPLEMENTED();
693 }
694 
texGeni(GLenum coord,GLenum pname,GLint param)695 void Context::texGeni(GLenum coord, GLenum pname, GLint param)
696 {
697     UNIMPLEMENTED();
698 }
699 
texGeniv(GLenum coord,GLenum pname,const GLint * params)700 void Context::texGeniv(GLenum coord, GLenum pname, const GLint *params)
701 {
702     UNIMPLEMENTED();
703 }
704 
texGenx(GLenum coord,GLenum pname,GLfixed param)705 void Context::texGenx(GLenum coord, GLenum pname, GLfixed param)
706 {
707     UNIMPLEMENTED();
708 }
709 
texGenxv(GLenum coord,GLenum pname,const GLint * params)710 void Context::texGenxv(GLenum coord, GLenum pname, const GLint *params)
711 {
712     UNIMPLEMENTED();
713 }
714 
vertexArrayIndex(ClientVertexArrayType type) const715 int Context::vertexArrayIndex(ClientVertexArrayType type) const
716 {
717     return GLES1Renderer::VertexArrayIndex(type, mState.gles1());
718 }
719 
720 // static
TexCoordArrayIndex(unsigned int unit)721 int Context::TexCoordArrayIndex(unsigned int unit)
722 {
723     return GLES1Renderer::TexCoordArrayIndex(unit);
724 }
725 }  // namespace gl
726