diff options
Diffstat (limited to 'tools/emulator/opengl/system/renderControl_enc')
14 files changed, 1258 insertions, 0 deletions
diff --git a/tools/emulator/opengl/system/renderControl_enc/Android.mk b/tools/emulator/opengl/system/renderControl_enc/Android.mk new file mode 100644 index 000000000..5792440f6 --- /dev/null +++ b/tools/emulator/opengl/system/renderControl_enc/Android.mk @@ -0,0 +1,12 @@ +LOCAL_PATH := $(call my-dir) + +$(call emugl-begin-shared-library,lib_renderControl_enc) + +LOCAL_SRC_FILES := \ + renderControl_client_context.cpp \ + renderControl_enc.cpp \ + renderControl_entry.cpp + +$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)) +$(call emugl-import,libOpenglCodecCommon) +$(call emugl-end-module) diff --git a/tools/emulator/opengl/system/renderControl_enc/README b/tools/emulator/opengl/system/renderControl_enc/README new file mode 100644 index 000000000..2ee1a5701 --- /dev/null +++ b/tools/emulator/opengl/system/renderControl_enc/README @@ -0,0 +1,136 @@ +The renderControl.in file in this directory defines an API which is decoded +on the android guest into a stream and get decoded and executed on the host. +It is used in order to query the host renderer as well as send the host renderer +control commands. + +The following describes each of the entries defined by this renderControl API. + + +GLint rcGetRendererVersion(); + This function queries the host renderer version number. + +EGLint rcGetEGLVersion(EGLint* major, EGLint* minor); + This function queries the host renderer for the EGL version + it supports. returns EGL_FALSE on failure. + +EGLint rcQueryEGLString(EGLenum name, void* buffer, EGLint bufferSize); + This function queries the host for EGL string (.i.e EGL_EXTENSIONS). + if buffer is NULL or the bufferSize is not big enough the return value + is the negative number of bytes required to store the string value + otherwise the string value is copied to buffer and its size is + returned. + +EGLint rcGetNumConfigs(uint32_t* numAttribs); + queries the host for the number of supported EGL configs. + The function returns the number of supported configs and returns in + numAttribs the number of attributes available for each config. + +EGLint rcGetConfigs(uint32_t bufSize, GLuint* buffer); + This function queries the host for the all set of supported configs + with their attribute values. + bufSize is the size of buffer, the size should be at least equal to + (numConfigs + 1) * numAttribs * sizeof(GLuint) + where numConfigs and numAttribs are the values returned in + rcGetNumConfigs. if bufSize is not big enough then the negative number + of required bytes is returned otherwise the function returns the number + of configs and buffer is filled as follows: The first 'numAttribs' + integer values are filled with the EGL enumerant describing a config + attribute, next for each config there are 'numAttribs' integer values + holding the attribute values for that config, the values are specified + in the same order as the attribute vector. + +EGLint rcChooseConfig(EGLint *attribs, uint32_t attribs_size, uint32_t *configs, uint32_t configs_size) + This function triggers an eglChooseConfig on the host, to get a list of + configs matching the given attribs values. + attribs - a list of attribute names followed by the desired values, terminated by EGL_NONE + attribs_size - the size of the list + configs - the returned matching configuration names (same names as familiar to the client in rcGetConfigs) + configs_size - the size of the configs buffers + returns - the actual number of matching configurations (<= configs_size) + +EGLint rcGetFBParam(EGLint param); + queries the host for framebuffer parameter, see renderControl_types.h + for possible values of 'param'. + +uint32_t rcCreateContext(uint32_t config, uint32_t share, uint32_t glVersion); + This function creates a rendering context on the host and returns its + handle. config is the config index for the context, share is either zero + or a handle to a sharing context. glVersion is either 1 or 2 for GLES1 + or GLES2 context respectively. + + +void rcDestroyContext(uint32_t context); + This function destroys a rendering context on the host. + context is a handle returned in rcCreateContext. + +uint32_t rcCreateWindowSurface(uint32_t config, uint32_t width, uint32_t height); + This function creates a 'window' surface on the host which can be then + bind for rendering through rcMakeCurrent. + The function returns a handle to the created window surface. + +void rcDestroyWindowSurface(uint32_t windowSurface); + This function destoys a window surface. + +uint32_t rcCreateColorBuffer(uint32_t width, uint32_t height, GLenum internalFormat); + This function creates a colorBuffer object on the host which can be then + be specified as a render target for a window surface through + rcSetWindowColorBuffer or to be displayed on the framebuffer window + through rcFBPost. + The function returns a handle to the colorBuffer object, with an initial + reference count of 1. + +void rcOpenColorBuffer(uint32_t colorbuffer); + Adds an additional reference to the colorbuffer, typically from a + different Android process than the one which created it. + +void rcCloseColorBuffer(uint32_t colorbuffer); + Removes a reference to the colorbuffer. When the reference count drops + to zero the colorbuffer is automatically destroyed. + +void rcFlushWindowColorBuffer(uint32_t windowSurface, uint32_t colorBuffer); + This flushes the current window color buffer + +void rcSetWindowColorBuffer(uint32_t windowSurface, uint32_t colorBuffer); + This set the target color buffer for a windowSurface, when set the + previous target colorBuffer gets updated before switching to the new + colorBuffer. + +EGLint rcMakeCurrent(uint32_t context, uint32_t drawSurf, uint32_t readSurf); + Binds a windowSurface(s) and current rendering context for the + calling thread. + +void rcFBPost(uint32_t colorBuffer); + This function causes the content of the colorBuffer object to be + displayed on the host framebuffer window. The function returns + immediatly, the buffer will be displayed at the next swap interval. + +void rcFBSetSwapInterval(EGLint interval); + Sets the swap interval for the host framebuffer window. + +void rcBindTexture(uint32_t colorBuffer); + This function instruct the host to bind the content of the specified + colorBuffer to the current binded texture object of the calling thread. + This function should be used to implement eglBindTexImage. + +EGLint rcColorBufferCacheFlush(uint32_t colorbuffer, EGLint postCount, int forRead); + This function returns only after all rendering requests for the specified + colorBuffer rendering target has been processed and after all 'postCount' + posts for the buffer requested previously through rcFBPost has been + processed. + if 'forRead' is not-zero, the function returns positive value in case + there was rendering done to the buffer since the last CacheFlush request + with non-zero 'forRead' value, otherwise the function returns zero or + negative value on failure. + +void rcReadColorBuffer(uint32_t colorbuffer, GLint x, GLint y, + GLint width, GLint height, GLenum format, + GLenum type, void* pixels); + This function queries the host for the pixel content of a colorBuffer's + subregion. It act the same as OpenGL glReadPixels however pixels + are always packed with alignment of 1. + +void rcUpdateColorBuffer(uint32_t colorbuffer, GLint x, GLint y, + GLint width, GLint height, GLenum format, + GLenum type, void* pixels); + Updates the content of a subregion of a colorBuffer object. + pixels are always unpacked with alignment of 1. diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl.attrib b/tools/emulator/opengl/system/renderControl_enc/renderControl.attrib new file mode 100644 index 000000000..8b9972ff7 --- /dev/null +++ b/tools/emulator/opengl/system/renderControl_enc/renderControl.attrib @@ -0,0 +1,41 @@ +GLOBAL + base_opcode 10000 + encoder_headers <stdint.h> <EGL/egl.h> "glUtils.h" + +rcGetEGLVersion + dir major out + len major sizeof(EGLint) + dir minor out + len minor sizeof(EGLint) + +rcQueryEGLString + dir buffer out + len buffer bufferSize + +rcGetGLString + dir buffer out + len buffer bufferSize + +rcGetNumConfigs + dir numAttribs out + len numAttribs sizeof(uint32_t) + +rcGetConfigs + dir buffer out + len buffer bufSize + +rcChooseConfig + dir attribs in + len attribs attribs_size + dir configs out + var_flag configs nullAllowed + len configs configs_size*sizeof(uint32_t) + +rcReadColorBuffer + dir pixels out + len pixels (((glUtilsPixelBitSize(format, type) * width) >> 3) * height) + +rcUpdateColorBuffer + dir pixels in + len pixels (((glUtilsPixelBitSize(format, type) * width) >> 3) * height) + var_flag pixels isLarge diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl.in b/tools/emulator/opengl/system/renderControl_enc/renderControl.in new file mode 100644 index 000000000..8281fd945 --- /dev/null +++ b/tools/emulator/opengl/system/renderControl_enc/renderControl.in @@ -0,0 +1,25 @@ +GL_ENRTY(GLint, rcGetRendererVersion) +GL_ENTRY(EGLint, rcGetEGLVersion, EGLint *major, EGLint *minor) +GL_ENTRY(EGLint, rcQueryEGLString, EGLenum name, void *buffer, EGLint bufferSize) +GL_ENTRY(EGLint, rcGetGLString, EGLenum name, void *buffer, EGLint bufferSize) +GL_ENTRY(EGLint, rcGetNumConfigs, uint32_t *numAttribs) +GL_ENTRY(EGLint, rcGetConfigs, uint32_t bufSize, GLuint *buffer) +GL_ENTRY(EGLint, rcChooseConfig, EGLint *attribs, uint32_t attribs_size, uint32_t *configs, uint32_t configs_size) +GL_ENTRY(EGLint, rcGetFBParam, EGLint param) +GL_ENTRY(uint32_t, rcCreateContext, uint32_t config, uint32_t share, uint32_t glVersion) +GL_ENTRY(void, rcDestroyContext, uint32_t context) +GL_ENTRY(uint32_t, rcCreateWindowSurface, uint32_t config, uint32_t width, uint32_t height) +GL_ENTRY(void, rcDestroyWindowSurface, uint32_t windowSurface) +GL_ENTRY(uint32_t, rcCreateColorBuffer, uint32_t width, uint32_t height, GLenum internalFormat) +GL_ENTRY(void, rcOpenColorBuffer, uint32_t colorbuffer) +GL_ENTRY(void, rcCloseColorBuffer, uint32_t colorbuffer) +GL_ENTRY(void, rcSetWindowColorBuffer, uint32_t windowSurface, uint32_t colorBuffer) +GL_ENTRY(int, rcFlushWindowColorBuffer, uint32_t windowSurface) +GL_ENTRY(EGLint, rcMakeCurrent, uint32_t context, uint32_t drawSurf, uint32_t readSurf) +GL_ENTRY(void, rcFBPost, uint32_t colorBuffer) +GL_ENTRY(void, rcFBSetSwapInterval, EGLint interval) +GL_ENTRY(void, rcBindTexture, uint32_t colorBuffer) +GL_ENTRY(void, rcBindRenderbuffer, uint32_t colorBuffer) +GL_ENTRY(EGLint, rcColorBufferCacheFlush, uint32_t colorbuffer, EGLint postCount,int forRead) +GL_ENTRY(void, rcReadColorBuffer, uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void *pixels) +GL_ENTRY(int, rcUpdateColorBuffer, uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void *pixels) diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl.types b/tools/emulator/opengl/system/renderControl_enc/renderControl.types new file mode 100644 index 000000000..a7d96abf8 --- /dev/null +++ b/tools/emulator/opengl/system/renderControl_enc/renderControl.types @@ -0,0 +1,11 @@ +uint32_t 32 0x%08x false +EGLint 32 0x%08x false +GLint 32 0x%08x false +GLuint 32 0x%08x false +GLenum 32 0x%08x false +EGLenum 32 0x%08x false +uint32_t* 32 0x%08x true +EGLint* 32 0x%08x true +GLint* 32 0x%08x true +GLuint* 32 0x%08x true +void* 32 0x%08x true diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_client_context.cpp b/tools/emulator/opengl/system/renderControl_enc/renderControl_client_context.cpp new file mode 100644 index 000000000..948824847 --- /dev/null +++ b/tools/emulator/opengl/system/renderControl_enc/renderControl_client_context.cpp @@ -0,0 +1,42 @@ +// Generated Code - DO NOT EDIT !! +// generated by 'emugen' + + +#include <string.h> +#include "renderControl_client_context.h" + + +#include <stdio.h> + +int renderControl_client_context_t::initDispatchByName(void *(*getProc)(const char *, void *userData), void *userData) +{ + void *ptr; + + ptr = getProc("rcGetRendererVersion", userData); set_rcGetRendererVersion((rcGetRendererVersion_client_proc_t)ptr); + ptr = getProc("rcGetEGLVersion", userData); set_rcGetEGLVersion((rcGetEGLVersion_client_proc_t)ptr); + ptr = getProc("rcQueryEGLString", userData); set_rcQueryEGLString((rcQueryEGLString_client_proc_t)ptr); + ptr = getProc("rcGetGLString", userData); set_rcGetGLString((rcGetGLString_client_proc_t)ptr); + ptr = getProc("rcGetNumConfigs", userData); set_rcGetNumConfigs((rcGetNumConfigs_client_proc_t)ptr); + ptr = getProc("rcGetConfigs", userData); set_rcGetConfigs((rcGetConfigs_client_proc_t)ptr); + ptr = getProc("rcChooseConfig", userData); set_rcChooseConfig((rcChooseConfig_client_proc_t)ptr); + ptr = getProc("rcGetFBParam", userData); set_rcGetFBParam((rcGetFBParam_client_proc_t)ptr); + ptr = getProc("rcCreateContext", userData); set_rcCreateContext((rcCreateContext_client_proc_t)ptr); + ptr = getProc("rcDestroyContext", userData); set_rcDestroyContext((rcDestroyContext_client_proc_t)ptr); + ptr = getProc("rcCreateWindowSurface", userData); set_rcCreateWindowSurface((rcCreateWindowSurface_client_proc_t)ptr); + ptr = getProc("rcDestroyWindowSurface", userData); set_rcDestroyWindowSurface((rcDestroyWindowSurface_client_proc_t)ptr); + ptr = getProc("rcCreateColorBuffer", userData); set_rcCreateColorBuffer((rcCreateColorBuffer_client_proc_t)ptr); + ptr = getProc("rcOpenColorBuffer", userData); set_rcOpenColorBuffer((rcOpenColorBuffer_client_proc_t)ptr); + ptr = getProc("rcCloseColorBuffer", userData); set_rcCloseColorBuffer((rcCloseColorBuffer_client_proc_t)ptr); + ptr = getProc("rcSetWindowColorBuffer", userData); set_rcSetWindowColorBuffer((rcSetWindowColorBuffer_client_proc_t)ptr); + ptr = getProc("rcFlushWindowColorBuffer", userData); set_rcFlushWindowColorBuffer((rcFlushWindowColorBuffer_client_proc_t)ptr); + ptr = getProc("rcMakeCurrent", userData); set_rcMakeCurrent((rcMakeCurrent_client_proc_t)ptr); + ptr = getProc("rcFBPost", userData); set_rcFBPost((rcFBPost_client_proc_t)ptr); + ptr = getProc("rcFBSetSwapInterval", userData); set_rcFBSetSwapInterval((rcFBSetSwapInterval_client_proc_t)ptr); + ptr = getProc("rcBindTexture", userData); set_rcBindTexture((rcBindTexture_client_proc_t)ptr); + ptr = getProc("rcBindRenderbuffer", userData); set_rcBindRenderbuffer((rcBindRenderbuffer_client_proc_t)ptr); + ptr = getProc("rcColorBufferCacheFlush", userData); set_rcColorBufferCacheFlush((rcColorBufferCacheFlush_client_proc_t)ptr); + ptr = getProc("rcReadColorBuffer", userData); set_rcReadColorBuffer((rcReadColorBuffer_client_proc_t)ptr); + ptr = getProc("rcUpdateColorBuffer", userData); set_rcUpdateColorBuffer((rcUpdateColorBuffer_client_proc_t)ptr); + return 0; +} + diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_client_context.h b/tools/emulator/opengl/system/renderControl_enc/renderControl_client_context.h new file mode 100644 index 000000000..ed2b1fbf4 --- /dev/null +++ b/tools/emulator/opengl/system/renderControl_enc/renderControl_client_context.h @@ -0,0 +1,71 @@ +// Generated Code - DO NOT EDIT !! +// generated by 'emugen' +#ifndef __renderControl_client_context_t_h +#define __renderControl_client_context_t_h + +#include "renderControl_client_proc.h" + + +struct renderControl_client_context_t { + + rcGetRendererVersion_client_proc_t rcGetRendererVersion; + rcGetEGLVersion_client_proc_t rcGetEGLVersion; + rcQueryEGLString_client_proc_t rcQueryEGLString; + rcGetGLString_client_proc_t rcGetGLString; + rcGetNumConfigs_client_proc_t rcGetNumConfigs; + rcGetConfigs_client_proc_t rcGetConfigs; + rcChooseConfig_client_proc_t rcChooseConfig; + rcGetFBParam_client_proc_t rcGetFBParam; + rcCreateContext_client_proc_t rcCreateContext; + rcDestroyContext_client_proc_t rcDestroyContext; + rcCreateWindowSurface_client_proc_t rcCreateWindowSurface; + rcDestroyWindowSurface_client_proc_t rcDestroyWindowSurface; + rcCreateColorBuffer_client_proc_t rcCreateColorBuffer; + rcOpenColorBuffer_client_proc_t rcOpenColorBuffer; + rcCloseColorBuffer_client_proc_t rcCloseColorBuffer; + rcSetWindowColorBuffer_client_proc_t rcSetWindowColorBuffer; + rcFlushWindowColorBuffer_client_proc_t rcFlushWindowColorBuffer; + rcMakeCurrent_client_proc_t rcMakeCurrent; + rcFBPost_client_proc_t rcFBPost; + rcFBSetSwapInterval_client_proc_t rcFBSetSwapInterval; + rcBindTexture_client_proc_t rcBindTexture; + rcBindRenderbuffer_client_proc_t rcBindRenderbuffer; + rcColorBufferCacheFlush_client_proc_t rcColorBufferCacheFlush; + rcReadColorBuffer_client_proc_t rcReadColorBuffer; + rcUpdateColorBuffer_client_proc_t rcUpdateColorBuffer; + //Accessors + virtual rcGetRendererVersion_client_proc_t set_rcGetRendererVersion(rcGetRendererVersion_client_proc_t f) { rcGetRendererVersion_client_proc_t retval = rcGetRendererVersion; rcGetRendererVersion = f; return retval;} + virtual rcGetEGLVersion_client_proc_t set_rcGetEGLVersion(rcGetEGLVersion_client_proc_t f) { rcGetEGLVersion_client_proc_t retval = rcGetEGLVersion; rcGetEGLVersion = f; return retval;} + virtual rcQueryEGLString_client_proc_t set_rcQueryEGLString(rcQueryEGLString_client_proc_t f) { rcQueryEGLString_client_proc_t retval = rcQueryEGLString; rcQueryEGLString = f; return retval;} + virtual rcGetGLString_client_proc_t set_rcGetGLString(rcGetGLString_client_proc_t f) { rcGetGLString_client_proc_t retval = rcGetGLString; rcGetGLString = f; return retval;} + virtual rcGetNumConfigs_client_proc_t set_rcGetNumConfigs(rcGetNumConfigs_client_proc_t f) { rcGetNumConfigs_client_proc_t retval = rcGetNumConfigs; rcGetNumConfigs = f; return retval;} + virtual rcGetConfigs_client_proc_t set_rcGetConfigs(rcGetConfigs_client_proc_t f) { rcGetConfigs_client_proc_t retval = rcGetConfigs; rcGetConfigs = f; return retval;} + virtual rcChooseConfig_client_proc_t set_rcChooseConfig(rcChooseConfig_client_proc_t f) { rcChooseConfig_client_proc_t retval = rcChooseConfig; rcChooseConfig = f; return retval;} + virtual rcGetFBParam_client_proc_t set_rcGetFBParam(rcGetFBParam_client_proc_t f) { rcGetFBParam_client_proc_t retval = rcGetFBParam; rcGetFBParam = f; return retval;} + virtual rcCreateContext_client_proc_t set_rcCreateContext(rcCreateContext_client_proc_t f) { rcCreateContext_client_proc_t retval = rcCreateContext; rcCreateContext = f; return retval;} + virtual rcDestroyContext_client_proc_t set_rcDestroyContext(rcDestroyContext_client_proc_t f) { rcDestroyContext_client_proc_t retval = rcDestroyContext; rcDestroyContext = f; return retval;} + virtual rcCreateWindowSurface_client_proc_t set_rcCreateWindowSurface(rcCreateWindowSurface_client_proc_t f) { rcCreateWindowSurface_client_proc_t retval = rcCreateWindowSurface; rcCreateWindowSurface = f; return retval;} + virtual rcDestroyWindowSurface_client_proc_t set_rcDestroyWindowSurface(rcDestroyWindowSurface_client_proc_t f) { rcDestroyWindowSurface_client_proc_t retval = rcDestroyWindowSurface; rcDestroyWindowSurface = f; return retval;} + virtual rcCreateColorBuffer_client_proc_t set_rcCreateColorBuffer(rcCreateColorBuffer_client_proc_t f) { rcCreateColorBuffer_client_proc_t retval = rcCreateColorBuffer; rcCreateColorBuffer = f; return retval;} + virtual rcOpenColorBuffer_client_proc_t set_rcOpenColorBuffer(rcOpenColorBuffer_client_proc_t f) { rcOpenColorBuffer_client_proc_t retval = rcOpenColorBuffer; rcOpenColorBuffer = f; return retval;} + virtual rcCloseColorBuffer_client_proc_t set_rcCloseColorBuffer(rcCloseColorBuffer_client_proc_t f) { rcCloseColorBuffer_client_proc_t retval = rcCloseColorBuffer; rcCloseColorBuffer = f; return retval;} + virtual rcSetWindowColorBuffer_client_proc_t set_rcSetWindowColorBuffer(rcSetWindowColorBuffer_client_proc_t f) { rcSetWindowColorBuffer_client_proc_t retval = rcSetWindowColorBuffer; rcSetWindowColorBuffer = f; return retval;} + virtual rcFlushWindowColorBuffer_client_proc_t set_rcFlushWindowColorBuffer(rcFlushWindowColorBuffer_client_proc_t f) { rcFlushWindowColorBuffer_client_proc_t retval = rcFlushWindowColorBuffer; rcFlushWindowColorBuffer = f; return retval;} + virtual rcMakeCurrent_client_proc_t set_rcMakeCurrent(rcMakeCurrent_client_proc_t f) { rcMakeCurrent_client_proc_t retval = rcMakeCurrent; rcMakeCurrent = f; return retval;} + virtual rcFBPost_client_proc_t set_rcFBPost(rcFBPost_client_proc_t f) { rcFBPost_client_proc_t retval = rcFBPost; rcFBPost = f; return retval;} + virtual rcFBSetSwapInterval_client_proc_t set_rcFBSetSwapInterval(rcFBSetSwapInterval_client_proc_t f) { rcFBSetSwapInterval_client_proc_t retval = rcFBSetSwapInterval; rcFBSetSwapInterval = f; return retval;} + virtual rcBindTexture_client_proc_t set_rcBindTexture(rcBindTexture_client_proc_t f) { rcBindTexture_client_proc_t retval = rcBindTexture; rcBindTexture = f; return retval;} + virtual rcBindRenderbuffer_client_proc_t set_rcBindRenderbuffer(rcBindRenderbuffer_client_proc_t f) { rcBindRenderbuffer_client_proc_t retval = rcBindRenderbuffer; rcBindRenderbuffer = f; return retval;} + virtual rcColorBufferCacheFlush_client_proc_t set_rcColorBufferCacheFlush(rcColorBufferCacheFlush_client_proc_t f) { rcColorBufferCacheFlush_client_proc_t retval = rcColorBufferCacheFlush; rcColorBufferCacheFlush = f; return retval;} + virtual rcReadColorBuffer_client_proc_t set_rcReadColorBuffer(rcReadColorBuffer_client_proc_t f) { rcReadColorBuffer_client_proc_t retval = rcReadColorBuffer; rcReadColorBuffer = f; return retval;} + virtual rcUpdateColorBuffer_client_proc_t set_rcUpdateColorBuffer(rcUpdateColorBuffer_client_proc_t f) { rcUpdateColorBuffer_client_proc_t retval = rcUpdateColorBuffer; rcUpdateColorBuffer = f; return retval;} + virtual ~renderControl_client_context_t() {} + + typedef renderControl_client_context_t *CONTEXT_ACCESSOR_TYPE(void); + static void setContextAccessor(CONTEXT_ACCESSOR_TYPE *f); + int initDispatchByName( void *(*getProc)(const char *name, void *userData), void *userData); + virtual void setError(unsigned int error){}; + virtual unsigned int getError(){ return 0; }; +}; + +#endif diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_client_proc.h b/tools/emulator/opengl/system/renderControl_enc/renderControl_client_proc.h new file mode 100644 index 000000000..3e00290b9 --- /dev/null +++ b/tools/emulator/opengl/system/renderControl_enc/renderControl_client_proc.h @@ -0,0 +1,39 @@ +// Generated Code - DO NOT EDIT !! +// generated by 'emugen' +#ifndef __renderControl_client_proc_t_h +#define __renderControl_client_proc_t_h + + + +#include "renderControl_types.h" +#ifndef renderControl_APIENTRY +#define renderControl_APIENTRY +#endif +typedef GLint (renderControl_APIENTRY *rcGetRendererVersion_client_proc_t) (void * ctx); +typedef EGLint (renderControl_APIENTRY *rcGetEGLVersion_client_proc_t) (void * ctx, EGLint*, EGLint*); +typedef EGLint (renderControl_APIENTRY *rcQueryEGLString_client_proc_t) (void * ctx, EGLenum, void*, EGLint); +typedef EGLint (renderControl_APIENTRY *rcGetGLString_client_proc_t) (void * ctx, EGLenum, void*, EGLint); +typedef EGLint (renderControl_APIENTRY *rcGetNumConfigs_client_proc_t) (void * ctx, uint32_t*); +typedef EGLint (renderControl_APIENTRY *rcGetConfigs_client_proc_t) (void * ctx, uint32_t, GLuint*); +typedef EGLint (renderControl_APIENTRY *rcChooseConfig_client_proc_t) (void * ctx, EGLint*, uint32_t, uint32_t*, uint32_t); +typedef EGLint (renderControl_APIENTRY *rcGetFBParam_client_proc_t) (void * ctx, EGLint); +typedef uint32_t (renderControl_APIENTRY *rcCreateContext_client_proc_t) (void * ctx, uint32_t, uint32_t, uint32_t); +typedef void (renderControl_APIENTRY *rcDestroyContext_client_proc_t) (void * ctx, uint32_t); +typedef uint32_t (renderControl_APIENTRY *rcCreateWindowSurface_client_proc_t) (void * ctx, uint32_t, uint32_t, uint32_t); +typedef void (renderControl_APIENTRY *rcDestroyWindowSurface_client_proc_t) (void * ctx, uint32_t); +typedef uint32_t (renderControl_APIENTRY *rcCreateColorBuffer_client_proc_t) (void * ctx, uint32_t, uint32_t, GLenum); +typedef void (renderControl_APIENTRY *rcOpenColorBuffer_client_proc_t) (void * ctx, uint32_t); +typedef void (renderControl_APIENTRY *rcCloseColorBuffer_client_proc_t) (void * ctx, uint32_t); +typedef void (renderControl_APIENTRY *rcSetWindowColorBuffer_client_proc_t) (void * ctx, uint32_t, uint32_t); +typedef int (renderControl_APIENTRY *rcFlushWindowColorBuffer_client_proc_t) (void * ctx, uint32_t); +typedef EGLint (renderControl_APIENTRY *rcMakeCurrent_client_proc_t) (void * ctx, uint32_t, uint32_t, uint32_t); +typedef void (renderControl_APIENTRY *rcFBPost_client_proc_t) (void * ctx, uint32_t); +typedef void (renderControl_APIENTRY *rcFBSetSwapInterval_client_proc_t) (void * ctx, EGLint); +typedef void (renderControl_APIENTRY *rcBindTexture_client_proc_t) (void * ctx, uint32_t); +typedef void (renderControl_APIENTRY *rcBindRenderbuffer_client_proc_t) (void * ctx, uint32_t); +typedef EGLint (renderControl_APIENTRY *rcColorBufferCacheFlush_client_proc_t) (void * ctx, uint32_t, EGLint, int); +typedef void (renderControl_APIENTRY *rcReadColorBuffer_client_proc_t) (void * ctx, uint32_t, GLint, GLint, GLint, GLint, GLenum, GLenum, void*); +typedef int (renderControl_APIENTRY *rcUpdateColorBuffer_client_proc_t) (void * ctx, uint32_t, GLint, GLint, GLint, GLint, GLenum, GLenum, void*); + + +#endif diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_enc.cpp b/tools/emulator/opengl/system/renderControl_enc/renderControl_enc.cpp new file mode 100644 index 000000000..94e256ad3 --- /dev/null +++ b/tools/emulator/opengl/system/renderControl_enc/renderControl_enc.cpp @@ -0,0 +1,536 @@ +// Generated Code - DO NOT EDIT !! +// generated by 'emugen' + + +#include <string.h> +#include "renderControl_opcodes.h" + +#include "renderControl_enc.h" + + +#include <stdio.h> +static void enc_unsupported() +{ + ALOGE("Function is unsupported\n"); +} + +GLint rcGetRendererVersion_enc(void *self ) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8; + ptr = stream->alloc(packetSize); + int tmp = OP_rcGetRendererVersion;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + + GLint retval; + stream->readback(&retval, 4); + return retval; +} + +EGLint rcGetEGLVersion_enc(void *self , EGLint* major, EGLint* minor) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + const unsigned int __size_major = sizeof(EGLint); + const unsigned int __size_minor = sizeof(EGLint); + unsigned char *ptr; + const size_t packetSize = 8 + __size_major + __size_minor + 2*4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcGetEGLVersion;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + *(unsigned int *)(ptr) = __size_major; ptr += 4; + *(unsigned int *)(ptr) = __size_minor; ptr += 4; + stream->readback(major, __size_major); + stream->readback(minor, __size_minor); + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +EGLint rcQueryEGLString_enc(void *self , EGLenum name, void* buffer, EGLint bufferSize) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + const unsigned int __size_buffer = bufferSize; + unsigned char *ptr; + const size_t packetSize = 8 + 4 + __size_buffer + 4 + 1*4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcQueryEGLString;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &name, 4); ptr += 4; + *(unsigned int *)(ptr) = __size_buffer; ptr += 4; + memcpy(ptr, &bufferSize, 4); ptr += 4; + stream->readback(buffer, __size_buffer); + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +EGLint rcGetGLString_enc(void *self , EGLenum name, void* buffer, EGLint bufferSize) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + const unsigned int __size_buffer = bufferSize; + unsigned char *ptr; + const size_t packetSize = 8 + 4 + __size_buffer + 4 + 1*4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcGetGLString;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &name, 4); ptr += 4; + *(unsigned int *)(ptr) = __size_buffer; ptr += 4; + memcpy(ptr, &bufferSize, 4); ptr += 4; + stream->readback(buffer, __size_buffer); + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +EGLint rcGetNumConfigs_enc(void *self , uint32_t* numAttribs) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + const unsigned int __size_numAttribs = sizeof(uint32_t); + unsigned char *ptr; + const size_t packetSize = 8 + __size_numAttribs + 1*4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcGetNumConfigs;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + *(unsigned int *)(ptr) = __size_numAttribs; ptr += 4; + stream->readback(numAttribs, __size_numAttribs); + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +EGLint rcGetConfigs_enc(void *self , uint32_t bufSize, GLuint* buffer) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + const unsigned int __size_buffer = bufSize; + unsigned char *ptr; + const size_t packetSize = 8 + 4 + __size_buffer + 1*4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcGetConfigs;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &bufSize, 4); ptr += 4; + *(unsigned int *)(ptr) = __size_buffer; ptr += 4; + stream->readback(buffer, __size_buffer); + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +EGLint rcChooseConfig_enc(void *self , EGLint* attribs, uint32_t attribs_size, uint32_t* configs, uint32_t configs_size) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + const unsigned int __size_attribs = attribs_size; + const unsigned int __size_configs = ((configs != NULL) ? configs_size*sizeof(uint32_t) : 0); + unsigned char *ptr; + const size_t packetSize = 8 + __size_attribs + 4 + __size_configs + 4 + 2*4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcChooseConfig;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + *(unsigned int *)(ptr) = __size_attribs; ptr += 4; + memcpy(ptr, attribs, __size_attribs);ptr += __size_attribs; + memcpy(ptr, &attribs_size, 4); ptr += 4; + *(unsigned int *)(ptr) = __size_configs; ptr += 4; + memcpy(ptr, &configs_size, 4); ptr += 4; + if (configs != NULL) stream->readback(configs, __size_configs); + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +EGLint rcGetFBParam_enc(void *self , EGLint param) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcGetFBParam;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, ¶m, 4); ptr += 4; + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +uint32_t rcCreateContext_enc(void *self , uint32_t config, uint32_t share, uint32_t glVersion) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4 + 4 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcCreateContext;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &config, 4); ptr += 4; + memcpy(ptr, &share, 4); ptr += 4; + memcpy(ptr, &glVersion, 4); ptr += 4; + + uint32_t retval; + stream->readback(&retval, 4); + return retval; +} + +void rcDestroyContext_enc(void *self , uint32_t context) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcDestroyContext;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &context, 4); ptr += 4; +} + +uint32_t rcCreateWindowSurface_enc(void *self , uint32_t config, uint32_t width, uint32_t height) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4 + 4 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcCreateWindowSurface;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &config, 4); ptr += 4; + memcpy(ptr, &width, 4); ptr += 4; + memcpy(ptr, &height, 4); ptr += 4; + + uint32_t retval; + stream->readback(&retval, 4); + return retval; +} + +void rcDestroyWindowSurface_enc(void *self , uint32_t windowSurface) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcDestroyWindowSurface;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &windowSurface, 4); ptr += 4; +} + +uint32_t rcCreateColorBuffer_enc(void *self , uint32_t width, uint32_t height, GLenum internalFormat) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4 + 4 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcCreateColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &width, 4); ptr += 4; + memcpy(ptr, &height, 4); ptr += 4; + memcpy(ptr, &internalFormat, 4); ptr += 4; + + uint32_t retval; + stream->readback(&retval, 4); + return retval; +} + +void rcOpenColorBuffer_enc(void *self , uint32_t colorbuffer) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcOpenColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &colorbuffer, 4); ptr += 4; +} + +void rcCloseColorBuffer_enc(void *self , uint32_t colorbuffer) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcCloseColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &colorbuffer, 4); ptr += 4; +} + +void rcSetWindowColorBuffer_enc(void *self , uint32_t windowSurface, uint32_t colorBuffer) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcSetWindowColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &windowSurface, 4); ptr += 4; + memcpy(ptr, &colorBuffer, 4); ptr += 4; +} + +int rcFlushWindowColorBuffer_enc(void *self , uint32_t windowSurface) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcFlushWindowColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &windowSurface, 4); ptr += 4; + + int retval; + stream->readback(&retval, 4); + return retval; +} + +EGLint rcMakeCurrent_enc(void *self , uint32_t context, uint32_t drawSurf, uint32_t readSurf) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4 + 4 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcMakeCurrent;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &context, 4); ptr += 4; + memcpy(ptr, &drawSurf, 4); ptr += 4; + memcpy(ptr, &readSurf, 4); ptr += 4; + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +void rcFBPost_enc(void *self , uint32_t colorBuffer) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcFBPost;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &colorBuffer, 4); ptr += 4; +} + +void rcFBSetSwapInterval_enc(void *self , EGLint interval) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcFBSetSwapInterval;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &interval, 4); ptr += 4; +} + +void rcBindTexture_enc(void *self , uint32_t colorBuffer) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcBindTexture;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &colorBuffer, 4); ptr += 4; +} + +void rcBindRenderbuffer_enc(void *self , uint32_t colorBuffer) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcBindRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &colorBuffer, 4); ptr += 4; +} + +EGLint rcColorBufferCacheFlush_enc(void *self , uint32_t colorbuffer, EGLint postCount, int forRead) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4 + 4 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcColorBufferCacheFlush;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &colorbuffer, 4); ptr += 4; + memcpy(ptr, &postCount, 4); ptr += 4; + memcpy(ptr, &forRead, 4); ptr += 4; + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +void rcReadColorBuffer_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + const unsigned int __size_pixels = (((glUtilsPixelBitSize(format, type) * width) >> 3) * height); + unsigned char *ptr; + const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcReadColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &colorbuffer, 4); ptr += 4; + memcpy(ptr, &x, 4); ptr += 4; + memcpy(ptr, &y, 4); ptr += 4; + memcpy(ptr, &width, 4); ptr += 4; + memcpy(ptr, &height, 4); ptr += 4; + memcpy(ptr, &format, 4); ptr += 4; + memcpy(ptr, &type, 4); ptr += 4; + *(unsigned int *)(ptr) = __size_pixels; ptr += 4; + stream->readback(pixels, __size_pixels); +} + +int rcUpdateColorBuffer_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + const unsigned int __size_pixels = (((glUtilsPixelBitSize(format, type) * width) >> 3) * height); + unsigned char *ptr; + const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; + ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4); + int tmp = OP_rcUpdateColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &colorbuffer, 4); ptr += 4; + memcpy(ptr, &x, 4); ptr += 4; + memcpy(ptr, &y, 4); ptr += 4; + memcpy(ptr, &width, 4); ptr += 4; + memcpy(ptr, &height, 4); ptr += 4; + memcpy(ptr, &format, 4); ptr += 4; + memcpy(ptr, &type, 4); ptr += 4; + stream->flush(); + stream->writeFully(&__size_pixels,4); + stream->writeFully(pixels, __size_pixels); + + int retval; + stream->readback(&retval, 4); + return retval; +} + +renderControl_encoder_context_t::renderControl_encoder_context_t(IOStream *stream) +{ + m_stream = stream; + + set_rcGetRendererVersion(rcGetRendererVersion_enc); + set_rcGetEGLVersion(rcGetEGLVersion_enc); + set_rcQueryEGLString(rcQueryEGLString_enc); + set_rcGetGLString(rcGetGLString_enc); + set_rcGetNumConfigs(rcGetNumConfigs_enc); + set_rcGetConfigs(rcGetConfigs_enc); + set_rcChooseConfig(rcChooseConfig_enc); + set_rcGetFBParam(rcGetFBParam_enc); + set_rcCreateContext(rcCreateContext_enc); + set_rcDestroyContext(rcDestroyContext_enc); + set_rcCreateWindowSurface(rcCreateWindowSurface_enc); + set_rcDestroyWindowSurface(rcDestroyWindowSurface_enc); + set_rcCreateColorBuffer(rcCreateColorBuffer_enc); + set_rcOpenColorBuffer(rcOpenColorBuffer_enc); + set_rcCloseColorBuffer(rcCloseColorBuffer_enc); + set_rcSetWindowColorBuffer(rcSetWindowColorBuffer_enc); + set_rcFlushWindowColorBuffer(rcFlushWindowColorBuffer_enc); + set_rcMakeCurrent(rcMakeCurrent_enc); + set_rcFBPost(rcFBPost_enc); + set_rcFBSetSwapInterval(rcFBSetSwapInterval_enc); + set_rcBindTexture(rcBindTexture_enc); + set_rcBindRenderbuffer(rcBindRenderbuffer_enc); + set_rcColorBufferCacheFlush(rcColorBufferCacheFlush_enc); + set_rcReadColorBuffer(rcReadColorBuffer_enc); + set_rcUpdateColorBuffer(rcUpdateColorBuffer_enc); +} + diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_enc.h b/tools/emulator/opengl/system/renderControl_enc/renderControl_enc.h new file mode 100644 index 000000000..712eeb9d3 --- /dev/null +++ b/tools/emulator/opengl/system/renderControl_enc/renderControl_enc.h @@ -0,0 +1,51 @@ +// Generated Code - DO NOT EDIT !! +// generated by 'emugen' + +#ifndef GUARD_renderControl_encoder_context_t +#define GUARD_renderControl_encoder_context_t + +#include "IOStream.h" +#include "renderControl_client_context.h" + + +#include <stdint.h> +#include <EGL/egl.h> +#include "glUtils.h" + +struct renderControl_encoder_context_t : public renderControl_client_context_t { + + IOStream *m_stream; + + renderControl_encoder_context_t(IOStream *stream); + + +}; + +extern "C" { + GLint rcGetRendererVersion_enc(void *self ); + EGLint rcGetEGLVersion_enc(void *self , EGLint* major, EGLint* minor); + EGLint rcQueryEGLString_enc(void *self , EGLenum name, void* buffer, EGLint bufferSize); + EGLint rcGetGLString_enc(void *self , EGLenum name, void* buffer, EGLint bufferSize); + EGLint rcGetNumConfigs_enc(void *self , uint32_t* numAttribs); + EGLint rcGetConfigs_enc(void *self , uint32_t bufSize, GLuint* buffer); + EGLint rcChooseConfig_enc(void *self , EGLint* attribs, uint32_t attribs_size, uint32_t* configs, uint32_t configs_size); + EGLint rcGetFBParam_enc(void *self , EGLint param); + uint32_t rcCreateContext_enc(void *self , uint32_t config, uint32_t share, uint32_t glVersion); + void rcDestroyContext_enc(void *self , uint32_t context); + uint32_t rcCreateWindowSurface_enc(void *self , uint32_t config, uint32_t width, uint32_t height); + void rcDestroyWindowSurface_enc(void *self , uint32_t windowSurface); + uint32_t rcCreateColorBuffer_enc(void *self , uint32_t width, uint32_t height, GLenum internalFormat); + void rcOpenColorBuffer_enc(void *self , uint32_t colorbuffer); + void rcCloseColorBuffer_enc(void *self , uint32_t colorbuffer); + void rcSetWindowColorBuffer_enc(void *self , uint32_t windowSurface, uint32_t colorBuffer); + int rcFlushWindowColorBuffer_enc(void *self , uint32_t windowSurface); + EGLint rcMakeCurrent_enc(void *self , uint32_t context, uint32_t drawSurf, uint32_t readSurf); + void rcFBPost_enc(void *self , uint32_t colorBuffer); + void rcFBSetSwapInterval_enc(void *self , EGLint interval); + void rcBindTexture_enc(void *self , uint32_t colorBuffer); + void rcBindRenderbuffer_enc(void *self , uint32_t colorBuffer); + EGLint rcColorBufferCacheFlush_enc(void *self , uint32_t colorbuffer, EGLint postCount, int forRead); + void rcReadColorBuffer_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels); + int rcUpdateColorBuffer_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels); +}; +#endif
\ No newline at end of file diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_entry.cpp b/tools/emulator/opengl/system/renderControl_enc/renderControl_entry.cpp new file mode 100644 index 000000000..9a0bba99c --- /dev/null +++ b/tools/emulator/opengl/system/renderControl_enc/renderControl_entry.cpp @@ -0,0 +1,192 @@ +// Generated Code - DO NOT EDIT !! +// generated by 'emugen' +#include <stdio.h> +#include <stdlib.h> +#include "renderControl_client_context.h" + +#ifndef GL_TRUE +extern "C" { + GLint rcGetRendererVersion(); + EGLint rcGetEGLVersion(EGLint* major, EGLint* minor); + EGLint rcQueryEGLString(EGLenum name, void* buffer, EGLint bufferSize); + EGLint rcGetGLString(EGLenum name, void* buffer, EGLint bufferSize); + EGLint rcGetNumConfigs(uint32_t* numAttribs); + EGLint rcGetConfigs(uint32_t bufSize, GLuint* buffer); + EGLint rcChooseConfig(EGLint* attribs, uint32_t attribs_size, uint32_t* configs, uint32_t configs_size); + EGLint rcGetFBParam(EGLint param); + uint32_t rcCreateContext(uint32_t config, uint32_t share, uint32_t glVersion); + void rcDestroyContext(uint32_t context); + uint32_t rcCreateWindowSurface(uint32_t config, uint32_t width, uint32_t height); + void rcDestroyWindowSurface(uint32_t windowSurface); + uint32_t rcCreateColorBuffer(uint32_t width, uint32_t height, GLenum internalFormat); + void rcOpenColorBuffer(uint32_t colorbuffer); + void rcCloseColorBuffer(uint32_t colorbuffer); + void rcSetWindowColorBuffer(uint32_t windowSurface, uint32_t colorBuffer); + int rcFlushWindowColorBuffer(uint32_t windowSurface); + EGLint rcMakeCurrent(uint32_t context, uint32_t drawSurf, uint32_t readSurf); + void rcFBPost(uint32_t colorBuffer); + void rcFBSetSwapInterval(EGLint interval); + void rcBindTexture(uint32_t colorBuffer); + void rcBindRenderbuffer(uint32_t colorBuffer); + EGLint rcColorBufferCacheFlush(uint32_t colorbuffer, EGLint postCount, int forRead); + void rcReadColorBuffer(uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels); + int rcUpdateColorBuffer(uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels); +}; + +#endif +#ifndef GET_CONTEXT +static renderControl_client_context_t::CONTEXT_ACCESSOR_TYPE *getCurrentContext = NULL; +void renderControl_client_context_t::setContextAccessor(CONTEXT_ACCESSOR_TYPE *f) { getCurrentContext = f; } +#define GET_CONTEXT renderControl_client_context_t * ctx = getCurrentContext() +#endif + +GLint rcGetRendererVersion() +{ + GET_CONTEXT; + return ctx->rcGetRendererVersion(ctx); +} + +EGLint rcGetEGLVersion(EGLint* major, EGLint* minor) +{ + GET_CONTEXT; + return ctx->rcGetEGLVersion(ctx, major, minor); +} + +EGLint rcQueryEGLString(EGLenum name, void* buffer, EGLint bufferSize) +{ + GET_CONTEXT; + return ctx->rcQueryEGLString(ctx, name, buffer, bufferSize); +} + +EGLint rcGetGLString(EGLenum name, void* buffer, EGLint bufferSize) +{ + GET_CONTEXT; + return ctx->rcGetGLString(ctx, name, buffer, bufferSize); +} + +EGLint rcGetNumConfigs(uint32_t* numAttribs) +{ + GET_CONTEXT; + return ctx->rcGetNumConfigs(ctx, numAttribs); +} + +EGLint rcGetConfigs(uint32_t bufSize, GLuint* buffer) +{ + GET_CONTEXT; + return ctx->rcGetConfigs(ctx, bufSize, buffer); +} + +EGLint rcChooseConfig(EGLint* attribs, uint32_t attribs_size, uint32_t* configs, uint32_t configs_size) +{ + GET_CONTEXT; + return ctx->rcChooseConfig(ctx, attribs, attribs_size, configs, configs_size); +} + +EGLint rcGetFBParam(EGLint param) +{ + GET_CONTEXT; + return ctx->rcGetFBParam(ctx, param); +} + +uint32_t rcCreateContext(uint32_t config, uint32_t share, uint32_t glVersion) +{ + GET_CONTEXT; + return ctx->rcCreateContext(ctx, config, share, glVersion); +} + +void rcDestroyContext(uint32_t context) +{ + GET_CONTEXT; + ctx->rcDestroyContext(ctx, context); +} + +uint32_t rcCreateWindowSurface(uint32_t config, uint32_t width, uint32_t height) +{ + GET_CONTEXT; + return ctx->rcCreateWindowSurface(ctx, config, width, height); +} + +void rcDestroyWindowSurface(uint32_t windowSurface) +{ + GET_CONTEXT; + ctx->rcDestroyWindowSurface(ctx, windowSurface); +} + +uint32_t rcCreateColorBuffer(uint32_t width, uint32_t height, GLenum internalFormat) +{ + GET_CONTEXT; + return ctx->rcCreateColorBuffer(ctx, width, height, internalFormat); +} + +void rcOpenColorBuffer(uint32_t colorbuffer) +{ + GET_CONTEXT; + ctx->rcOpenColorBuffer(ctx, colorbuffer); +} + +void rcCloseColorBuffer(uint32_t colorbuffer) +{ + GET_CONTEXT; + ctx->rcCloseColorBuffer(ctx, colorbuffer); +} + +void rcSetWindowColorBuffer(uint32_t windowSurface, uint32_t colorBuffer) +{ + GET_CONTEXT; + ctx->rcSetWindowColorBuffer(ctx, windowSurface, colorBuffer); +} + +int rcFlushWindowColorBuffer(uint32_t windowSurface) +{ + GET_CONTEXT; + return ctx->rcFlushWindowColorBuffer(ctx, windowSurface); +} + +EGLint rcMakeCurrent(uint32_t context, uint32_t drawSurf, uint32_t readSurf) +{ + GET_CONTEXT; + return ctx->rcMakeCurrent(ctx, context, drawSurf, readSurf); +} + +void rcFBPost(uint32_t colorBuffer) +{ + GET_CONTEXT; + ctx->rcFBPost(ctx, colorBuffer); +} + +void rcFBSetSwapInterval(EGLint interval) +{ + GET_CONTEXT; + ctx->rcFBSetSwapInterval(ctx, interval); +} + +void rcBindTexture(uint32_t colorBuffer) +{ + GET_CONTEXT; + ctx->rcBindTexture(ctx, colorBuffer); +} + +void rcBindRenderbuffer(uint32_t colorBuffer) +{ + GET_CONTEXT; + ctx->rcBindRenderbuffer(ctx, colorBuffer); +} + +EGLint rcColorBufferCacheFlush(uint32_t colorbuffer, EGLint postCount, int forRead) +{ + GET_CONTEXT; + return ctx->rcColorBufferCacheFlush(ctx, colorbuffer, postCount, forRead); +} + +void rcReadColorBuffer(uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels) +{ + GET_CONTEXT; + ctx->rcReadColorBuffer(ctx, colorbuffer, x, y, width, height, format, type, pixels); +} + +int rcUpdateColorBuffer(uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels) +{ + GET_CONTEXT; + return ctx->rcUpdateColorBuffer(ctx, colorbuffer, x, y, width, height, format, type, pixels); +} + diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_ftable.h b/tools/emulator/opengl/system/renderControl_enc/renderControl_ftable.h new file mode 100644 index 000000000..1e9e2f937 --- /dev/null +++ b/tools/emulator/opengl/system/renderControl_enc/renderControl_ftable.h @@ -0,0 +1,40 @@ +// Generated Code - DO NOT EDIT !! +// generated by 'emugen' +#ifndef __renderControl_client_ftable_t_h +#define __renderControl_client_ftable_t_h + + +static struct _renderControl_funcs_by_name { + const char *name; + void *proc; +} renderControl_funcs_by_name[] = { + {"rcGetRendererVersion", (void*)rcGetRendererVersion}, + {"rcGetEGLVersion", (void*)rcGetEGLVersion}, + {"rcQueryEGLString", (void*)rcQueryEGLString}, + {"rcGetGLString", (void*)rcGetGLString}, + {"rcGetNumConfigs", (void*)rcGetNumConfigs}, + {"rcGetConfigs", (void*)rcGetConfigs}, + {"rcChooseConfig", (void*)rcChooseConfig}, + {"rcGetFBParam", (void*)rcGetFBParam}, + {"rcCreateContext", (void*)rcCreateContext}, + {"rcDestroyContext", (void*)rcDestroyContext}, + {"rcCreateWindowSurface", (void*)rcCreateWindowSurface}, + {"rcDestroyWindowSurface", (void*)rcDestroyWindowSurface}, + {"rcCreateColorBuffer", (void*)rcCreateColorBuffer}, + {"rcOpenColorBuffer", (void*)rcOpenColorBuffer}, + {"rcCloseColorBuffer", (void*)rcCloseColorBuffer}, + {"rcSetWindowColorBuffer", (void*)rcSetWindowColorBuffer}, + {"rcFlushWindowColorBuffer", (void*)rcFlushWindowColorBuffer}, + {"rcMakeCurrent", (void*)rcMakeCurrent}, + {"rcFBPost", (void*)rcFBPost}, + {"rcFBSetSwapInterval", (void*)rcFBSetSwapInterval}, + {"rcBindTexture", (void*)rcBindTexture}, + {"rcBindRenderbuffer", (void*)rcBindRenderbuffer}, + {"rcColorBufferCacheFlush", (void*)rcColorBufferCacheFlush}, + {"rcReadColorBuffer", (void*)rcReadColorBuffer}, + {"rcUpdateColorBuffer", (void*)rcUpdateColorBuffer}, +}; +static int renderControl_num_funcs = sizeof(renderControl_funcs_by_name) / sizeof(struct _renderControl_funcs_by_name); + + +#endif diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_opcodes.h b/tools/emulator/opengl/system/renderControl_enc/renderControl_opcodes.h new file mode 100644 index 000000000..b44f5d06a --- /dev/null +++ b/tools/emulator/opengl/system/renderControl_enc/renderControl_opcodes.h @@ -0,0 +1,34 @@ +// Generated Code - DO NOT EDIT !! +// generated by 'emugen' +#ifndef __GUARD_renderControl_opcodes_h_ +#define __GUARD_renderControl_opcodes_h_ + +#define OP_rcGetRendererVersion 10000 +#define OP_rcGetEGLVersion 10001 +#define OP_rcQueryEGLString 10002 +#define OP_rcGetGLString 10003 +#define OP_rcGetNumConfigs 10004 +#define OP_rcGetConfigs 10005 +#define OP_rcChooseConfig 10006 +#define OP_rcGetFBParam 10007 +#define OP_rcCreateContext 10008 +#define OP_rcDestroyContext 10009 +#define OP_rcCreateWindowSurface 10010 +#define OP_rcDestroyWindowSurface 10011 +#define OP_rcCreateColorBuffer 10012 +#define OP_rcOpenColorBuffer 10013 +#define OP_rcCloseColorBuffer 10014 +#define OP_rcSetWindowColorBuffer 10015 +#define OP_rcFlushWindowColorBuffer 10016 +#define OP_rcMakeCurrent 10017 +#define OP_rcFBPost 10018 +#define OP_rcFBSetSwapInterval 10019 +#define OP_rcBindTexture 10020 +#define OP_rcBindRenderbuffer 10021 +#define OP_rcColorBufferCacheFlush 10022 +#define OP_rcReadColorBuffer 10023 +#define OP_rcUpdateColorBuffer 10024 +#define OP_last 10025 + + +#endif diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_types.h b/tools/emulator/opengl/system/renderControl_enc/renderControl_types.h new file mode 100644 index 000000000..da215bb49 --- /dev/null +++ b/tools/emulator/opengl/system/renderControl_enc/renderControl_types.h @@ -0,0 +1,28 @@ +/* +* Copyright 2011 The Android Open Source Project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include <stdint.h> +#include <EGL/egl.h> +#include "glUtils.h" + +// values for 'param' argument of rcGetFBParam +#define FB_WIDTH 1 +#define FB_HEIGHT 2 +#define FB_XDPI 3 +#define FB_YDPI 4 +#define FB_FPS 5 +#define FB_MIN_SWAP_INTERVAL 6 +#define FB_MAX_SWAP_INTERVAL 7 |
