• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "gles1_dec.h"
20 
21 #include "GLDecoderContextData.h"
22 #include "aemu/base/SharedLibrary.h"
23 
24 namespace gfxstream {
25 namespace gl {
26 
27 typedef void (gles1_APIENTRY *glColorPointerWithDataSize_server_proc_t) (GLint, GLenum, GLsizei, const GLvoid*, GLsizei);
28 typedef void (gles1_APIENTRY *glNormalPointerWithDataSize_server_proc_t) (GLenum, GLsizei, const GLvoid*, GLsizei);
29 typedef void (gles1_APIENTRY *glTexCoordPointerWithDataSize_server_proc_t) (GLint, GLenum, GLsizei, const GLvoid*, GLsizei);
30 typedef void (gles1_APIENTRY *glVertexPointerWithDataSize_server_proc_t) (GLint, GLenum, GLsizei, const GLvoid*, GLsizei);
31 
32 struct gles1_decoder_extended_context : gles1_decoder_context_t {
33     glColorPointerWithDataSize_server_proc_t glColorPointerWithDataSize;
34     glNormalPointerWithDataSize_server_proc_t glNormalPointerWithDataSize;
35     glTexCoordPointerWithDataSize_server_proc_t glTexCoordPointerWithDataSize;
36     glVertexPointerWithDataSize_server_proc_t glVertexPointerWithDataSize;
37 
38     int initDispatch( void *(*getProc)(const char *name, void *userData), void *userData);
39 };
40 
41 class GLESv1Decoder : public gles1_decoder_extended_context {
42 public:
43     typedef void *(*get_proc_func_t)(const char *name, void *userData);
44 
45     GLESv1Decoder();
46     ~GLESv1Decoder();
47     int initGL(get_proc_func_t getProcFunc, void *getProcFuncData);
setContextData(GLDecoderContextData * contextData)48     void setContextData(GLDecoderContextData *contextData) { m_contextData = contextData; }
49 
50 private:
51     static void gles1_APIENTRY s_glGetCompressedTextureFormats(void * self, GLint cont, GLint *data);
52     static void gles1_APIENTRY s_glVertexPointerData(void *self, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen);
53     static void gles1_APIENTRY s_glVertexPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset);
54 
55     static void gles1_APIENTRY s_glColorPointerData(void *self, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen);
56     static void gles1_APIENTRY s_glColorPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset);
57 
58     static void gles1_APIENTRY s_glTexCoordPointerData(void *self, GLint unit, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen);
59     static void gles1_APIENTRY s_glTexCoordPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset);
60 
61     static void gles1_APIENTRY s_glNormalPointerData(void *self, GLenum type, GLsizei stride, void *data, GLuint datalen);
62     static void gles1_APIENTRY s_glNormalPointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset);
63 
64     static void gles1_APIENTRY s_glPointSizePointerData(void *self, GLenum type, GLsizei stride, void *data, GLuint datalen);
65     static void gles1_APIENTRY s_glPointSizePointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset);
66 
67     static void gles1_APIENTRY s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset);
68     static void gles1_APIENTRY s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GLenum type, void * data, GLuint datalen);
69 
70     static void gles1_APIENTRY s_glWeightPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen);
71     static void gles1_APIENTRY s_glWeightPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset);
72 
73     static void gles1_APIENTRY s_glMatrixIndexPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen);
74     static void gles1_APIENTRY s_glMatrixIndexPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset);
75 
76     static int gles1_APIENTRY s_glFinishRoundTrip(void *self);
77 
78     static void gles1_APIENTRY s_glGenBuffers(void* self, GLsizei n, GLuint* buffers);
79     static void gles1_APIENTRY s_glGenTextures(void* self, GLsizei n, GLuint* textures);
80     static void gles1_APIENTRY s_glGenRenderbuffersOES(void* self, GLsizei n, GLuint* renderbuffers);
81     static void gles1_APIENTRY s_glGenFramebuffersOES(void* self, GLsizei n, GLuint* framebuffers);
82     static void gles1_APIENTRY s_glGenVertexArraysOES(void* self, GLsizei n, GLuint* arrays);
83 
84     static void gles1_APIENTRY s_glDeleteBuffers(void* self, GLsizei n, const GLuint *buffers);
85     static void gles1_APIENTRY s_glDeleteTextures(void* self, GLsizei n, const GLuint *textures);
86 
87     static void gles1_APIENTRY s_glDeleteRenderbuffersOES(void* self, GLsizei n, const GLuint* renderbuffers);
88     static void gles1_APIENTRY s_glDeleteFramebuffersOES(void* self, GLsizei n, const GLuint* framebuffers);
89 
90     static void gles1_APIENTRY s_glDeleteVertexArraysOES(void* self, GLsizei n, const GLuint *arrays);
91 
92         static void * s_getProc(const char *name, void *userData);
93 
94     GLDecoderContextData *m_contextData;
95     android::base::SharedLibrary* m_glesDso;
96 };
97 
98 }  // namespace gl
99 }  // namespace gfxstream
100 
101 #endif
102