1 // Auto-generated with: android/scripts/gen-entries.py --mode=translator_passthrough android/android-emugl/host/libs/libOpenGLESDispatch/gles31_only.entries --output=android/android-emugl/host/libs/Translator/GLES_V2/GLESv31Imp.cpp
2 // This file is best left unedited.
3 // Try to make changes through gen_translator in gen-entries.py,
4 // and/or parcel out custom functionality in separate code.
glGetBooleani_v(GLenum target,GLuint index,GLboolean * data)5 GL_APICALL void GL_APIENTRY glGetBooleani_v(GLenum target, GLuint index, GLboolean * data) {
6     GET_CTX_V2();
7     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glGetBooleani_v);
8     ctx->dispatcher().glGetBooleani_v(target, index, data);
9 }
10 
glMemoryBarrier(GLbitfield barriers)11 GL_APICALL void GL_APIENTRY glMemoryBarrier(GLbitfield barriers) {
12     GET_CTX_V2();
13     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glMemoryBarrier);
14     ctx->dispatcher().glMemoryBarrier(barriers);
15 }
16 
glMemoryBarrierByRegion(GLbitfield barriers)17 GL_APICALL void GL_APIENTRY glMemoryBarrierByRegion(GLbitfield barriers) {
18     GET_CTX_V2();
19     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glMemoryBarrierByRegion);
20     ctx->dispatcher().glMemoryBarrierByRegion(barriers);
21 }
22 
glGenProgramPipelines(GLsizei n,GLuint * pipelines)23 GL_APICALL void GL_APIENTRY glGenProgramPipelines(GLsizei n, GLuint * pipelines) {
24     GET_CTX_V2();
25     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glGenProgramPipelines);
26     SET_ERROR_IF(n < 0,GL_INVALID_VALUE);
27     ctx->dispatcher().glGenProgramPipelines(n, pipelines);
28 }
29 
glDeleteProgramPipelines(GLsizei n,const GLuint * pipelines)30 GL_APICALL void GL_APIENTRY glDeleteProgramPipelines(GLsizei n, const GLuint * pipelines) {
31     GET_CTX_V2();
32     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glDeleteProgramPipelines);
33     SET_ERROR_IF(n < 0,GL_INVALID_VALUE);
34     ctx->dispatcher().glDeleteProgramPipelines(n, pipelines);
35 }
36 
glBindProgramPipeline(GLuint pipeline)37 GL_APICALL void GL_APIENTRY glBindProgramPipeline(GLuint pipeline) {
38     GET_CTX_V2();
39     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glBindProgramPipeline);
40     ctx->dispatcher().glBindProgramPipeline(pipeline);
41 }
42 
glGetProgramPipelineiv(GLuint pipeline,GLenum pname,GLint * params)43 GL_APICALL void GL_APIENTRY glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint * params) {
44     GET_CTX_V2();
45     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glGetProgramPipelineiv);
46     ctx->dispatcher().glGetProgramPipelineiv(pipeline, pname, params);
47 
48     switch (pname) {
49     case GL_ACTIVE_PROGRAM:
50     case GL_VERTEX_SHADER:
51     case GL_FRAGMENT_SHADER:
52     case GL_COMPUTE_SHADER: {
53         GLint programName = *params;
54         GLint localProgramName =
55             ctx->shareGroup()->getLocalName(NamedObjectType::SHADER_OR_PROGRAM, programName);
56         *params = localProgramName;
57         break;
58     }
59     default:
60         break;
61     }
62 }
63 
glGetProgramPipelineInfoLog(GLuint pipeline,GLsizei bufSize,GLsizei * length,GLchar * infoLog)64 GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei * length, GLchar * infoLog) {
65     GET_CTX_V2();
66     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glGetProgramPipelineInfoLog);
67     ctx->dispatcher().glGetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
68 }
69 
glValidateProgramPipeline(GLuint pipeline)70 GL_APICALL void GL_APIENTRY glValidateProgramPipeline(GLuint pipeline) {
71     GET_CTX_V2();
72     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glValidateProgramPipeline);
73     ctx->dispatcher().glValidateProgramPipeline(pipeline);
74 }
75 
glIsProgramPipeline(GLuint pipeline)76 GL_APICALL GLboolean GL_APIENTRY glIsProgramPipeline(GLuint pipeline) {
77     GET_CTX_V2_RET(0);
78     RET_AND_SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glIsProgramPipeline, false);
79     GLboolean glIsProgramPipelineRET = ctx->dispatcher().glIsProgramPipeline(pipeline);
80     return glIsProgramPipelineRET;
81 }
82 
glUseProgramStages(GLuint pipeline,GLbitfield stages,GLuint program)83 GL_APICALL void GL_APIENTRY glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program) {
84     GET_CTX_V2();
85     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glUseProgramStages);
86     if (ctx->shareGroup().get()) {
87         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(NamedObjectType::SHADER_OR_PROGRAM, program);
88         ctx->dispatcher().glUseProgramStages(pipeline, stages, globalProgramName);
89     }
90 }
91 
glActiveShaderProgram(GLuint pipeline,GLuint program)92 GL_APICALL void GL_APIENTRY glActiveShaderProgram(GLuint pipeline, GLuint program) {
93     GET_CTX_V2();
94     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glActiveShaderProgram);
95     if (ctx->shareGroup().get()) {
96         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(NamedObjectType::SHADER_OR_PROGRAM, program);
97         ctx->dispatcher().glActiveShaderProgram(pipeline, globalProgramName);
98     }
99 }
100 
glCreateShaderProgramv(GLenum type,GLsizei count,const char ** strings)101 EXTERN_PART GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramv(GLenum type, GLsizei count, const char ** strings) {
102     GET_CTX_V2_RET(0);
103     RET_AND_SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glCreateShaderProgramv, 0);
104     GLuint glCreateShaderProgramvRET = ctx->dispatcher().glCreateShaderProgramv(type, count, strings);
105 
106     GLint sep = GL_FALSE;
107     GLint linkstatus = GL_FALSE;
108     ctx->dispatcher().glGetProgramiv(glCreateShaderProgramvRET, GL_PROGRAM_SEPARABLE, &sep);
109     ctx->dispatcher().glGetProgramiv(glCreateShaderProgramvRET, GL_LINK_STATUS, &linkstatus);
110 
111     const GLuint localProgramName =
112         ctx->shareGroup()->genName(ShaderProgramType::PROGRAM, 0, true, glCreateShaderProgramvRET);
113 
114     ProgramData* progdata = new ProgramData(ctx->getMajorVersion(), ctx->getMinorVersion());
115     progdata->addProgramName(glCreateShaderProgramvRET);
116     progdata->setHostLinkStatus(linkstatus);
117     progdata->setLinkStatus(GL_TRUE);
118 
119     ctx->shareGroup()->setObjectData(NamedObjectType::SHADER_OR_PROGRAM, localProgramName, ObjectDataPtr(progdata));
120 
121     return localProgramName;
122 }
123 
glProgramUniform1f(GLuint program,GLint location,GLfloat v0)124 GL_APICALL void GL_APIENTRY glProgramUniform1f(GLuint program, GLint location, GLfloat v0) {
125     GET_CTX_V2();
126     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform1f);
127     if (ctx->shareGroup().get()) {
128         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
129         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
130         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
131             NamedObjectType::SHADER_OR_PROGRAM, program);
132         ctx->dispatcher().glProgramUniform1f(globalProgramName, hostLoc, v0);
133     }
134 }
135 
glProgramUniform2f(GLuint program,GLint location,GLfloat v0,GLfloat v1)136 GL_APICALL void GL_APIENTRY glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1) {
137     GET_CTX_V2();
138     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform2f);
139     if (ctx->shareGroup().get()) {
140         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
141         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
142         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
143             NamedObjectType::SHADER_OR_PROGRAM, program);
144         ctx->dispatcher().glProgramUniform2f(globalProgramName, hostLoc, v0, v1);
145     }
146 }
147 
glProgramUniform3f(GLuint program,GLint location,GLfloat v0,GLfloat v1,GLfloat v2)148 GL_APICALL void GL_APIENTRY glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) {
149     GET_CTX_V2();
150     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform3f);
151     if (ctx->shareGroup().get()) {
152         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
153         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
154         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
155             NamedObjectType::SHADER_OR_PROGRAM, program);
156         ctx->dispatcher().glProgramUniform3f(globalProgramName, hostLoc, v0, v1, v2);
157     }
158 }
159 
glProgramUniform4f(GLuint program,GLint location,GLfloat v0,GLfloat v1,GLfloat v2,GLfloat v3)160 GL_APICALL void GL_APIENTRY glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) {
161     GET_CTX_V2();
162     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform4f);
163     if (ctx->shareGroup().get()) {
164         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
165         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
166         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
167             NamedObjectType::SHADER_OR_PROGRAM, program);
168         ctx->dispatcher().glProgramUniform4f(globalProgramName, hostLoc, v0, v1, v2, v3);
169     }
170 }
171 
glProgramUniform1i(GLuint program,GLint location,GLint v0)172 GL_APICALL void GL_APIENTRY glProgramUniform1i(GLuint program, GLint location, GLint v0) {
173     GET_CTX_V2();
174     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform1i);
175     if (ctx->shareGroup().get()) {
176         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
177         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
178         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
179             NamedObjectType::SHADER_OR_PROGRAM, program);
180         ctx->dispatcher().glProgramUniform1i(globalProgramName, hostLoc, v0);
181     }
182 }
183 
glProgramUniform2i(GLuint program,GLint location,GLint v0,GLint v1)184 GL_APICALL void GL_APIENTRY glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1) {
185     GET_CTX_V2();
186     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform2i);
187     if (ctx->shareGroup().get()) {
188         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
189         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
190         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
191             NamedObjectType::SHADER_OR_PROGRAM, program);
192         ctx->dispatcher().glProgramUniform2i(globalProgramName, hostLoc, v0, v1);
193     }
194 }
195 
glProgramUniform3i(GLuint program,GLint location,GLint v0,GLint v1,GLint v2)196 GL_APICALL void GL_APIENTRY glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2) {
197     GET_CTX_V2();
198     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform3i);
199     if (ctx->shareGroup().get()) {
200         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
201         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
202         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
203             NamedObjectType::SHADER_OR_PROGRAM, program);
204         ctx->dispatcher().glProgramUniform3i(globalProgramName, hostLoc, v0, v1, v2);
205     }
206 }
207 
glProgramUniform4i(GLuint program,GLint location,GLint v0,GLint v1,GLint v2,GLint v3)208 GL_APICALL void GL_APIENTRY glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) {
209     GET_CTX_V2();
210     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform4i);
211     if (ctx->shareGroup().get()) {
212         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
213         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
214         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
215             NamedObjectType::SHADER_OR_PROGRAM, program);
216         ctx->dispatcher().glProgramUniform4i(globalProgramName, hostLoc, v0, v1, v2, v3);
217     }
218 }
219 
glProgramUniform1ui(GLuint program,GLint location,GLuint v0)220 GL_APICALL void GL_APIENTRY glProgramUniform1ui(GLuint program, GLint location, GLuint v0) {
221     GET_CTX_V2();
222     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform1ui);
223     if (ctx->shareGroup().get()) {
224         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
225         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
226         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
227             NamedObjectType::SHADER_OR_PROGRAM, program);
228         ctx->dispatcher().glProgramUniform1ui(globalProgramName, hostLoc, v0);
229     }
230 }
231 
glProgramUniform2ui(GLuint program,GLint location,GLint v0,GLuint v1)232 EXTERN_PART GL_APICALL void GL_APIENTRY glProgramUniform2ui(GLuint program, GLint location, GLint v0, GLuint v1) {
233     GET_CTX_V2();
234     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform2ui);
235     if (ctx->shareGroup().get()) {
236         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
237         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
238         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
239             NamedObjectType::SHADER_OR_PROGRAM, program);
240         ctx->dispatcher().glProgramUniform2ui(globalProgramName, hostLoc, v0, v1);
241     }
242 }
243 
glProgramUniform3ui(GLuint program,GLint location,GLint v0,GLint v1,GLuint v2)244 EXTERN_PART GL_APICALL void GL_APIENTRY glProgramUniform3ui(GLuint program, GLint location, GLint v0, GLint v1, GLuint v2) {
245     GET_CTX_V2();
246     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform3ui);
247     if (ctx->shareGroup().get()) {
248         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
249         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
250         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
251             NamedObjectType::SHADER_OR_PROGRAM, program);
252         ctx->dispatcher().glProgramUniform3ui(globalProgramName, hostLoc, v0, v1, v2);
253     }
254 }
255 
glProgramUniform4ui(GLuint program,GLint location,GLint v0,GLint v1,GLint v2,GLuint v3)256 EXTERN_PART GL_APICALL void GL_APIENTRY glProgramUniform4ui(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLuint v3) {
257     GET_CTX_V2();
258     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform4ui);
259     if (ctx->shareGroup().get()) {
260         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
261         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
262         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
263             NamedObjectType::SHADER_OR_PROGRAM, program);
264         ctx->dispatcher().glProgramUniform4ui(globalProgramName, hostLoc, v0, v1, v2, v3);
265     }
266 }
267 
glProgramUniform1fv(GLuint program,GLint location,GLsizei count,const GLfloat * value)268 GL_APICALL void GL_APIENTRY glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat * value) {
269     GET_CTX_V2();
270     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform1fv);
271     if (ctx->shareGroup().get()) {
272         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
273         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
274         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
275             NamedObjectType::SHADER_OR_PROGRAM, program);
276         ctx->dispatcher().glProgramUniform1fv(globalProgramName, hostLoc, count, value);
277     }
278 }
279 
glProgramUniform2fv(GLuint program,GLint location,GLsizei count,const GLfloat * value)280 GL_APICALL void GL_APIENTRY glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat * value) {
281     GET_CTX_V2();
282     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform2fv);
283     if (ctx->shareGroup().get()) {
284         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
285         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
286         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
287             NamedObjectType::SHADER_OR_PROGRAM, program);
288         ctx->dispatcher().glProgramUniform2fv(globalProgramName, hostLoc, count, value);
289     }
290 }
291 
glProgramUniform3fv(GLuint program,GLint location,GLsizei count,const GLfloat * value)292 GL_APICALL void GL_APIENTRY glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat * value) {
293     GET_CTX_V2();
294     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform3fv);
295     if (ctx->shareGroup().get()) {
296         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
297         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
298         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
299             NamedObjectType::SHADER_OR_PROGRAM, program);
300         ctx->dispatcher().glProgramUniform3fv(globalProgramName, hostLoc, count, value);
301     }
302 }
303 
glProgramUniform4fv(GLuint program,GLint location,GLsizei count,const GLfloat * value)304 GL_APICALL void GL_APIENTRY glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat * value) {
305     GET_CTX_V2();
306     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform4fv);
307     if (ctx->shareGroup().get()) {
308         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
309         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
310         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
311             NamedObjectType::SHADER_OR_PROGRAM, program);
312         ctx->dispatcher().glProgramUniform4fv(globalProgramName, hostLoc, count, value);
313     }
314 }
315 
glProgramUniform1iv(GLuint program,GLint location,GLsizei count,const GLint * value)316 GL_APICALL void GL_APIENTRY glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint * value) {
317     GET_CTX_V2();
318     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform1iv);
319     if (ctx->shareGroup().get()) {
320         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
321         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
322         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
323             NamedObjectType::SHADER_OR_PROGRAM, program);
324         ctx->dispatcher().glProgramUniform1iv(globalProgramName, hostLoc, count, value);
325     }
326 }
327 
glProgramUniform2iv(GLuint program,GLint location,GLsizei count,const GLint * value)328 GL_APICALL void GL_APIENTRY glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint * value) {
329     GET_CTX_V2();
330     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform2iv);
331     if (ctx->shareGroup().get()) {
332         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
333         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
334         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
335             NamedObjectType::SHADER_OR_PROGRAM, program);
336         ctx->dispatcher().glProgramUniform2iv(globalProgramName, hostLoc, count, value);
337     }
338 }
339 
glProgramUniform3iv(GLuint program,GLint location,GLsizei count,const GLint * value)340 GL_APICALL void GL_APIENTRY glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint * value) {
341     GET_CTX_V2();
342     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform3iv);
343     if (ctx->shareGroup().get()) {
344         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
345         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
346         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
347             NamedObjectType::SHADER_OR_PROGRAM, program);
348         ctx->dispatcher().glProgramUniform3iv(globalProgramName, hostLoc, count, value);
349     }
350 }
351 
glProgramUniform4iv(GLuint program,GLint location,GLsizei count,const GLint * value)352 GL_APICALL void GL_APIENTRY glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint * value) {
353     GET_CTX_V2();
354     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform4iv);
355     if (ctx->shareGroup().get()) {
356         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
357         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
358         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
359             NamedObjectType::SHADER_OR_PROGRAM, program);
360         ctx->dispatcher().glProgramUniform4iv(globalProgramName, hostLoc, count, value);
361     }
362 }
363 
glProgramUniform1uiv(GLuint program,GLint location,GLsizei count,const GLuint * value)364 GL_APICALL void GL_APIENTRY glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint * value) {
365     GET_CTX_V2();
366     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform1uiv);
367     if (ctx->shareGroup().get()) {
368         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
369         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
370         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
371             NamedObjectType::SHADER_OR_PROGRAM, program);
372         ctx->dispatcher().glProgramUniform1uiv(globalProgramName, hostLoc, count, value);
373     }
374 }
375 
glProgramUniform2uiv(GLuint program,GLint location,GLsizei count,const GLuint * value)376 GL_APICALL void GL_APIENTRY glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint * value) {
377     GET_CTX_V2();
378     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform2uiv);
379     if (ctx->shareGroup().get()) {
380         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
381         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
382         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
383             NamedObjectType::SHADER_OR_PROGRAM, program);
384         ctx->dispatcher().glProgramUniform2uiv(globalProgramName, hostLoc, count, value);
385     }
386 }
387 
glProgramUniform3uiv(GLuint program,GLint location,GLsizei count,const GLuint * value)388 GL_APICALL void GL_APIENTRY glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint * value) {
389     GET_CTX_V2();
390     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform3uiv);
391     if (ctx->shareGroup().get()) {
392         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
393         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
394         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
395             NamedObjectType::SHADER_OR_PROGRAM, program);
396         ctx->dispatcher().glProgramUniform3uiv(globalProgramName, hostLoc, count, value);
397     }
398 }
399 
glProgramUniform4uiv(GLuint program,GLint location,GLsizei count,const GLuint * value)400 GL_APICALL void GL_APIENTRY glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint * value) {
401     GET_CTX_V2();
402     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniform4uiv);
403     if (ctx->shareGroup().get()) {
404         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
405         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
406         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
407             NamedObjectType::SHADER_OR_PROGRAM, program);
408         ctx->dispatcher().glProgramUniform4uiv(globalProgramName, hostLoc, count, value);
409     }
410 }
411 
glProgramUniformMatrix2fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)412 GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) {
413     GET_CTX_V2();
414     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniformMatrix2fv);
415     if (ctx->shareGroup().get()) {
416         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
417         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
418         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
419             NamedObjectType::SHADER_OR_PROGRAM, program);
420         ctx->dispatcher().glProgramUniformMatrix2fv(globalProgramName, hostLoc, count, transpose, value);
421     }
422 }
423 
glProgramUniformMatrix3fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)424 GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) {
425     GET_CTX_V2();
426     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniformMatrix3fv);
427     if (ctx->shareGroup().get()) {
428         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
429         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
430         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
431             NamedObjectType::SHADER_OR_PROGRAM, program);
432         ctx->dispatcher().glProgramUniformMatrix3fv(globalProgramName, hostLoc, count, transpose, value);
433     }
434 }
435 
glProgramUniformMatrix4fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)436 GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) {
437     GET_CTX_V2();
438     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniformMatrix4fv);
439     if (ctx->shareGroup().get()) {
440         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
441         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
442         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
443             NamedObjectType::SHADER_OR_PROGRAM, program);
444         ctx->dispatcher().glProgramUniformMatrix4fv(globalProgramName, hostLoc, count, transpose, value);
445     }
446 }
447 
glProgramUniformMatrix2x3fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)448 GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) {
449     GET_CTX_V2();
450     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniformMatrix2x3fv);
451     if (ctx->shareGroup().get()) {
452         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
453         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
454         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
455             NamedObjectType::SHADER_OR_PROGRAM, program);
456         ctx->dispatcher().glProgramUniformMatrix2x3fv(globalProgramName, hostLoc, count, transpose, value);
457     }
458 }
459 
glProgramUniformMatrix3x2fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)460 GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) {
461     GET_CTX_V2();
462     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniformMatrix3x2fv);
463     if (ctx->shareGroup().get()) {
464         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
465         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
466         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
467             NamedObjectType::SHADER_OR_PROGRAM, program);
468         ctx->dispatcher().glProgramUniformMatrix3x2fv(globalProgramName, hostLoc, count, transpose, value);
469     }
470 }
471 
glProgramUniformMatrix2x4fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)472 GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) {
473     GET_CTX_V2();
474     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniformMatrix2x4fv);
475     if (ctx->shareGroup().get()) {
476         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
477         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
478         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
479             NamedObjectType::SHADER_OR_PROGRAM, program);
480         ctx->dispatcher().glProgramUniformMatrix2x4fv(globalProgramName, hostLoc, count, transpose, value);
481     }
482 }
483 
glProgramUniformMatrix4x2fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)484 GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) {
485     GET_CTX_V2();
486     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniformMatrix4x2fv);
487     if (ctx->shareGroup().get()) {
488         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
489         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
490         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
491             NamedObjectType::SHADER_OR_PROGRAM, program);
492         ctx->dispatcher().glProgramUniformMatrix4x2fv(globalProgramName, hostLoc, count, transpose, value);
493     }
494 }
495 
glProgramUniformMatrix3x4fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)496 GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) {
497     GET_CTX_V2();
498     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniformMatrix3x4fv);
499     if (ctx->shareGroup().get()) {
500         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
501         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
502         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
503             NamedObjectType::SHADER_OR_PROGRAM, program);
504         ctx->dispatcher().glProgramUniformMatrix3x4fv(globalProgramName, hostLoc, count, transpose, value);
505     }
506 }
507 
glProgramUniformMatrix4x3fv(GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)508 GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) {
509     GET_CTX_V2();
510     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glProgramUniformMatrix4x3fv);
511     if (ctx->shareGroup().get()) {
512         int hostLoc = s_getHostLocOrSetError(ctx, program, location);
513         SET_ERROR_IF(hostLoc < -1, GL_INVALID_OPERATION);
514         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(
515             NamedObjectType::SHADER_OR_PROGRAM, program);
516         ctx->dispatcher().glProgramUniformMatrix4x3fv(globalProgramName, location, count, transpose, value);
517     }
518 }
519 
glGetProgramInterfaceiv(GLuint program,GLenum programInterface,GLenum pname,GLint * params)520 GL_APICALL void GL_APIENTRY glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint * params) {
521     GET_CTX_V2();
522     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glGetProgramInterfaceiv);
523     if (ctx->shareGroup().get()) {
524         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(NamedObjectType::SHADER_OR_PROGRAM, program);
525         ctx->dispatcher().glGetProgramInterfaceiv(globalProgramName, programInterface, pname, params);
526     }
527 }
528 
glGetProgramResourceiv(GLuint program,GLenum programInterface,GLuint index,GLsizei propCount,const GLenum * props,GLsizei bufSize,GLsizei * length,GLint * params)529 GL_APICALL void GL_APIENTRY glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum * props, GLsizei bufSize, GLsizei * length, GLint * params) {
530     GET_CTX_V2();
531     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glGetProgramResourceiv);
532     if (ctx->shareGroup().get()) {
533         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(NamedObjectType::SHADER_OR_PROGRAM, program);
534         ctx->dispatcher().glGetProgramResourceiv(globalProgramName, programInterface, index, propCount, props, bufSize, length, params);
535     }
536 }
537 
glGetProgramResourceIndex(GLuint program,GLenum programInterface,const char * name)538 GL_APICALL GLuint GL_APIENTRY glGetProgramResourceIndex(GLuint program, GLenum programInterface, const char * name) {
539     GET_CTX_V2_RET(0);
540     RET_AND_SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glGetProgramResourceIndex, 0);
541     if (ctx->shareGroup().get()) {
542         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(NamedObjectType::SHADER_OR_PROGRAM, program);
543         GLuint glGetProgramResourceIndexRET = ctx->dispatcher().glGetProgramResourceIndex(globalProgramName, programInterface, name);
544     return glGetProgramResourceIndexRET;
545     } else return 0;
546 }
547 
glGetProgramResourceLocation(GLuint program,GLenum programInterface,const char * name)548 GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocation(GLuint program, GLenum programInterface, const char * name) {
549     GET_CTX_V2_RET(0);
550     RET_AND_SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glGetProgramResourceLocation, 0);
551     if (ctx->shareGroup().get()) {
552         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(NamedObjectType::SHADER_OR_PROGRAM, program);
553         GLint glGetProgramResourceLocationRET = ctx->dispatcher().glGetProgramResourceLocation(globalProgramName, programInterface, name);
554     return glGetProgramResourceLocationRET;
555     } else return 0;
556 }
557 
glGetProgramResourceName(GLuint program,GLenum programInterface,GLuint index,GLsizei bufSize,GLsizei * length,char * name)558 GL_APICALL void GL_APIENTRY glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei * length, char * name) {
559     GET_CTX_V2();
560     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glGetProgramResourceName);
561     if (ctx->shareGroup().get()) {
562         const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(NamedObjectType::SHADER_OR_PROGRAM, program);
563         ctx->dispatcher().glGetProgramResourceName(globalProgramName, programInterface, index, bufSize, length, name);
564     }
565 }
566 
glBindImageTexture(GLuint unit,GLuint texture,GLint level,GLboolean layered,GLint layer,GLenum access,GLenum format)567 GL_APICALL void GL_APIENTRY glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) {
568     GET_CTX_V2();
569     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glBindImageTexture);
570     if (ctx->shareGroup().get()) {
571         const GLuint globalTextureName = ctx->shareGroup()->getGlobalName(NamedObjectType::TEXTURE, texture);
572         ctx->dispatcher().glBindImageTexture(unit, globalTextureName, level, layered, layer, access, format);
573     }
574 }
575 
glDispatchCompute(GLuint num_groups_x,GLuint num_groups_y,GLuint num_groups_z)576 GL_APICALL void GL_APIENTRY glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z) {
577     GET_CTX_V2();
578     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glDispatchCompute);
579     ctx->dispatcher().glDispatchCompute(num_groups_x, num_groups_y, num_groups_z);
580 }
581 
glDispatchComputeIndirect(GLintptr indirect)582 GL_APICALL void GL_APIENTRY glDispatchComputeIndirect(GLintptr indirect) {
583     GET_CTX_V2();
584     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glDispatchComputeIndirect);
585     ctx->dispatcher().glDispatchComputeIndirect(indirect);
586 }
587 
glBindVertexBuffer(GLuint bindingindex,GLuint buffer,GLintptr offset,GLintptr stride)588 EXTERN_PART GL_APICALL void GL_APIENTRY glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLintptr stride) {
589     GET_CTX_V2();
590     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glBindVertexBuffer);
591     ctx->bindIndexedBuffer(0, bindingindex, buffer, offset, 0, stride);
592     if (ctx->shareGroup().get()) {
593         const GLuint globalBufferName = ctx->shareGroup()->getGlobalName(NamedObjectType::VERTEXBUFFER, buffer);
594         ctx->dispatcher().glBindVertexBuffer(bindingindex, globalBufferName, offset, stride);
595     }
596 }
597 
glVertexAttribBinding(GLuint attribindex,GLuint bindingindex)598 GL_APICALL void GL_APIENTRY glVertexAttribBinding(GLuint attribindex, GLuint bindingindex) {
599     GET_CTX_V2();
600     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glVertexAttribBinding);
601     ctx->setVertexAttribBindingIndex(attribindex, bindingindex);
602     ctx->dispatcher().glVertexAttribBinding(attribindex, bindingindex);
603 }
604 
glVertexAttribFormat(GLuint attribindex,GLint size,GLenum type,GLboolean normalized,GLuint relativeoffset)605 GL_APICALL void GL_APIENTRY glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset) {
606     GET_CTX_V2();
607     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glVertexAttribFormat);
608     ctx->setVertexAttribFormat(attribindex, size, type, normalized, relativeoffset, false);
609     ctx->dispatcher().glVertexAttribFormat(attribindex, size, type, normalized, relativeoffset);
610 }
611 
glVertexAttribIFormat(GLuint attribindex,GLint size,GLenum type,GLuint relativeoffset)612 GL_APICALL void GL_APIENTRY glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) {
613     GET_CTX_V2();
614     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glVertexAttribIFormat);
615     ctx->setVertexAttribFormat(attribindex, size, type, GL_FALSE, relativeoffset, true);
616     ctx->dispatcher().glVertexAttribIFormat(attribindex, size, type, relativeoffset);
617 }
618 
glVertexBindingDivisor(GLuint bindingindex,GLuint divisor)619 GL_APICALL void GL_APIENTRY glVertexBindingDivisor(GLuint bindingindex, GLuint divisor) {
620     GET_CTX_V2();
621     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glVertexBindingDivisor);
622     ctx->setVertexAttribDivisor(bindingindex, divisor);
623     ctx->dispatcher().glVertexBindingDivisor(bindingindex, divisor);
624 }
625 
glDrawArraysIndirect(GLenum mode,const void * indirect)626 GL_APICALL void GL_APIENTRY glDrawArraysIndirect(GLenum mode, const void * indirect) {
627     GET_CTX_V2();
628     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glDrawArraysIndirect);
629     ctx->dispatcher().glDrawArraysIndirect(mode, indirect);
630 }
631 
glDrawElementsIndirect(GLenum mode,GLenum type,const void * indirect)632 GL_APICALL void GL_APIENTRY glDrawElementsIndirect(GLenum mode, GLenum type, const void * indirect) {
633     GET_CTX_V2();
634     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glDrawElementsIndirect);
635     ctx->dispatcher().glDrawElementsIndirect(mode, type, indirect);
636 }
637 
glTexStorage2DMultisample(GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLboolean fixedsamplelocations)638 GL_APICALL void GL_APIENTRY glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) {
639     GET_CTX_V2();
640     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glTexStorage2DMultisample);
641     GLint err = GL_NO_ERROR;
642     GLenum format, type;
643     GLESv2Validate::getCompatibleFormatTypeForInternalFormat(internalformat, &format, &type);
644 
645     sPrepareTexImage2D(target, 0, (GLint)internalformat, width, height, 0, format, type, samples, NULL, &type, (GLint*)&internalformat, &err);
646     SET_ERROR_IF(err != GL_NO_ERROR, err);
647     ctx->dispatcher().glTexStorage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
648 }
649 
glSampleMaski(GLuint maskNumber,GLbitfield mask)650 GL_APICALL void GL_APIENTRY glSampleMaski(GLuint maskNumber, GLbitfield mask) {
651     GET_CTX_V2();
652     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glSampleMaski);
653     ctx->dispatcher().glSampleMaski(maskNumber, mask);
654 }
655 
glGetMultisamplefv(GLenum pname,GLuint index,GLfloat * val)656 GL_APICALL void GL_APIENTRY glGetMultisamplefv(GLenum pname, GLuint index, GLfloat * val) {
657     GET_CTX_V2();
658     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glGetMultisamplefv);
659     ctx->dispatcher().glGetMultisamplefv(pname, index, val);
660 }
661 
glFramebufferParameteri(GLenum target,GLenum pname,GLint param)662 GL_APICALL void GL_APIENTRY glFramebufferParameteri(GLenum target, GLenum pname, GLint param) {
663     GET_CTX_V2();
664     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glFramebufferParameteri);
665     ctx->dispatcher().glFramebufferParameteri(target, pname, param);
666 }
667 
glGetFramebufferParameteriv(GLenum target,GLenum pname,GLint * params)668 GL_APICALL void GL_APIENTRY glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint * params) {
669     GET_CTX_V2();
670     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glGetFramebufferParameteriv);
671     ctx->dispatcher().glGetFramebufferParameteriv(target, pname, params);
672 }
673 
glGetTexLevelParameterfv(GLenum target,GLint level,GLenum pname,GLfloat * params)674 GL_APICALL void GL_APIENTRY glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat * params) {
675     GET_CTX_V2();
676     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glGetTexLevelParameterfv);
677     ctx->dispatcher().glGetTexLevelParameterfv(target, level, pname, params);
678 
679     if (!ctx->shareGroup().get()) return;
680 
681     TextureData* texData = getTextureTargetData(target);
682 
683     if (!texData) return;
684 
685     switch (pname) {
686     case GL_TEXTURE_INTERNAL_FORMAT:
687         // Need the correct internal format if the texture has not been initialized at all yet.
688         if (!texData->hasStorage) {
689             *params = texData->internalFormat;
690         }
691 
692         if (texData->compressed) {
693             *params = texData->compressedFormat;
694         }
695         break;
696     case GL_TEXTURE_COMPRESSED:
697         if (texData->compressed) {
698             *params = GL_TRUE;
699         }
700         break;
701     case GL_TEXTURE_BUFFER_DATA_STORE_BINDING:
702         *params = static_cast<GLfloat>(ctx->shareGroup()->getLocalName(
703             NamedObjectType::VERTEXBUFFER, static_cast<unsigned int>(*params)));
704         break;
705     default:
706         break;
707     }
708 }
709 
glGetTexLevelParameteriv(GLenum target,GLint level,GLenum pname,GLint * params)710 GL_APICALL void GL_APIENTRY glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint * params) {
711     GET_CTX_V2();
712     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glGetTexLevelParameteriv);
713     ctx->dispatcher().glGetTexLevelParameteriv(target, level, pname, params);
714 
715     if (!ctx->shareGroup().get()) return;
716 
717     TextureData* texData = getTextureTargetData(target);
718 
719     if (!texData) return;
720 
721     switch (pname) {
722     case GL_TEXTURE_INTERNAL_FORMAT:
723         // Need the correct internal format if the texture has not been initialized at all yet.
724         if (!texData->hasStorage) {
725             *params = texData->internalFormat;
726         }
727 
728         if (texData->compressed) {
729             *params = texData->compressedFormat;
730         }
731         break;
732     case GL_TEXTURE_COMPRESSED:
733         if (texData->compressed) {
734             *params = GL_TRUE;
735         }
736         break;
737     case GL_TEXTURE_BUFFER_DATA_STORE_BINDING:
738         *params = ctx->shareGroup()->getLocalName(NamedObjectType::VERTEXBUFFER, *params);
739         break;
740     default:
741         break;
742     }
743 }
744 
745 
glTexBufferOES(GLenum target,GLenum internalformat,GLuint buffer)746 GL_APICALL void GL_APIENTRY glTexBufferOES(GLenum target, GLenum internalformat, GLuint buffer) {
747     GET_CTX_V2();
748     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glTexBufferOES);
749     if (ctx->shareGroup().get()) {
750         const GLuint globalBufferName =
751             ctx->shareGroup()->getGlobalName(NamedObjectType::VERTEXBUFFER, buffer);
752         ctx->dispatcher().glTexBufferOES(target, internalformat, globalBufferName);
753         TextureData* texData = getTextureTargetData(target);
754         texData->internalFormat = internalformat;
755         texData->makeDirty();
756     }
757 }
758 
glTexBufferEXT(GLenum target,GLenum internalformat,GLuint buffer)759 GL_APICALL void GL_APIENTRY glTexBufferEXT(GLenum target, GLenum internalformat, GLuint buffer) {
760     GET_CTX_V2();
761     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glTexBufferEXT);
762     if (ctx->shareGroup().get()) {
763         const GLuint globalBufferName =
764             ctx->shareGroup()->getGlobalName(NamedObjectType::VERTEXBUFFER, buffer);
765         ctx->dispatcher().glTexBufferEXT(target, internalformat, globalBufferName);
766         TextureData* texData = getTextureTargetData(target);
767         texData->internalFormat = internalformat;
768         texData->makeDirty();
769     }
770 }
771 
glTexBufferRangeOES(GLenum target,GLenum internalformat,GLuint buffer,GLintptr offset,GLsizeiptr size)772 GL_APICALL void GL_APIENTRY glTexBufferRangeOES(GLenum target, GLenum internalformat, GLuint buffer,
773                                                 GLintptr offset, GLsizeiptr size) {
774     GET_CTX_V2();
775     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glTexBufferRangeOES);
776     if (ctx->shareGroup().get()) {
777         const GLuint globalBufferName =
778             ctx->shareGroup()->getGlobalName(NamedObjectType::VERTEXBUFFER, buffer);
779         ctx->dispatcher().glTexBufferRangeOES(target, internalformat, globalBufferName, offset, size);
780         TextureData* texData = getTextureTargetData(target);
781         texData->internalFormat = internalformat;
782         texData->makeDirty();
783     }
784 }
785 
glTexBufferRangeEXT(GLenum target,GLenum internalformat,GLuint buffer,GLintptr offset,GLsizeiptr size)786 GL_APICALL void GL_APIENTRY glTexBufferRangeEXT(GLenum target, GLenum internalformat, GLuint buffer,
787                                                 GLintptr offset, GLsizeiptr size) {
788     GET_CTX_V2();
789     SET_ERROR_IF_DISPATCHER_NOT_SUPPORT(glTexBufferRangeEXT);
790     if (ctx->shareGroup().get()) {
791         const GLuint globalBufferName =
792             ctx->shareGroup()->getGlobalName(NamedObjectType::VERTEXBUFFER, buffer);
793         ctx->dispatcher().glTexBufferRangeEXT(target, internalformat, globalBufferName, offset,size);
794         TextureData* texData = getTextureTargetData(target);
795         texData->internalFormat = internalformat;
796         texData->makeDirty();
797     }
798 }
799 
800