adding support for getting gles proc address from eglGetProcAdress
Change-Id: Ife1b3be5abd181cce837eebbf993e99759eec8e7
This commit is contained in:
committed by
David 'Digit' Turner
parent
8e2dc32b2d
commit
25d29c4778
@@ -52,11 +52,6 @@ static EGLiface s_eglIface = {
|
|||||||
/***************************************** supported extentions ***********************************************************************/
|
/***************************************** supported extentions ***********************************************************************/
|
||||||
|
|
||||||
//extentions
|
//extentions
|
||||||
typedef struct {
|
|
||||||
const char* name;
|
|
||||||
__eglMustCastToProperFunctionPointerType address;
|
|
||||||
} EglExtentionDescriptor;
|
|
||||||
|
|
||||||
#define EGL_EXTENTIONS 2
|
#define EGL_EXTENTIONS 2
|
||||||
|
|
||||||
//decleration
|
//decleration
|
||||||
@@ -64,7 +59,7 @@ EGLImageKHR eglCreateImageKHR(EGLDisplay display, EGLContext context, EGLenum ta
|
|||||||
EGLBoolean eglDestroyImageKHR(EGLDisplay display, EGLImageKHR image);
|
EGLBoolean eglDestroyImageKHR(EGLDisplay display, EGLImageKHR image);
|
||||||
|
|
||||||
// extentions descriptors
|
// extentions descriptors
|
||||||
static EglExtentionDescriptor s_extentions[] = {
|
static ExtentionDescriptor s_eglExtentions[] = {
|
||||||
{"eglCreateImageKHR" ,(__eglMustCastToProperFunctionPointerType)eglCreateImageKHR},
|
{"eglCreateImageKHR" ,(__eglMustCastToProperFunctionPointerType)eglCreateImageKHR},
|
||||||
{"eglDestroyImageKHR",(__eglMustCastToProperFunctionPointerType)eglDestroyImageKHR}
|
{"eglDestroyImageKHR",(__eglMustCastToProperFunctionPointerType)eglDestroyImageKHR}
|
||||||
};
|
};
|
||||||
@@ -883,16 +878,21 @@ EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void) {
|
|||||||
|
|
||||||
EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
|
EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
|
||||||
eglGetProcAddress(const char *procname){
|
eglGetProcAddress(const char *procname){
|
||||||
|
__eglMustCastToProperFunctionPointerType retVal = NULL;
|
||||||
if(!strncmp(procname,"egl",3)) { //EGL proc
|
if(!strncmp(procname,"egl",3)) { //EGL proc
|
||||||
for(int i=0;i < EGL_EXTENSIONS;i++){
|
for(int i=0;i < EGL_EXTENSIONS;i++){
|
||||||
if(strcmp(procname,s_extentions[i].name) == 0){
|
if(strcmp(procname,s_eglExtentions[i].name) == 0){
|
||||||
return s_extentions[i].address;
|
retVal = s_eglExtentions[i].address;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!strncmp(procname,"gl",2)){ //GL proc
|
} 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
|
||||||
/************************* NOT SUPPORTED FOR NOW ***********************/
|
/************************* NOT SUPPORTED FOR NOW ***********************/
|
||||||
|
|||||||
@@ -28,16 +28,33 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
//decleration
|
//decleration
|
||||||
static void initContext(GLEScontext* ctx);
|
static void initContext(GLEScontext* ctx);
|
||||||
static GLEScontext* createGLESContext();
|
|
||||||
static void deleteGLESContext(GLEScontext* ctx);
|
static void deleteGLESContext(GLEScontext* ctx);
|
||||||
static void setShareGroup(GLEScontext* ctx,ShareGroupPtr grp);
|
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 EGLiface* s_eglIface = NULL;
|
||||||
static GLESiface s_glesIface = {
|
static GLESiface s_glesIface = {
|
||||||
createGLESContext:createGLESContext,
|
createGLESContext:createGLESContext,
|
||||||
@@ -45,7 +62,8 @@ static GLESiface s_glesIface = {
|
|||||||
deleteGLESContext:deleteGLESContext,
|
deleteGLESContext:deleteGLESContext,
|
||||||
flush :glFlush,
|
flush :glFlush,
|
||||||
finish :glFinish,
|
finish :glFinish,
|
||||||
setShareGroup :setShareGroup
|
setShareGroup :setShareGroup,
|
||||||
|
getProcAddress :getProcAddress
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C" {
|
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){
|
GLESiface* __translator_getIfaces(EGLiface* eglIface){
|
||||||
s_eglIface = eglIface;
|
s_eglIface = eglIface;
|
||||||
return & s_glesIface;
|
return & s_glesIface;
|
||||||
@@ -1106,7 +1132,7 @@ static TextureData* getTextureData(){
|
|||||||
TextureData *texData = NULL;
|
TextureData *texData = NULL;
|
||||||
ObjectDataPtr objData = thrd->shareGroup->getObjectData(TEXTURE,tex);
|
ObjectDataPtr objData = thrd->shareGroup->getObjectData(TEXTURE,tex);
|
||||||
if(!objData.Ptr()){
|
if(!objData.Ptr()){
|
||||||
TextureData *texData = new TextureData();
|
texData = new TextureData();
|
||||||
thrd->shareGroup->setObjectData(TEXTURE, tex, ObjectDataPtr(texData));
|
thrd->shareGroup->setObjectData(TEXTURE, tex, ObjectDataPtr(texData));
|
||||||
} else {
|
} else {
|
||||||
texData = (TextureData*)objData.Ptr();
|
texData = (TextureData*)objData.Ptr();
|
||||||
|
|||||||
@@ -20,6 +20,16 @@
|
|||||||
|
|
||||||
extern "C" {
|
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
|
class TextureData : public ObjectData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -59,6 +69,7 @@ typedef struct {
|
|||||||
void (*flush)();
|
void (*flush)();
|
||||||
void (*finish)();
|
void (*finish)();
|
||||||
void (*setShareGroup)(GLEScontext*,ShareGroupPtr);
|
void (*setShareGroup)(GLEScontext*,ShareGroupPtr);
|
||||||
|
__translatorMustCastToProperFunctionPointerType (*getProcAddress)(const char*);
|
||||||
}GLESiface;
|
}GLESiface;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user