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 _GL_DECODER_H_ 17 #define _GL_DECODER_H_ 18 19 #include "gl_dec.h" 20 #include "FixedBuffer.h" 21 #include "GLDecoderContextData.h" 22 #include <osDynLibrary.h> 23 24 #define GLES_LIBNAME_VAR "ANDROID_GLESv1_LIB" 25 #define GLES_LIBNAME "libGLES_CM.so" 26 27 class GLDecoder : public gl_decoder_context_t 28 { 29 public: 30 typedef void *(*get_proc_func_t)(const char *name, void *userData); 31 32 GLDecoder(); 33 ~GLDecoder(); 34 int initGL(get_proc_func_t getProcFunc = NULL, void *getProcFuncData = NULL); 35 void setContextData(GLDecoderContextData *contextData) { m_contextData = contextData; } 36 37 private: 38 static void gl_APIENTRY s_glGetCompressedTextureFormats(void * self, GLint cont, GLint *data); 39 static void gl_APIENTRY s_glVertexPointerData(void *self, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen); 40 static void gl_APIENTRY s_glVertexPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset); 41 42 static void gl_APIENTRY s_glColorPointerData(void *self, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen); 43 static void gl_APIENTRY s_glColorPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset); 44 45 static void gl_APIENTRY s_glTexCoordPointerData(void *self, GLint unit, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen); 46 static void gl_APIENTRY s_glTexCoordPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset); 47 48 static void gl_APIENTRY s_glNormalPointerData(void *self, GLenum type, GLsizei stride, void *data, GLuint datalen); 49 static void gl_APIENTRY s_glNormalPointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset); 50 51 static void gl_APIENTRY s_glPointSizePointerData(void *self, GLenum type, GLsizei stride, void *data, GLuint datalen); 52 static void gl_APIENTRY s_glPointSizePointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset); 53 54 static void gl_APIENTRY s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset); 55 static void gl_APIENTRY s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GLenum type, void * data, GLuint datalen); 56 57 static void gl_APIENTRY s_glWeightPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen); 58 static void gl_APIENTRY s_glWeightPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset); 59 60 static void gl_APIENTRY s_glMatrixIndexPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen); 61 static void gl_APIENTRY s_glMatrixIndexPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset); 62 63 static int gl_APIENTRY s_glFinishRoundTrip(void *self); 64 65 static void * s_getProc(const char *name, void *userData); 66 67 GLDecoderContextData *m_contextData; 68 osUtils::dynLibrary* m_glesDso; 69 }; 70 71 #endif 72