1 /*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 #ifndef _GL2_ENCODER_H_
17 #define _GL2_ENCODER_H_
18 
19 #include <vector>
20 
21 #include "gl2_enc.h"
22 #include "GLClientState.h"
23 #include "GLSharedGroup.h"
24 
25 #include <string>
26 #include <vector>
27 
28 class GL2Encoder : public gl2_encoder_context_t {
29 public:
30     GL2Encoder(IOStream *stream, ChecksumCalculator* protocol);
31     virtual ~GL2Encoder();
setDrawCallFlushInterval(uint32_t interval)32     void setDrawCallFlushInterval(uint32_t interval) {
33         m_drawCallFlushInterval = interval;
34     }
setHasAsyncUnmapBuffer(int version)35     void setHasAsyncUnmapBuffer(int version) {
36         m_hasAsyncUnmapBuffer = version;
37     }
setNoHostError(bool noHostError)38     void setNoHostError(bool noHostError) {
39         m_noHostError = noHostError;
40     }
setClientState(GLClientState * state)41     void setClientState(GLClientState *state) {
42         m_state = state;
43     }
setVersion(int major,int minor,int deviceMajor,int deviceMinor)44     void setVersion(int major, int minor,
45                     int deviceMajor, int deviceMinor) {
46         m_currMajorVersion = major;
47         m_currMinorVersion = minor;
48         m_deviceMajorVersion = deviceMajor;
49         m_deviceMinorVersion = deviceMinor;
50     }
setClientStateMakeCurrent(GLClientState * state,int majorVersion,int minorVersion,int deviceMajorVersion,int deviceMinorVersion)51     void setClientStateMakeCurrent(GLClientState *state,
52                                    int majorVersion,
53                                    int minorVersion,
54                                    int deviceMajorVersion,
55                                    int deviceMinorVersion) {
56         m_state = state;
57         m_state->fromMakeCurrent();
58         m_currMajorVersion = majorVersion;
59         m_currMinorVersion = minorVersion;
60         m_deviceMajorVersion = deviceMajorVersion;
61         m_deviceMinorVersion = deviceMinorVersion;
62     }
setSharedGroup(GLSharedGroupPtr shared)63     void setSharedGroup(GLSharedGroupPtr shared) {
64         m_shared = shared;
65         if (m_state && m_shared.Ptr())
66             m_state->setTextureData(m_shared->getTextureData());
67     }
majorVersion()68     int majorVersion() const { return m_currMajorVersion; }
minorVersion()69     int minorVersion() const { return m_currMinorVersion; }
setExtensions(const char * exts,const std::vector<std::string> & extArray)70     void setExtensions(const char* exts,
71                        const std::vector<std::string>& extArray) {
72         m_currExtensions = std::string(exts);
73         m_currExtensionsArray = extArray;
74     }
hasExtension(const char * ext)75     bool hasExtension(const char* ext) const {
76         return m_currExtensions.find(ext) != std::string::npos;
77     }
state()78     const GLClientState *state() { return m_state; }
shared()79     const GLSharedGroupPtr shared() { return m_shared; }
flush()80     void flush() { m_stream->flush(); }
81 
setInitialized()82     void setInitialized(){ m_initialized = true; };
isInitialized()83     bool isInitialized(){ return m_initialized; };
84 
setError(GLenum error)85     virtual void setError(GLenum error){ m_error = error; };
getError()86     virtual GLenum getError() { return m_error; };
87 
88     void override2DTextureTarget(GLenum target);
89     void restore2DTextureTarget(GLenum target);
90     void associateEGLImage(GLenum target, GLeglImageOES eglImage);
91 
92     // Convenience functions for buffers
93     GLuint boundBuffer(GLenum target) const;
94     BufferData* getBufferData(GLenum target) const;
95     BufferData* getBufferDataById(GLuint buffer) const;
96     bool isBufferMapped(GLuint buffer) const;
97     bool isBufferTargetMapped(GLenum target) const;
98 
99 private:
100 
101     int m_currMajorVersion;
102     int m_currMinorVersion;
103     int m_deviceMajorVersion;
104     int m_deviceMinorVersion;
105     std::string m_currExtensions;
106     std::vector<std::string> m_currExtensionsArray;
107 
108     bool    m_hasAsyncUnmapBuffer;
109     bool    m_initialized;
110     bool    m_noHostError;
111     GLClientState *m_state;
112     GLSharedGroupPtr m_shared;
113     GLenum  m_error;
114 
115     GLint *m_compressedTextureFormats;
116     GLint m_num_compressedTextureFormats;
117     GLint *getCompressedTextureFormats();
118 
119     GLint m_max_combinedTextureImageUnits;
120     GLint m_max_vertexTextureImageUnits;
121     GLint m_max_textureImageUnits;
122     GLint m_max_cubeMapTextureSize;
123     GLint m_max_renderBufferSize;
124     GLint m_max_textureSize;
125     GLint m_max_3d_textureSize;
126     GLint m_max_vertexAttribStride;
127 
128     GLint m_max_transformFeedbackSeparateAttribs;
129     GLint m_max_uniformBufferBindings;
130     GLint m_max_colorAttachments;
131     GLint m_max_drawBuffers;
132 
133     GLint m_max_atomicCounterBufferBindings;
134     GLint m_max_shaderStorageBufferBindings;
135     GLint m_max_vertexAttribBindings;
136 
137     GLuint m_ssbo_offset_align;
138     GLuint m_ubo_offset_align;
139 
140     std::vector<char> m_fixedBuffer;
141 
142     uint32_t m_drawCallFlushInterval;
143     uint32_t m_drawCallFlushCount;
144 
145     bool m_primitiveRestartEnabled;
146     GLuint m_primitiveRestartIndex;
147 
148     void calcIndexRange(const void* indices,
149                         GLenum type, GLsizei count,
150                         int* minIndex, int* maxIndex);
151     void* recenterIndices(const void* src,
152                           GLenum type, GLsizei count,
153                           int minIndex);
154     void getBufferIndexRange(BufferData* buf, const void* dataWithOffset,
155                              GLenum type, size_t count, size_t offset,
156                              int* minIndex_out, int* maxIndex_out);
157     void getVBOUsage(bool* hasClientArrays, bool* hasVBOs) const;
158     void sendVertexAttributes(GLint first, GLsizei count, bool hasClientArrays, GLsizei primcount = 0);
159     void flushDrawCall();
160 
161     bool updateHostTexture2DBinding(GLenum texUnit, GLenum newTarget);
162     void updateHostTexture2DBindingsFromProgramData(GLuint program);
163     bool texture2DNeedsOverride(GLenum target) const;
164     bool isCompleteFbo(GLenum target, const GLClientState* state, GLenum attachment) const;
165     bool checkFramebufferCompleteness(GLenum target, const GLClientState* state) const;
166 
167     // Utility classes for safe queries that
168     // need access to private class members
169     class ErrorUpdater;
170     template<class T> class ScopedQueryUpdate;
171 
172     // General queries
173     void safe_glGetBooleanv(GLenum param, GLboolean *val);
174     void safe_glGetFloatv(GLenum param, GLfloat *val);
175     void safe_glGetIntegerv(GLenum param, GLint *val);
176     void safe_glGetInteger64v(GLenum param, GLint64 *val);
177     void safe_glGetIntegeri_v(GLenum param, GLuint index, GLint *val);
178     void safe_glGetInteger64i_v(GLenum param, GLuint index, GLint64 *val);
179     void safe_glGetBooleani_v(GLenum param, GLuint index, GLboolean *val);
180 
181     // API implementation
182     glGetError_client_proc_t    m_glGetError_enc;
183     static GLenum s_glGetError(void * self);
184 
185     glFlush_client_proc_t m_glFlush_enc;
186     static void s_glFlush(void * self);
187 
188     glPixelStorei_client_proc_t m_glPixelStorei_enc;
189     static void s_glPixelStorei(void *self, GLenum param, GLint value);
190 
191     glGetString_client_proc_t m_glGetString_enc;
192     static const GLubyte * s_glGetString(void *self, GLenum name);
193 
194     glBindBuffer_client_proc_t m_glBindBuffer_enc;
195     static void s_glBindBuffer(void *self, GLenum target, GLuint id);
196     void doBindBufferEncodeCached(GLenum taret, GLuint id);
197 
198     glBufferData_client_proc_t m_glBufferData_enc;
199     static void s_glBufferData(void *self, GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage);
200     glBufferSubData_client_proc_t m_glBufferSubData_enc;
201     static void s_glBufferSubData(void *self, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data);
202 
203     glGenBuffers_client_proc_t m_glGenBuffers_enc;
204     static void s_glGenBuffers(void *self, GLsizei n, GLuint * buffers);
205 
206     glDeleteBuffers_client_proc_t m_glDeleteBuffers_enc;
207     static void s_glDeleteBuffers(void *self, GLsizei n, const GLuint * buffers);
208 
209     glDrawArrays_client_proc_t m_glDrawArrays_enc;
210     static void s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei count);
211 
212     glDrawElements_client_proc_t m_glDrawElements_enc;
213     static void s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices);
214 
215     glDrawArraysNullAEMU_client_proc_t m_glDrawArraysNullAEMU_enc;
216     static void s_glDrawArraysNullAEMU(void *self, GLenum mode, GLint first, GLsizei count);
217 
218     glDrawElementsNullAEMU_client_proc_t m_glDrawElementsNullAEMU_enc;
219     static void s_glDrawElementsNullAEMU(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices);
220 
221     glGetIntegerv_client_proc_t m_glGetIntegerv_enc;
222     static void s_glGetIntegerv(void *self, GLenum pname, GLint *ptr);
223 
224     glGetFloatv_client_proc_t m_glGetFloatv_enc;
225     static void s_glGetFloatv(void *self, GLenum pname, GLfloat *ptr);
226 
227     glGetBooleanv_client_proc_t m_glGetBooleanv_enc;
228     static void s_glGetBooleanv(void *self, GLenum pname, GLboolean *ptr);
229 
230     glGetInteger64v_client_proc_t m_glGetInteger64v_enc;
231     static void s_glGetInteger64v(void* self, GLenum param, GLint64* val);
232 
233     glGetBooleani_v_client_proc_t m_glGetBooleani_v_enc;
234     static void s_glGetBooleani_v(void* self, GLenum param, GLuint index, GLboolean* val);
235 
236     glVertexAttribPointer_client_proc_t m_glVertexAttribPointer_enc;
237     static void s_glVertexAttribPointer(void *self, GLuint indx, GLint size, GLenum type,
238                                         GLboolean normalized, GLsizei stride, const GLvoid * ptr);
239 
240     glEnableVertexAttribArray_client_proc_t m_glEnableVertexAttribArray_enc;
241     static void s_glEnableVertexAttribArray(void *self, GLuint index);
242 
243     glDisableVertexAttribArray_client_proc_t m_glDisableVertexAttribArray_enc;
244     static void s_glDisableVertexAttribArray(void *self, GLuint index);
245 
246     glGetVertexAttribiv_client_proc_t m_glGetVertexAttribiv_enc;
247     static void s_glGetVertexAttribiv(void *self, GLuint index, GLenum pname, GLint *params);
248 
249     glGetVertexAttribfv_client_proc_t m_glGetVertexAttribfv_enc;
250     static void s_glGetVertexAttribfv(void *self, GLuint index, GLenum pname, GLfloat *params);
251 
252     glGetVertexAttribPointerv_client_proc_t m_glGetVertexAttribPointerv_enc;
253     static void s_glGetVertexAttribPointerv(void *self, GLuint index, GLenum pname, GLvoid **pointer);
254 
255     static void s_glShaderBinary(void *self, GLsizei n, const GLuint *shaders, GLenum binaryformat, const void* binary, GLsizei length);
256 
257     static void s_glShaderSource(void *self, GLuint shader, GLsizei count, const GLchar * const *string, const GLint *length);
258 
259     static void s_glFinish(void *self);
260 
261     glLinkProgram_client_proc_t m_glLinkProgram_enc;
262     static void s_glLinkProgram(void *self, GLuint program);
263 
264     glDeleteProgram_client_proc_t m_glDeleteProgram_enc;
265     static void s_glDeleteProgram(void * self, GLuint program);
266 
267     glGetUniformiv_client_proc_t m_glGetUniformiv_enc;
268     static void s_glGetUniformiv(void *self, GLuint program, GLint location , GLint *params);
269 
270     glGetUniformfv_client_proc_t m_glGetUniformfv_enc;
271     static void s_glGetUniformfv(void *self, GLuint program, GLint location , GLfloat *params);
272 
273     glCreateProgram_client_proc_t m_glCreateProgram_enc;
274     static GLuint s_glCreateProgram(void *self);
275 
276     glCreateShader_client_proc_t m_glCreateShader_enc;
277     static GLuint s_glCreateShader(void *self, GLenum shaderType);
278 
279     glDeleteShader_client_proc_t m_glDeleteShader_enc;
280     static void s_glDeleteShader(void *self, GLuint shader);
281 
282     glAttachShader_client_proc_t m_glAttachShader_enc;
283     static void s_glAttachShader(void *self, GLuint program, GLuint shader);
284 
285     glDetachShader_client_proc_t m_glDetachShader_enc;
286     static void s_glDetachShader(void *self, GLuint program, GLuint shader);
287 
288     glGetAttachedShaders_client_proc_t m_glGetAttachedShaders_enc;
289     static void s_glGetAttachedShaders(void *self, GLuint program, GLsizei maxCount,
290             GLsizei* count, GLuint* shaders);
291 
292     glGetShaderSource_client_proc_t m_glGetShaderSource_enc;
293     static void s_glGetShaderSource(void *self, GLuint shader, GLsizei bufsize,
294             GLsizei* length, GLchar* source);
295 
296     glGetShaderInfoLog_client_proc_t m_glGetShaderInfoLog_enc;
297     static void s_glGetShaderInfoLog(void *self,GLuint shader,
298             GLsizei bufsize, GLsizei* length, GLchar* infolog);
299 
300     glGetProgramInfoLog_client_proc_t m_glGetProgramInfoLog_enc;
301     static void s_glGetProgramInfoLog(void *self,GLuint program,
302             GLsizei bufsize, GLsizei* length, GLchar* infolog);
303 
304     glGetUniformLocation_client_proc_t m_glGetUniformLocation_enc;
305     static int s_glGetUniformLocation(void *self, GLuint program, const GLchar *name);
306     glUseProgram_client_proc_t m_glUseProgram_enc;
307 
308     glUniform1f_client_proc_t m_glUniform1f_enc;
309     glUniform1fv_client_proc_t m_glUniform1fv_enc;
310     glUniform1i_client_proc_t m_glUniform1i_enc;
311     glUniform1iv_client_proc_t m_glUniform1iv_enc;
312     glUniform2f_client_proc_t m_glUniform2f_enc;
313     glUniform2fv_client_proc_t m_glUniform2fv_enc;
314     glUniform2i_client_proc_t m_glUniform2i_enc;
315     glUniform2iv_client_proc_t m_glUniform2iv_enc;
316     glUniform3f_client_proc_t m_glUniform3f_enc;
317     glUniform3fv_client_proc_t m_glUniform3fv_enc;
318     glUniform3i_client_proc_t m_glUniform3i_enc;
319     glUniform3iv_client_proc_t m_glUniform3iv_enc;
320     glUniform4f_client_proc_t m_glUniform4f_enc;
321     glUniform4fv_client_proc_t m_glUniform4fv_enc;
322     glUniform4i_client_proc_t m_glUniform4i_enc;
323     glUniform4iv_client_proc_t m_glUniform4iv_enc;
324     glUniformMatrix2fv_client_proc_t m_glUniformMatrix2fv_enc;
325     glUniformMatrix3fv_client_proc_t m_glUniformMatrix3fv_enc;
326     glUniformMatrix4fv_client_proc_t m_glUniformMatrix4fv_enc;
327 
328     static void s_glUseProgram(void *self, GLuint program);
329 	static void s_glUniform1f(void *self , GLint location, GLfloat x);
330 	static void s_glUniform1fv(void *self , GLint location, GLsizei count, const GLfloat* v);
331 	static void s_glUniform1i(void *self , GLint location, GLint x);
332 	static void s_glUniform1iv(void *self , GLint location, GLsizei count, const GLint* v);
333 	static void s_glUniform2f(void *self , GLint location, GLfloat x, GLfloat y);
334 	static void s_glUniform2fv(void *self , GLint location, GLsizei count, const GLfloat* v);
335 	static void s_glUniform2i(void *self , GLint location, GLint x, GLint y);
336 	static void s_glUniform2iv(void *self , GLint location, GLsizei count, const GLint* v);
337 	static void s_glUniform3f(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z);
338 	static void s_glUniform3fv(void *self , GLint location, GLsizei count, const GLfloat* v);
339 	static void s_glUniform3i(void *self , GLint location, GLint x, GLint y, GLint z);
340 	static void s_glUniform3iv(void *self , GLint location, GLsizei count, const GLint* v);
341 	static void s_glUniform4f(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
342 	static void s_glUniform4fv(void *self , GLint location, GLsizei count, const GLfloat* v);
343 	static void s_glUniform4i(void *self , GLint location, GLint x, GLint y, GLint z, GLint w);
344 	static void s_glUniform4iv(void *self , GLint location, GLsizei count, const GLint* v);
345 	static void s_glUniformMatrix2fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
346 	static void s_glUniformMatrix3fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
347 	static void s_glUniformMatrix4fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
348 
349     glActiveTexture_client_proc_t m_glActiveTexture_enc;
350     glBindTexture_client_proc_t m_glBindTexture_enc;
351     glDeleteTextures_client_proc_t m_glDeleteTextures_enc;
352     glGetTexParameterfv_client_proc_t m_glGetTexParameterfv_enc;
353     glGetTexParameteriv_client_proc_t m_glGetTexParameteriv_enc;
354     glTexParameterf_client_proc_t m_glTexParameterf_enc;
355     glTexParameterfv_client_proc_t m_glTexParameterfv_enc;
356     glTexParameteri_client_proc_t m_glTexParameteri_enc;
357     glTexParameteriv_client_proc_t m_glTexParameteriv_enc;
358     glTexImage2D_client_proc_t m_glTexImage2D_enc;
359     glTexSubImage2D_client_proc_t m_glTexSubImage2D_enc;
360     glCopyTexImage2D_client_proc_t m_glCopyTexImage2D_enc;
361 
362     static void s_glActiveTexture(void* self, GLenum texture);
363     static void s_glBindTexture(void* self, GLenum target, GLuint texture);
364     static void s_glDeleteTextures(void* self, GLsizei n, const GLuint* textures);
365     static void s_glGetTexParameterfv(void* self, GLenum target, GLenum pname, GLfloat* params);
366     static void s_glGetTexParameteriv(void* self, GLenum target, GLenum pname, GLint* params);
367     static void s_glTexParameterf(void* self, GLenum target, GLenum pname, GLfloat param);
368     static void s_glTexParameterfv(void* self, GLenum target, GLenum pname, const GLfloat* params);
369     static void s_glTexParameteri(void* self, GLenum target, GLenum pname, GLint param);
370     static void s_glTexParameteriv(void* self, GLenum target, GLenum pname, const GLint* params);
371     static void s_glTexImage2D(void* self, GLenum target, GLint level, GLint internalformat,
372             GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type,
373             const GLvoid* pixels);
374     static void s_glTexSubImage2D(void* self, GLenum target, GLint level, GLint xoffset,
375             GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type,
376             const GLvoid* pixels);
377     static void s_glCopyTexImage2D(void* self, GLenum target, GLint level, GLenum internalformat,
378             GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
379 
380     glGenRenderbuffers_client_proc_t m_glGenRenderbuffers_enc;
381     static void s_glGenRenderbuffers(void* self, GLsizei n, GLuint* renderbuffers);
382     glDeleteRenderbuffers_client_proc_t m_glDeleteRenderbuffers_enc;
383     static void s_glDeleteRenderbuffers(void* self, GLsizei n, const GLuint* renderbuffers);
384 
385     glBindRenderbuffer_client_proc_t m_glBindRenderbuffer_enc;
386     static void s_glBindRenderbuffer(void* self, GLenum target, GLuint renderbuffer);
387 
388     glRenderbufferStorage_client_proc_t m_glRenderbufferStorage_enc;
389     static void s_glRenderbufferStorage(void* self, GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
390 
391     glFramebufferRenderbuffer_client_proc_t m_glFramebufferRenderbuffer_enc;
392     static void s_glFramebufferRenderbuffer(void* self, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
393 
394     glGenFramebuffers_client_proc_t m_glGenFramebuffers_enc;
395     static void s_glGenFramebuffers(void* self, GLsizei n, GLuint* framebuffers);
396     glDeleteFramebuffers_client_proc_t m_glDeleteFramebuffers_enc;
397     static void s_glDeleteFramebuffers(void* self, GLsizei n, const GLuint* framebuffers);
398 
399     glBindFramebuffer_client_proc_t m_glBindFramebuffer_enc;
400     static void s_glBindFramebuffer(void* self, GLenum target, GLuint framebuffer);
401 
402     glFramebufferTexture2D_client_proc_t m_glFramebufferTexture2D_enc;
403     static void s_glFramebufferTexture2D(void* self, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
404 
405     glFramebufferTexture3DOES_client_proc_t m_glFramebufferTexture3DOES_enc;
406     static void s_glFramebufferTexture3DOES(void*self, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
407 
408     glGetFramebufferAttachmentParameteriv_client_proc_t m_glGetFramebufferAttachmentParameteriv_enc;
409     static void s_glGetFramebufferAttachmentParameteriv(void* self, GLenum target, GLenum attachment, GLenum pname, GLint* params);
410 
411     glCheckFramebufferStatus_client_proc_t m_glCheckFramebufferStatus_enc;
412     static GLenum s_glCheckFramebufferStatus(void* self,
413             GLenum target);
414 
415     // GLES 3.0-specific custom encoders
416 
417     // VAO (+ ES 2 extension)
418     glGenVertexArrays_client_proc_t m_glGenVertexArrays_enc;
419     glDeleteVertexArrays_client_proc_t m_glDeleteVertexArrays_enc;
420     glBindVertexArray_client_proc_t m_glBindVertexArray_enc;
421     glGenVertexArraysOES_client_proc_t m_glGenVertexArraysOES_enc;
422     glDeleteVertexArraysOES_client_proc_t m_glDeleteVertexArraysOES_enc;
423     glBindVertexArrayOES_client_proc_t m_glBindVertexArrayOES_enc;
424     static void s_glGenVertexArrays(void *self, GLsizei n, GLuint* arrays);
425     static void s_glDeleteVertexArrays(void *self , GLsizei n, const GLuint* arrays);
426     static void s_glBindVertexArray(void *self , GLuint array);
427 
428     // Mapped buffers
429     static void* s_glMapBufferOES(void* self, GLenum target, GLenum access);
430     static GLboolean s_glUnmapBufferOES(void* self, GLenum target);
431     static void* s_glMapBufferRange(void* self, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
432     static void* s_glMapBufferRangeAEMUImpl(GL2Encoder* ctx, GLenum target,
433                                             GLintptr offset, GLsizeiptr length,
434                                             GLbitfield access, BufferData* buf);
435     static GLboolean s_glUnmapBuffer(void* self, GLenum target);
436     static void s_glFlushMappedBufferRange(void* self, GLenum target, GLintptr offset, GLsizeiptr length);
437 
438     // Custom encodes for 2D compressed textures b/c we need to account for
439     // nonzero GL_PIXEL_UNPACK_BUFFER
440     glCompressedTexImage2D_client_proc_t m_glCompressedTexImage2D_enc;
441     static void s_glCompressedTexImage2D(void* self, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
442     glCompressedTexSubImage2D_client_proc_t m_glCompressedTexSubImage2D_enc;
443     static void s_glCompressedTexSubImage2D(void* self, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
444 
445     // Indexed, range bind
446     glBindBufferRange_client_proc_t m_glBindBufferRange_enc;
447     static void s_glBindBufferRange(void *self , GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
448 
449     glBindBufferBase_client_proc_t m_glBindBufferBase_enc;
450     static void s_glBindBufferBase(void *self , GLenum target, GLuint index, GLuint buffer);
451 
452     // TODO:
453     // VertexAttrib(I)Pointer
454     // VertexAttribBinding
455     // BindVertexBuffer
456     // depend on other state as well
457     enum IndexedBufferBindOp {
458         BindBufferBase,
459         BindBufferRange,
460         // TODO
461         // VertexAttribPointer,
462         // VertexAttribIPointer,
463         // VertexAttribBinding,
464         // VertexAttribFormat,
465         // BindVertexBuffer,
466     };
467     void doIndexedBufferBindEncodeCached(IndexedBufferBindOp op, GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size, GLintptr stride, GLintptr effectiveStride);
468 
469     glCopyBufferSubData_client_proc_t m_glCopyBufferSubData_enc;
470     static void s_glCopyBufferSubData(void *self , GLenum readtarget, GLenum writetarget, GLintptr readoffset, GLintptr writeoffset, GLsizeiptr size);
471 
472     glGetBufferParameteriv_client_proc_t m_glGetBufferParameteriv_enc;
473     static void s_glGetBufferParameteriv(void* self, GLenum target, GLenum pname, GLint* params);
474 
475     glGetBufferParameteri64v_client_proc_t m_glGetBufferParameteri64v_enc;
476     static void s_glGetBufferParameteri64v(void* self, GLenum target, GLenum pname, GLint64* params);
477 
478     glGetBufferPointerv_client_proc_t m_glGetBufferPointerv_enc;
479     static void s_glGetBufferPointerv(void* self, GLenum target, GLenum pname, GLvoid** params);
480 
481     glGetUniformIndices_client_proc_t m_glGetUniformIndices_enc;
482     static void s_glGetUniformIndices(void* self, GLuint program, GLsizei uniformCount, const GLchar ** uniformNames, GLuint* uniformIndices);
483 
484     glUniform1ui_client_proc_t m_glUniform1ui_enc;
485     glUniform1uiv_client_proc_t m_glUniform1uiv_enc;
486     glUniform2ui_client_proc_t m_glUniform2ui_enc;
487     glUniform2uiv_client_proc_t m_glUniform2uiv_enc;
488     glUniform3ui_client_proc_t m_glUniform3ui_enc;
489     glUniform3uiv_client_proc_t m_glUniform3uiv_enc;
490     glUniform4ui_client_proc_t m_glUniform4ui_enc;
491     glUniform4uiv_client_proc_t m_glUniform4uiv_enc;
492     glUniformMatrix2x3fv_client_proc_t m_glUniformMatrix2x3fv_enc;
493     glUniformMatrix2x4fv_client_proc_t m_glUniformMatrix2x4fv_enc;
494     glUniformMatrix3x2fv_client_proc_t m_glUniformMatrix3x2fv_enc;
495     glUniformMatrix3x4fv_client_proc_t m_glUniformMatrix3x4fv_enc;
496     glUniformMatrix4x2fv_client_proc_t m_glUniformMatrix4x2fv_enc;
497     glUniformMatrix4x3fv_client_proc_t m_glUniformMatrix4x3fv_enc;
498 
499     static void s_glUniform1ui(void* self, GLint location, GLuint v0);
500     static void s_glUniform2ui(void* self, GLint location, GLuint v0, GLuint v1);
501     static void s_glUniform3ui(void* self, GLint location, GLuint v0, GLuint v1, GLuint v2);
502     static void s_glUniform4ui(void* self, GLint location, GLint v0, GLuint v1, GLuint v2, GLuint v3);
503     static void s_glUniform1uiv(void* self, GLint location, GLsizei count, const GLuint *value);
504     static void s_glUniform2uiv(void* self, GLint location, GLsizei count, const GLuint *value);
505     static void s_glUniform3uiv(void* self, GLint location, GLsizei count, const GLuint *value);
506     static void s_glUniform4uiv(void* self, GLint location, GLsizei count, const GLuint *value);
507     static void s_glUniformMatrix2x3fv(void* self, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
508     static void s_glUniformMatrix3x2fv(void* self, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
509     static void s_glUniformMatrix2x4fv(void* self, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
510     static void s_glUniformMatrix4x2fv(void* self, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
511     static void s_glUniformMatrix3x4fv(void* self, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
512     static void s_glUniformMatrix4x3fv(void* self, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
513 
514     glGetUniformuiv_client_proc_t m_glGetUniformuiv_enc;
515     static void s_glGetUniformuiv(void *self, GLuint program, GLint location, GLuint* params);
516 
517     glGetActiveUniformBlockiv_client_proc_t m_glGetActiveUniformBlockiv_enc;
518     static void s_glGetActiveUniformBlockiv(void* self, GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params);
519 
520     glGetVertexAttribIiv_client_proc_t m_glGetVertexAttribIiv_enc;
521     static void s_glGetVertexAttribIiv(void* self, GLuint index, GLenum pname, GLint* params);
522 
523     glGetVertexAttribIuiv_client_proc_t m_glGetVertexAttribIuiv_enc;
524     static void s_glGetVertexAttribIuiv(void* self, GLuint index, GLenum pname, GLuint* params);
525 
526     static void s_glVertexAttribIPointer(void* self, GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
527 
528     glVertexAttribDivisor_client_proc_t m_glVertexAttribDivisor_enc;
529     static void s_glVertexAttribDivisor(void* self, GLuint index, GLuint divisor);
530 
531     glRenderbufferStorageMultisample_client_proc_t m_glRenderbufferStorageMultisample_enc;
532     static void s_glRenderbufferStorageMultisample(void* self, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
533 
534     glDrawBuffers_client_proc_t m_glDrawBuffers_enc;
535     static void s_glDrawBuffers(void* self, GLsizei n, const GLenum* bufs);
536 
537     glReadBuffer_client_proc_t m_glReadBuffer_enc;
538     static void s_glReadBuffer(void* self, GLenum src);
539 
540     glFramebufferTextureLayer_client_proc_t m_glFramebufferTextureLayer_enc;
541     static void s_glFramebufferTextureLayer(void* self, GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
542 
543     glTexStorage2D_client_proc_t m_glTexStorage2D_enc;
544     static void s_glTexStorage2D(void* self, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
545 
546     static void s_glTransformFeedbackVaryings(void* self, GLuint program, GLsizei count, const char** varyings, GLenum bufferMode);
547 
548     glBeginTransformFeedback_client_proc_t m_glBeginTransformFeedback_enc;
549     static void s_glBeginTransformFeedback(void* self, GLenum primitiveMode);
550 
551     glEndTransformFeedback_client_proc_t m_glEndTransformFeedback_enc;
552     static void s_glEndTransformFeedback(void* self);
553 
554     glPauseTransformFeedback_client_proc_t m_glPauseTransformFeedback_enc;
555     static void s_glPauseTransformFeedback(void* self);
556 
557     glResumeTransformFeedback_client_proc_t m_glResumeTransformFeedback_enc;
558     static void s_glResumeTransformFeedback(void* self);
559 
560     glTexImage3D_client_proc_t m_glTexImage3D_enc;
561     static void s_glTexImage3D(void* self, GLenum target, GLint level, GLint internalFormat,
562                                GLsizei width, GLsizei height, GLsizei depth,
563                                GLint border, GLenum format, GLenum type, const GLvoid* data);
564 
565     glTexSubImage3D_client_proc_t m_glTexSubImage3D_enc;
566     static void s_glTexSubImage3D(void* self, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* data);
567 
568     glCompressedTexImage3D_client_proc_t m_glCompressedTexImage3D_enc;
569     static void s_glCompressedTexImage3D(void* self, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
570     glCompressedTexSubImage3D_client_proc_t m_glCompressedTexSubImage3D_enc;
571     static void s_glCompressedTexSubImage3D(void* self, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
572 
573 
574     glTexStorage3D_client_proc_t m_glTexStorage3D_enc;
575     static void s_glTexStorage3D(void* self, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
576 
577     glDrawArraysInstanced_client_proc_t m_glDrawArraysInstanced_enc;
578     static void s_glDrawArraysInstanced(void* self, GLenum mode, GLint first, GLsizei count, GLsizei primcount);
579 
580     static void s_glDrawElementsInstanced(void* self, GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount);
581 
582     glDrawRangeElements_client_proc_t m_glDrawRangeElements_enc;
583     static void s_glDrawRangeElements(void* self, GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void* indices);
584 
585     static const GLubyte* s_glGetStringi(void* self, GLenum name, GLuint index);
586 
587     glGetProgramBinary_client_proc_t m_glGetProgramBinary_enc;
588     static void s_glGetProgramBinary(void* self, GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, void* binary);
589 
590     glReadPixels_client_proc_t m_glReadPixels_enc;
591     static void s_glReadPixels(void* self, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
592 
593     glEnable_client_proc_t m_glEnable_enc;
594     static void s_glEnable(void* self, GLenum what);
595     glDisable_client_proc_t m_glDisable_enc;
596     static void s_glDisable(void* self, GLenum what);
597 
598     glClearBufferiv_client_proc_t m_glClearBufferiv_enc;
599     static void s_glClearBufferiv(void* self, GLenum buffer, GLint drawBuffer, const GLint* value);
600 
601     glClearBufferuiv_client_proc_t m_glClearBufferuiv_enc;
602     static void s_glClearBufferuiv(void* self, GLenum buffer, GLint drawBuffer, const GLuint* value);
603 
604     glClearBufferfv_client_proc_t m_glClearBufferfv_enc;
605     static void s_glClearBufferfv(void* self, GLenum buffer, GLint drawBuffer, const GLfloat* value);
606 
607     glBlitFramebuffer_client_proc_t m_glBlitFramebuffer_enc;
608     static void s_glBlitFramebuffer(void* self, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
609 
610     static void s_glGetInternalformativ(void* self, GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
611 
612     glGenerateMipmap_client_proc_t m_glGenerateMipmap_enc;
613     static void s_glGenerateMipmap(void* self, GLenum target);
614 
615     glBindSampler_client_proc_t m_glBindSampler_enc;
616     static void s_glBindSampler(void* self, GLuint unit, GLuint sampler);
617     void doSamplerBindEncodeCached(GLuint unit, GLuint sampler);
618 
619     glDeleteSamplers_client_proc_t m_glDeleteSamplers_enc;
620     static void s_glDeleteSamplers(void* self, GLsizei n, const GLuint* samplers);
621 
622     static GLsync s_glFenceSync(void* self, GLenum condition, GLbitfield flags);
623     static GLenum s_glClientWaitSync(void* self, GLsync wait_on, GLbitfield flags, GLuint64 timeout);
624     static void s_glWaitSync(void* self, GLsync wait_on, GLbitfield flags, GLuint64 timeout);
625     static void s_glDeleteSync(void* self, GLsync to_delete);
626     static GLboolean s_glIsSync(void* self, GLsync sync);
627     static void s_glGetSynciv(void* self, GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
628 
629     glGetIntegeri_v_client_proc_t m_glGetIntegeri_v_enc;
630     static void s_glGetIntegeri_v(void* self, GLenum target, GLuint index, GLint* params);
631 
632     glGetInteger64i_v_client_proc_t m_glGetInteger64i_v_enc;
633     static void s_glGetInteger64i_v(void* self, GLenum target, GLuint index, GLint64* params);
634 
635     glGetShaderiv_client_proc_t m_glGetShaderiv_enc;
636     static void s_glGetShaderiv(void* self, GLuint shader, GLenum pname, GLint* params);
637 
638     // 3.1
639     glActiveShaderProgram_client_proc_t m_glActiveShaderProgram_enc;
640     static void s_glActiveShaderProgram(void* self, GLuint pipeline, GLuint program);
641     static GLuint s_glCreateShaderProgramv(void* self, GLenum type, GLsizei count, const char** strings);
642 
643     glProgramUniform1f_client_proc_t m_glProgramUniform1f_enc;
644     glProgramUniform1fv_client_proc_t m_glProgramUniform1fv_enc;
645     glProgramUniform1i_client_proc_t m_glProgramUniform1i_enc;
646     glProgramUniform1iv_client_proc_t m_glProgramUniform1iv_enc;
647     glProgramUniform1ui_client_proc_t m_glProgramUniform1ui_enc;
648     glProgramUniform1uiv_client_proc_t m_glProgramUniform1uiv_enc;
649     glProgramUniform2f_client_proc_t m_glProgramUniform2f_enc;
650     glProgramUniform2fv_client_proc_t m_glProgramUniform2fv_enc;
651     glProgramUniform2i_client_proc_t m_glProgramUniform2i_enc;
652     glProgramUniform2iv_client_proc_t m_glProgramUniform2iv_enc;
653     glProgramUniform2ui_client_proc_t m_glProgramUniform2ui_enc;
654     glProgramUniform2uiv_client_proc_t m_glProgramUniform2uiv_enc;
655     glProgramUniform3f_client_proc_t m_glProgramUniform3f_enc;
656     glProgramUniform3fv_client_proc_t m_glProgramUniform3fv_enc;
657     glProgramUniform3i_client_proc_t m_glProgramUniform3i_enc;
658     glProgramUniform3iv_client_proc_t m_glProgramUniform3iv_enc;
659     glProgramUniform3ui_client_proc_t m_glProgramUniform3ui_enc;
660     glProgramUniform3uiv_client_proc_t m_glProgramUniform3uiv_enc;
661     glProgramUniform4f_client_proc_t m_glProgramUniform4f_enc;
662     glProgramUniform4fv_client_proc_t m_glProgramUniform4fv_enc;
663     glProgramUniform4i_client_proc_t m_glProgramUniform4i_enc;
664     glProgramUniform4iv_client_proc_t m_glProgramUniform4iv_enc;
665     glProgramUniform4ui_client_proc_t m_glProgramUniform4ui_enc;
666     glProgramUniform4uiv_client_proc_t m_glProgramUniform4uiv_enc;
667     glProgramUniformMatrix2fv_client_proc_t m_glProgramUniformMatrix2fv_enc;
668     glProgramUniformMatrix2x3fv_client_proc_t m_glProgramUniformMatrix2x3fv_enc;
669     glProgramUniformMatrix2x4fv_client_proc_t m_glProgramUniformMatrix2x4fv_enc;
670     glProgramUniformMatrix3fv_client_proc_t m_glProgramUniformMatrix3fv_enc;
671     glProgramUniformMatrix3x2fv_client_proc_t m_glProgramUniformMatrix3x2fv_enc;
672     glProgramUniformMatrix3x4fv_client_proc_t m_glProgramUniformMatrix3x4fv_enc;
673     glProgramUniformMatrix4fv_client_proc_t m_glProgramUniformMatrix4fv_enc;
674     glProgramUniformMatrix4x2fv_client_proc_t m_glProgramUniformMatrix4x2fv_enc;
675     glProgramUniformMatrix4x3fv_client_proc_t m_glProgramUniformMatrix4x3fv_enc;
676 
677     static void s_glProgramUniform1f(void* self, GLuint program, GLint location, GLfloat v0);
678     static void s_glProgramUniform2f(void* self, GLuint program, GLint location, GLfloat v0, GLfloat v1);
679     static void s_glProgramUniform3f(void* self, GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
680     static void s_glProgramUniform4f(void* self, GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
681     static void s_glProgramUniform1i(void* self, GLuint program, GLint location, GLint v0);
682     static void s_glProgramUniform2i(void* self, GLuint program, GLint location, GLint v0, GLint v1);
683     static void s_glProgramUniform3i(void* self, GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
684     static void s_glProgramUniform4i(void* self, GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
685     static void s_glProgramUniform1ui(void* self, GLuint program, GLint location, GLuint v0);
686     static void s_glProgramUniform2ui(void* self, GLuint program, GLint location, GLint v0, GLuint v1);
687     static void s_glProgramUniform3ui(void* self, GLuint program, GLint location, GLint v0, GLint v1, GLuint v2);
688     static void s_glProgramUniform4ui(void* self, GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLuint v3);
689     static void s_glProgramUniform1fv(void* self, GLuint program, GLint location, GLsizei count, const GLfloat *value);
690     static void s_glProgramUniform2fv(void* self, GLuint program, GLint location, GLsizei count, const GLfloat *value);
691     static void s_glProgramUniform3fv(void* self, GLuint program, GLint location, GLsizei count, const GLfloat *value);
692     static void s_glProgramUniform4fv(void* self, GLuint program, GLint location, GLsizei count, const GLfloat *value);
693     static void s_glProgramUniform1iv(void* self, GLuint program, GLint location, GLsizei count, const GLint *value);
694     static void s_glProgramUniform2iv(void* self, GLuint program, GLint location, GLsizei count, const GLint *value);
695     static void s_glProgramUniform3iv(void* self, GLuint program, GLint location, GLsizei count, const GLint *value);
696     static void s_glProgramUniform4iv(void* self, GLuint program, GLint location, GLsizei count, const GLint *value);
697     static void s_glProgramUniform1uiv(void* self, GLuint program, GLint location, GLsizei count, const GLuint *value);
698     static void s_glProgramUniform2uiv(void* self, GLuint program, GLint location, GLsizei count, const GLuint *value);
699     static void s_glProgramUniform3uiv(void* self, GLuint program, GLint location, GLsizei count, const GLuint *value);
700     static void s_glProgramUniform4uiv(void* self, GLuint program, GLint location, GLsizei count, const GLuint *value);
701     static void s_glProgramUniformMatrix2fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
702     static void s_glProgramUniformMatrix3fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
703     static void s_glProgramUniformMatrix4fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
704     static void s_glProgramUniformMatrix2x3fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
705     static void s_glProgramUniformMatrix3x2fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
706     static void s_glProgramUniformMatrix2x4fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
707     static void s_glProgramUniformMatrix4x2fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
708     static void s_glProgramUniformMatrix3x4fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
709     static void s_glProgramUniformMatrix4x3fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
710 
711     glProgramParameteri_client_proc_t m_glProgramParameteri_enc;
712     glUseProgramStages_client_proc_t m_glUseProgramStages_enc;
713     glBindProgramPipeline_client_proc_t m_glBindProgramPipeline_enc;
714 
715     static void s_glProgramParameteri(void* self, GLuint program, GLenum pname, GLint value);
716     static void s_glUseProgramStages(void *self, GLuint pipeline, GLbitfield stages, GLuint program);
717     static void s_glBindProgramPipeline(void *self, GLuint pipeline);
718 
719     glGetProgramResourceiv_client_proc_t m_glGetProgramResourceiv_enc;
720     glGetProgramResourceIndex_client_proc_t m_glGetProgramResourceIndex_enc;
721     glGetProgramResourceLocation_client_proc_t m_glGetProgramResourceLocation_enc;
722     glGetProgramResourceName_client_proc_t m_glGetProgramResourceName_enc;
723     glGetProgramPipelineInfoLog_client_proc_t m_glGetProgramPipelineInfoLog_enc;
724 
725     static void s_glGetProgramResourceiv(void* self, GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum * props, GLsizei bufSize, GLsizei * length, GLint * params);
726     static GLuint s_glGetProgramResourceIndex(void* self, GLuint program, GLenum programInterface, const char* name);
727     static GLint s_glGetProgramResourceLocation(void* self, GLuint program, GLenum programInterface, const char* name);
728     static void s_glGetProgramResourceName(void* self, GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei* length, char* name);
729 
730     static void s_glGetProgramPipelineInfoLog(void* self, GLuint pipeline, GLsizei bufSize, GLsizei* length, GLchar* infoLog);
731 
732     // TODO: Compute shaders:
733     // make sure it's OK to put memory barriers and compute dispatch
734     // on the default encoding path
735 
736     glVertexAttribFormat_client_proc_t m_glVertexAttribFormat_enc;
737     glVertexAttribIFormat_client_proc_t m_glVertexAttribIFormat_enc;
738     glVertexBindingDivisor_client_proc_t m_glVertexBindingDivisor_enc;
739     glVertexAttribBinding_client_proc_t m_glVertexAttribBinding_enc;
740     glBindVertexBuffer_client_proc_t m_glBindVertexBuffer_enc;
741 
742     static void s_glVertexAttribFormat(void* self, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
743     static void s_glVertexAttribIFormat(void* self, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
744     static void s_glVertexBindingDivisor(void* self, GLuint bindingindex, GLuint divisor);
745     static void s_glVertexAttribBinding(void* self, GLuint attribindex, GLuint bindingindex);
746     static void s_glBindVertexBuffer(void* self, GLuint bindingindex, GLuint buffer, GLintptr offset, GLintptr stride);
747 
748     // Indirect draws
749     static void s_glDrawArraysIndirect(void* self, GLenum mode, const void* indirect);
750     static void s_glDrawElementsIndirect(void* self, GLenum mode, GLenum type, const void* indirect);
751 
752     // Multisampled textures
753     glTexStorage2DMultisample_client_proc_t m_glTexStorage2DMultisample_enc;
754     static void s_glTexStorage2DMultisample(void* self, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
755 
756     static GLenum s_glGetGraphicsResetStatusEXT(void* self);
757     static void s_glReadnPixelsEXT(void* self, GLint x, GLint y, GLsizei width,
758             GLsizei height, GLenum format, GLenum type, GLsizei bufSize,
759             GLvoid* pixels);
760     static void s_glGetnUniformfvEXT(void *self, GLuint program, GLint location,
761             GLsizei bufSize, GLfloat* params);
762     static void s_glGetnUniformivEXT(void *self, GLuint program, GLint location,
763             GLsizei bufSize, GLint* params);
764 
765     // Invalidate framebuffer
766     static void s_glInvalidateFramebuffer(void* self, GLenum target, GLsizei numAttachments, const GLenum *attachments);
767     static void s_glInvalidateSubFramebuffer(void* self, GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
768 
769     glInvalidateFramebuffer_client_proc_t m_glInvalidateFramebuffer_enc;
770     glInvalidateSubFramebuffer_client_proc_t m_glInvalidateSubFramebuffer_enc;;
771 
772 public:
773     glEGLImageTargetTexture2DOES_client_proc_t m_glEGLImageTargetTexture2DOES_enc;
774 
775 };
776 #endif
777