am e72ec4bf: Merge "adding support for getting gles proc address from eglGetProcAdress"
* commit 'e72ec4bfbda1aef6faebd20c0afc19ace53b308e': adding support for getting gles proc address from eglGetProcAdress
This commit is contained in:
@@ -52,11 +52,6 @@ static EGLiface s_eglIface = {
|
||||
/***************************************** supported extentions ***********************************************************************/
|
||||
|
||||
//extentions
|
||||
typedef struct {
|
||||
const char* name;
|
||||
__eglMustCastToProperFunctionPointerType address;
|
||||
} EglExtentionDescriptor;
|
||||
|
||||
#define EGL_EXTENTIONS 2
|
||||
|
||||
//decleration
|
||||
@@ -64,7 +59,7 @@ EGLImageKHR eglCreateImageKHR(EGLDisplay display, EGLContext context, EGLenum ta
|
||||
EGLBoolean eglDestroyImageKHR(EGLDisplay display, EGLImageKHR image);
|
||||
|
||||
// extentions descriptors
|
||||
static EglExtentionDescriptor s_extentions[] = {
|
||||
static ExtentionDescriptor s_eglExtentions[] = {
|
||||
{"eglCreateImageKHR" ,(__eglMustCastToProperFunctionPointerType)eglCreateImageKHR},
|
||||
{"eglDestroyImageKHR",(__eglMustCastToProperFunctionPointerType)eglDestroyImageKHR}
|
||||
};
|
||||
@@ -883,16 +878,21 @@ EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void) {
|
||||
|
||||
EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
|
||||
eglGetProcAddress(const char *procname){
|
||||
__eglMustCastToProperFunctionPointerType retVal = NULL;
|
||||
if(!strncmp(procname,"egl",3)) { //EGL proc
|
||||
for(int i=0;i < EGL_EXTENSIONS;i++){
|
||||
if(strcmp(procname,s_extentions[i].name) == 0){
|
||||
return s_extentions[i].address;
|
||||
if(strcmp(procname,s_eglExtentions[i].name) == 0){
|
||||
retVal = s_eglExtentions[i].address;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (!strncmp(procname,"gl",2)){ //GL proc
|
||||
//TODO:call glGetProcAdress
|
||||
retVal = g_eglInfo->getIface(GLES_1_1)->getProcAddress(procname); //try to get it from GLES 1.0
|
||||
if(!retVal){ //try to get it from GLES 2.0
|
||||
retVal = g_eglInfo->getIface(GLES_2_0)->getProcAddress(procname);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return retVal;
|
||||
}
|
||||
//not supported for now
|
||||
/************************* NOT SUPPORTED FOR NOW ***********************/
|
||||
|
||||
@@ -28,16 +28,33 @@
|
||||
#include <cmath>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
//decleration
|
||||
static void initContext(GLEScontext* ctx);
|
||||
static GLEScontext* createGLESContext();
|
||||
static void deleteGLESContext(GLEScontext* ctx);
|
||||
static void setShareGroup(GLEScontext* ctx,ShareGroupPtr grp);
|
||||
static GLEScontext* createGLESContext();
|
||||
static __translatorMustCastToProperFunctionPointerType getProcAddress(const char* procName);
|
||||
|
||||
}
|
||||
|
||||
/************************************** GLES EXTENSIONS *********************************************************/
|
||||
#define GLES_EXTENTIONS 1
|
||||
//extensions decleration
|
||||
void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image);
|
||||
|
||||
//extentions descriptor
|
||||
static ExtentionDescriptor s_glesExtentions[] = {
|
||||
{"glEGLImageTargetTexture2DOES",(__translatorMustCastToProperFunctionPointerType)glEGLImageTargetTexture2DOES}
|
||||
};
|
||||
/****************************************************************************************************************/
|
||||
static EGLiface* s_eglIface = NULL;
|
||||
static GLESiface s_glesIface = {
|
||||
createGLESContext:createGLESContext,
|
||||
@@ -45,7 +62,8 @@ static GLESiface s_glesIface = {
|
||||
deleteGLESContext:deleteGLESContext,
|
||||
flush :glFlush,
|
||||
finish :glFinish,
|
||||
setShareGroup :setShareGroup
|
||||
setShareGroup :setShareGroup,
|
||||
getProcAddress :getProcAddress
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
@@ -68,6 +86,14 @@ static void setShareGroup(GLEScontext* ctx,ShareGroupPtr grp) {
|
||||
}
|
||||
}
|
||||
|
||||
static __translatorMustCastToProperFunctionPointerType getProcAddress(const char* procName) {
|
||||
for(int i=0;i<GLES_EXTENTIONS;i++){
|
||||
if(strcmp(procName,s_glesExtentions[i].name) == 0){
|
||||
return s_glesExtentions[i].address;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
GLESiface* __translator_getIfaces(EGLiface* eglIface){
|
||||
s_eglIface = eglIface;
|
||||
return & s_glesIface;
|
||||
@@ -1106,7 +1132,7 @@ static TextureData* getTextureData(){
|
||||
TextureData *texData = NULL;
|
||||
ObjectDataPtr objData = thrd->shareGroup->getObjectData(TEXTURE,tex);
|
||||
if(!objData.Ptr()){
|
||||
TextureData *texData = new TextureData();
|
||||
texData = new TextureData();
|
||||
thrd->shareGroup->setObjectData(TEXTURE, tex, ObjectDataPtr(texData));
|
||||
} else {
|
||||
texData = (TextureData*)objData.Ptr();
|
||||
|
||||
@@ -20,6 +20,16 @@
|
||||
|
||||
extern "C" {
|
||||
|
||||
/* This is a generic function pointer type, whose name indicates it must
|
||||
* be cast to the proper type *and calling convention* before use.
|
||||
*/
|
||||
typedef void (*__translatorMustCastToProperFunctionPointerType)(void);
|
||||
|
||||
typedef struct {
|
||||
const char* name;
|
||||
__translatorMustCastToProperFunctionPointerType address;
|
||||
}ExtentionDescriptor;
|
||||
|
||||
class TextureData : public ObjectData
|
||||
{
|
||||
public:
|
||||
@@ -53,12 +63,13 @@ typedef std::map< unsigned int, ImagePtr> ImagesHndlMap;
|
||||
class GLEScontext;
|
||||
|
||||
typedef struct {
|
||||
GLEScontext* (*createGLESContext)();
|
||||
void (*initContext)(GLEScontext*);
|
||||
void (*deleteGLESContext)(GLEScontext*);
|
||||
void (*flush)();
|
||||
void (*finish)();
|
||||
void (*setShareGroup)(GLEScontext*,ShareGroupPtr);
|
||||
GLEScontext* (*createGLESContext)();
|
||||
void (*initContext)(GLEScontext*);
|
||||
void (*deleteGLESContext)(GLEScontext*);
|
||||
void (*flush)();
|
||||
void (*finish)();
|
||||
void (*setShareGroup)(GLEScontext*,ShareGroupPtr);
|
||||
__translatorMustCastToProperFunctionPointerType (*getProcAddress)(const char*);
|
||||
}GLESiface;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user