1 /*
2 * Copyright 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 
17 #ifndef _GL2_DECODER_H_
18 #define _GL2_DECODER_H_
19 
20 #define GLES2_LIBNAME_VAR "ANDROID_GLESv2_LIB"
21 #define GLES2_LIBNAME     "libGLESv2.so"
22 
23 #include "gl2_dec.h"
24 #include "osDynLibrary.h"
25 #include "GLDecoderContextData.h"
26 
27 
28 class GL2Decoder : public gl2_decoder_context_t
29 {
30 public:
31     typedef void *(*get_proc_func_t)(const char *name, void *userData);
32     GL2Decoder();
33     ~GL2Decoder();
34     int initGL(get_proc_func_t getProcFunc = NULL, void *getProcFuncData = NULL);
setContextData(GLDecoderContextData * contextData)35     void setContextData(GLDecoderContextData *contextData) { m_contextData = contextData; }
36 private:
37     GLDecoderContextData *m_contextData;
38     osUtils::dynLibrary * m_GL2library;
39 
40     static void *s_getProc(const char *name, void *userData);
41     static void gl2_APIENTRY s_glGetCompressedTextureFormats(void *self, int count, GLint *formats);
42     static void gl2_APIENTRY s_glVertexAttribPointerData(void *self, GLuint indx, GLint size, GLenum type,
43                                       GLboolean normalized, GLsizei stride,  void * data, GLuint datalen);
44     static void gl2_APIENTRY s_glVertexAttribPointerOffset(void *self, GLuint indx, GLint size, GLenum type,
45                                         GLboolean normalized, GLsizei stride,  GLuint offset);
46 
47     static void gl2_APIENTRY s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset);
48     static void gl2_APIENTRY s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GLenum type, void * data, GLuint datalen);
49     static void gl2_APIENTRY s_glShaderString(void *self, GLuint shader, const GLchar* string, GLsizei len);
50     static int  gl2_APIENTRY s_glFinishRoundTrip(void *self);
51 };
52 #endif
53