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