1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by generate_entry_points.py using data from gl.xml.
3 //
4 // Copyright 2020 The ANGLE Project Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style license that can be
6 // found in the LICENSE file.
7 //
8 // entry_points_gl_1_5_autogen.cpp:
9 //   Defines the GL 1.5 entry points.
10 
11 #include "libGL/entry_points_gl_1_5_autogen.h"
12 
13 #include "libANGLE/Context.h"
14 #include "libANGLE/Context.inl.h"
15 #include "libANGLE/entry_points_utils.h"
16 #include "libANGLE/gl_enum_utils.h"
17 #include "libANGLE/validationEGL.h"
18 #include "libANGLE/validationES.h"
19 #include "libANGLE/validationES1.h"
20 #include "libANGLE/validationES2.h"
21 #include "libANGLE/validationES3.h"
22 #include "libANGLE/validationES31.h"
23 #include "libANGLE/validationES32.h"
24 #include "libANGLE/validationESEXT.h"
25 #include "libANGLE/validationGL15_autogen.h"
26 #include "libGLESv2/global_state.h"
27 
28 namespace gl
29 {
BeginQuery(GLenum target,GLuint id)30 void GL_APIENTRY BeginQuery(GLenum target, GLuint id)
31 {
32     Context *context = GetValidGlobalContext();
33     EVENT(context, gl::EntryPoint::BeginQuery, "glBeginQuery", "context = %d, target = %s, id = %u",
34           CID(context), GLenumToString(GLenumGroup::QueryTarget, target), id);
35 
36     if (context)
37     {
38         QueryType targetPacked                                = FromGL<QueryType>(target);
39         QueryID idPacked                                      = FromGL<QueryID>(id);
40         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
41         bool isCallValid =
42             (context->skipValidation() || ValidateBeginQuery(context, targetPacked, idPacked));
43         if (isCallValid)
44         {
45             context->beginQuery(targetPacked, idPacked);
46         }
47         ANGLE_CAPTURE(BeginQuery, isCallValid, context, targetPacked, idPacked);
48     }
49     else
50     {
51         GenerateContextLostErrorOnCurrentGlobalContext();
52     }
53 }
54 
BindBuffer(GLenum target,GLuint buffer)55 void GL_APIENTRY BindBuffer(GLenum target, GLuint buffer)
56 {
57     Context *context = GetValidGlobalContext();
58     EVENT(context, gl::EntryPoint::BindBuffer, "glBindBuffer",
59           "context = %d, target = %s, buffer = %u", CID(context),
60           GLenumToString(GLenumGroup::BufferTargetARB, target), buffer);
61 
62     if (context)
63     {
64         BufferBinding targetPacked                            = FromGL<BufferBinding>(target);
65         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
66         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
67         bool isCallValid =
68             (context->skipValidation() || ValidateBindBuffer(context, targetPacked, bufferPacked));
69         if (isCallValid)
70         {
71             context->bindBuffer(targetPacked, bufferPacked);
72         }
73         ANGLE_CAPTURE(BindBuffer, isCallValid, context, targetPacked, bufferPacked);
74     }
75     else
76     {
77         GenerateContextLostErrorOnCurrentGlobalContext();
78     }
79 }
80 
BufferData(GLenum target,GLsizeiptr size,const void * data,GLenum usage)81 void GL_APIENTRY BufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage)
82 {
83     Context *context = GetValidGlobalContext();
84     EVENT(context, gl::EntryPoint::BufferData, "glBufferData",
85           "context = %d, target = %s, size = %llu, data = 0x%016" PRIxPTR ", usage = %s",
86           CID(context), GLenumToString(GLenumGroup::BufferTargetARB, target),
87           static_cast<unsigned long long>(size), (uintptr_t)data,
88           GLenumToString(GLenumGroup::BufferUsageARB, usage));
89 
90     if (context)
91     {
92         BufferBinding targetPacked                            = FromGL<BufferBinding>(target);
93         BufferUsage usagePacked                               = FromGL<BufferUsage>(usage);
94         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
95         bool isCallValid                                      = (context->skipValidation() ||
96                             ValidateBufferData(context, targetPacked, size, data, usagePacked));
97         if (isCallValid)
98         {
99             context->bufferData(targetPacked, size, data, usagePacked);
100         }
101         ANGLE_CAPTURE(BufferData, isCallValid, context, targetPacked, size, data, usagePacked);
102     }
103     else
104     {
105         GenerateContextLostErrorOnCurrentGlobalContext();
106     }
107 }
108 
BufferSubData(GLenum target,GLintptr offset,GLsizeiptr size,const void * data)109 void GL_APIENTRY BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data)
110 {
111     Context *context = GetValidGlobalContext();
112     EVENT(context, gl::EntryPoint::BufferSubData, "glBufferSubData",
113           "context = %d, target = %s, offset = %llu, size = %llu, data = 0x%016" PRIxPTR "",
114           CID(context), GLenumToString(GLenumGroup::BufferTargetARB, target),
115           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size),
116           (uintptr_t)data);
117 
118     if (context)
119     {
120         BufferBinding targetPacked                            = FromGL<BufferBinding>(target);
121         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
122         bool isCallValid                                      = (context->skipValidation() ||
123                             ValidateBufferSubData(context, targetPacked, offset, size, data));
124         if (isCallValid)
125         {
126             context->bufferSubData(targetPacked, offset, size, data);
127         }
128         ANGLE_CAPTURE(BufferSubData, isCallValid, context, targetPacked, offset, size, data);
129     }
130     else
131     {
132         GenerateContextLostErrorOnCurrentGlobalContext();
133     }
134 }
135 
DeleteBuffers(GLsizei n,const GLuint * buffers)136 void GL_APIENTRY DeleteBuffers(GLsizei n, const GLuint *buffers)
137 {
138     Context *context = GetValidGlobalContext();
139     EVENT(context, gl::EntryPoint::DeleteBuffers, "glDeleteBuffers",
140           "context = %d, n = %d, buffers = 0x%016" PRIxPTR "", CID(context), n, (uintptr_t)buffers);
141 
142     if (context)
143     {
144         const BufferID *buffersPacked                         = FromGL<const BufferID *>(buffers);
145         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
146         bool isCallValid =
147             (context->skipValidation() || ValidateDeleteBuffers(context, n, buffersPacked));
148         if (isCallValid)
149         {
150             context->deleteBuffers(n, buffersPacked);
151         }
152         ANGLE_CAPTURE(DeleteBuffers, isCallValid, context, n, buffersPacked);
153     }
154     else
155     {
156         GenerateContextLostErrorOnCurrentGlobalContext();
157     }
158 }
159 
DeleteQueries(GLsizei n,const GLuint * ids)160 void GL_APIENTRY DeleteQueries(GLsizei n, const GLuint *ids)
161 {
162     Context *context = GetValidGlobalContext();
163     EVENT(context, gl::EntryPoint::DeleteQueries, "glDeleteQueries",
164           "context = %d, n = %d, ids = 0x%016" PRIxPTR "", CID(context), n, (uintptr_t)ids);
165 
166     if (context)
167     {
168         const QueryID *idsPacked                              = FromGL<const QueryID *>(ids);
169         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
170         bool isCallValid =
171             (context->skipValidation() || ValidateDeleteQueries(context, n, idsPacked));
172         if (isCallValid)
173         {
174             context->deleteQueries(n, idsPacked);
175         }
176         ANGLE_CAPTURE(DeleteQueries, isCallValid, context, n, idsPacked);
177     }
178     else
179     {
180         GenerateContextLostErrorOnCurrentGlobalContext();
181     }
182 }
183 
EndQuery(GLenum target)184 void GL_APIENTRY EndQuery(GLenum target)
185 {
186     Context *context = GetValidGlobalContext();
187     EVENT(context, gl::EntryPoint::EndQuery, "glEndQuery", "context = %d, target = %s",
188           CID(context), GLenumToString(GLenumGroup::QueryTarget, target));
189 
190     if (context)
191     {
192         QueryType targetPacked                                = FromGL<QueryType>(target);
193         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
194         bool isCallValid = (context->skipValidation() || ValidateEndQuery(context, targetPacked));
195         if (isCallValid)
196         {
197             context->endQuery(targetPacked);
198         }
199         ANGLE_CAPTURE(EndQuery, isCallValid, context, targetPacked);
200     }
201     else
202     {
203         GenerateContextLostErrorOnCurrentGlobalContext();
204     }
205 }
206 
GenBuffers(GLsizei n,GLuint * buffers)207 void GL_APIENTRY GenBuffers(GLsizei n, GLuint *buffers)
208 {
209     Context *context = GetValidGlobalContext();
210     EVENT(context, gl::EntryPoint::GenBuffers, "glGenBuffers",
211           "context = %d, n = %d, buffers = 0x%016" PRIxPTR "", CID(context), n, (uintptr_t)buffers);
212 
213     if (context)
214     {
215         BufferID *buffersPacked                               = FromGL<BufferID *>(buffers);
216         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
217         bool isCallValid =
218             (context->skipValidation() || ValidateGenBuffers(context, n, buffersPacked));
219         if (isCallValid)
220         {
221             context->genBuffers(n, buffersPacked);
222         }
223         ANGLE_CAPTURE(GenBuffers, isCallValid, context, n, buffersPacked);
224     }
225     else
226     {
227         GenerateContextLostErrorOnCurrentGlobalContext();
228     }
229 }
230 
GenQueries(GLsizei n,GLuint * ids)231 void GL_APIENTRY GenQueries(GLsizei n, GLuint *ids)
232 {
233     Context *context = GetValidGlobalContext();
234     EVENT(context, gl::EntryPoint::GenQueries, "glGenQueries",
235           "context = %d, n = %d, ids = 0x%016" PRIxPTR "", CID(context), n, (uintptr_t)ids);
236 
237     if (context)
238     {
239         QueryID *idsPacked                                    = FromGL<QueryID *>(ids);
240         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
241         bool isCallValid = (context->skipValidation() || ValidateGenQueries(context, n, idsPacked));
242         if (isCallValid)
243         {
244             context->genQueries(n, idsPacked);
245         }
246         ANGLE_CAPTURE(GenQueries, isCallValid, context, n, idsPacked);
247     }
248     else
249     {
250         GenerateContextLostErrorOnCurrentGlobalContext();
251     }
252 }
253 
GetBufferParameteriv(GLenum target,GLenum pname,GLint * params)254 void GL_APIENTRY GetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
255 {
256     Context *context = GetValidGlobalContext();
257     EVENT(context, gl::EntryPoint::GetBufferParameteriv, "glGetBufferParameteriv",
258           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
259           GLenumToString(GLenumGroup::BufferTargetARB, target),
260           GLenumToString(GLenumGroup::DefaultGroup, pname), (uintptr_t)params);
261 
262     if (context)
263     {
264         BufferBinding targetPacked                            = FromGL<BufferBinding>(target);
265         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
266         bool isCallValid                                      = (context->skipValidation() ||
267                             ValidateGetBufferParameteriv(context, targetPacked, pname, params));
268         if (isCallValid)
269         {
270             context->getBufferParameteriv(targetPacked, pname, params);
271         }
272         ANGLE_CAPTURE(GetBufferParameteriv, isCallValid, context, targetPacked, pname, params);
273     }
274     else
275     {
276         GenerateContextLostErrorOnCurrentGlobalContext();
277     }
278 }
279 
GetBufferPointerv(GLenum target,GLenum pname,void ** params)280 void GL_APIENTRY GetBufferPointerv(GLenum target, GLenum pname, void **params)
281 {
282     Context *context = GetValidGlobalContext();
283     EVENT(context, gl::EntryPoint::GetBufferPointerv, "glGetBufferPointerv",
284           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
285           GLenumToString(GLenumGroup::BufferTargetARB, target),
286           GLenumToString(GLenumGroup::DefaultGroup, pname), (uintptr_t)params);
287 
288     if (context)
289     {
290         BufferBinding targetPacked                            = FromGL<BufferBinding>(target);
291         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
292         bool isCallValid                                      = (context->skipValidation() ||
293                             ValidateGetBufferPointerv(context, targetPacked, pname, params));
294         if (isCallValid)
295         {
296             context->getBufferPointerv(targetPacked, pname, params);
297         }
298         ANGLE_CAPTURE(GetBufferPointerv, isCallValid, context, targetPacked, pname, params);
299     }
300     else
301     {
302         GenerateContextLostErrorOnCurrentGlobalContext();
303     }
304 }
305 
GetBufferSubData(GLenum target,GLintptr offset,GLsizeiptr size,void * data)306 void GL_APIENTRY GetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void *data)
307 {
308     Context *context = GetValidGlobalContext();
309     EVENT(context, gl::EntryPoint::GetBufferSubData, "glGetBufferSubData",
310           "context = %d, target = %s, offset = %llu, size = %llu, data = 0x%016" PRIxPTR "",
311           CID(context), GLenumToString(GLenumGroup::BufferTargetARB, target),
312           static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size),
313           (uintptr_t)data);
314 
315     if (context)
316     {
317         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
318         bool isCallValid                                      = (context->skipValidation() ||
319                             ValidateGetBufferSubData(context, target, offset, size, data));
320         if (isCallValid)
321         {
322             context->getBufferSubData(target, offset, size, data);
323         }
324         ANGLE_CAPTURE(GetBufferSubData, isCallValid, context, target, offset, size, data);
325     }
326     else
327     {
328         GenerateContextLostErrorOnCurrentGlobalContext();
329     }
330 }
331 
GetQueryObjectiv(GLuint id,GLenum pname,GLint * params)332 void GL_APIENTRY GetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
333 {
334     Context *context = GetGlobalContext();
335     EVENT(context, gl::EntryPoint::GetQueryObjectiv, "glGetQueryObjectiv",
336           "context = %d, id = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), id,
337           GLenumToString(GLenumGroup::QueryObjectParameterName, pname), (uintptr_t)params);
338 
339     if (context)
340     {
341         QueryID idPacked                                      = FromGL<QueryID>(id);
342         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
343         bool isCallValid                                      = (context->skipValidation() ||
344                             ValidateGetQueryObjectiv(context, idPacked, pname, params));
345         if (isCallValid)
346         {
347             context->getQueryObjectiv(idPacked, pname, params);
348         }
349         ANGLE_CAPTURE(GetQueryObjectiv, isCallValid, context, idPacked, pname, params);
350     }
351     else
352     {}
353 }
354 
GetQueryObjectuiv(GLuint id,GLenum pname,GLuint * params)355 void GL_APIENTRY GetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
356 {
357     Context *context = GetValidGlobalContext();
358     EVENT(context, gl::EntryPoint::GetQueryObjectuiv, "glGetQueryObjectuiv",
359           "context = %d, id = %u, pname = %s, params = 0x%016" PRIxPTR "", CID(context), id,
360           GLenumToString(GLenumGroup::QueryObjectParameterName, pname), (uintptr_t)params);
361 
362     if (context)
363     {
364         QueryID idPacked                                      = FromGL<QueryID>(id);
365         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
366         bool isCallValid                                      = (context->skipValidation() ||
367                             ValidateGetQueryObjectuiv(context, idPacked, pname, params));
368         if (isCallValid)
369         {
370             context->getQueryObjectuiv(idPacked, pname, params);
371         }
372         ANGLE_CAPTURE(GetQueryObjectuiv, isCallValid, context, idPacked, pname, params);
373     }
374     else
375     {
376         GenerateContextLostErrorOnCurrentGlobalContext();
377     }
378 }
379 
GetQueryiv(GLenum target,GLenum pname,GLint * params)380 void GL_APIENTRY GetQueryiv(GLenum target, GLenum pname, GLint *params)
381 {
382     Context *context = GetValidGlobalContext();
383     EVENT(context, gl::EntryPoint::GetQueryiv, "glGetQueryiv",
384           "context = %d, target = %s, pname = %s, params = 0x%016" PRIxPTR "", CID(context),
385           GLenumToString(GLenumGroup::QueryTarget, target),
386           GLenumToString(GLenumGroup::QueryParameterName, pname), (uintptr_t)params);
387 
388     if (context)
389     {
390         QueryType targetPacked                                = FromGL<QueryType>(target);
391         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
392         bool isCallValid =
393             (context->skipValidation() || ValidateGetQueryiv(context, targetPacked, pname, params));
394         if (isCallValid)
395         {
396             context->getQueryiv(targetPacked, pname, params);
397         }
398         ANGLE_CAPTURE(GetQueryiv, isCallValid, context, targetPacked, pname, params);
399     }
400     else
401     {
402         GenerateContextLostErrorOnCurrentGlobalContext();
403     }
404 }
405 
IsBuffer(GLuint buffer)406 GLboolean GL_APIENTRY IsBuffer(GLuint buffer)
407 {
408     Context *context = GetValidGlobalContext();
409     EVENT(context, gl::EntryPoint::IsBuffer, "glIsBuffer", "context = %d, buffer = %u",
410           CID(context), buffer);
411 
412     GLboolean returnValue;
413     if (context)
414     {
415         BufferID bufferPacked                                 = FromGL<BufferID>(buffer);
416         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
417         bool isCallValid = (context->skipValidation() || ValidateIsBuffer(context, bufferPacked));
418         if (isCallValid)
419         {
420             returnValue = context->isBuffer(bufferPacked);
421         }
422         else
423         {
424             returnValue = GetDefaultReturnValue<EntryPoint::IsBuffer, GLboolean>();
425         }
426         ANGLE_CAPTURE(IsBuffer, isCallValid, context, bufferPacked, returnValue);
427     }
428     else
429     {
430         GenerateContextLostErrorOnCurrentGlobalContext();
431         returnValue = GetDefaultReturnValue<EntryPoint::IsBuffer, GLboolean>();
432     }
433     return returnValue;
434 }
435 
IsQuery(GLuint id)436 GLboolean GL_APIENTRY IsQuery(GLuint id)
437 {
438     Context *context = GetValidGlobalContext();
439     EVENT(context, gl::EntryPoint::IsQuery, "glIsQuery", "context = %d, id = %u", CID(context), id);
440 
441     GLboolean returnValue;
442     if (context)
443     {
444         QueryID idPacked                                      = FromGL<QueryID>(id);
445         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
446         bool isCallValid = (context->skipValidation() || ValidateIsQuery(context, idPacked));
447         if (isCallValid)
448         {
449             returnValue = context->isQuery(idPacked);
450         }
451         else
452         {
453             returnValue = GetDefaultReturnValue<EntryPoint::IsQuery, GLboolean>();
454         }
455         ANGLE_CAPTURE(IsQuery, isCallValid, context, idPacked, returnValue);
456     }
457     else
458     {
459         GenerateContextLostErrorOnCurrentGlobalContext();
460         returnValue = GetDefaultReturnValue<EntryPoint::IsQuery, GLboolean>();
461     }
462     return returnValue;
463 }
464 
MapBuffer(GLenum target,GLenum access)465 void *GL_APIENTRY MapBuffer(GLenum target, GLenum access)
466 {
467     Context *context = GetValidGlobalContext();
468     EVENT(context, gl::EntryPoint::MapBuffer, "glMapBuffer",
469           "context = %d, target = %s, access = %s", CID(context),
470           GLenumToString(GLenumGroup::BufferTargetARB, target),
471           GLenumToString(GLenumGroup::BufferAccessARB, access));
472 
473     void *returnValue;
474     if (context)
475     {
476         BufferBinding targetPacked                            = FromGL<BufferBinding>(target);
477         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
478         bool isCallValid =
479             (context->skipValidation() || ValidateMapBuffer(context, targetPacked, access));
480         if (isCallValid)
481         {
482             returnValue = context->mapBuffer(targetPacked, access);
483         }
484         else
485         {
486             returnValue = GetDefaultReturnValue<EntryPoint::MapBuffer, void *>();
487         }
488         ANGLE_CAPTURE(MapBuffer, isCallValid, context, targetPacked, access, returnValue);
489     }
490     else
491     {
492         GenerateContextLostErrorOnCurrentGlobalContext();
493         returnValue = GetDefaultReturnValue<EntryPoint::MapBuffer, void *>();
494     }
495     return returnValue;
496 }
497 
UnmapBuffer(GLenum target)498 GLboolean GL_APIENTRY UnmapBuffer(GLenum target)
499 {
500     Context *context = GetValidGlobalContext();
501     EVENT(context, gl::EntryPoint::UnmapBuffer, "glUnmapBuffer", "context = %d, target = %s",
502           CID(context), GLenumToString(GLenumGroup::BufferTargetARB, target));
503 
504     GLboolean returnValue;
505     if (context)
506     {
507         BufferBinding targetPacked                            = FromGL<BufferBinding>(target);
508         std::unique_lock<angle::GlobalMutex> shareContextLock = GetShareGroupLock(context);
509         bool isCallValid =
510             (context->skipValidation() || ValidateUnmapBuffer(context, targetPacked));
511         if (isCallValid)
512         {
513             returnValue = context->unmapBuffer(targetPacked);
514         }
515         else
516         {
517             returnValue = GetDefaultReturnValue<EntryPoint::UnmapBuffer, GLboolean>();
518         }
519         ANGLE_CAPTURE(UnmapBuffer, isCallValid, context, targetPacked, returnValue);
520     }
521     else
522     {
523         GenerateContextLostErrorOnCurrentGlobalContext();
524         returnValue = GetDefaultReturnValue<EntryPoint::UnmapBuffer, GLboolean>();
525     }
526     return returnValue;
527 }
528 }  // namespace gl
529