Imagination PowerVR SDK Blog

Importing GL 11 Extension functions with SDK 3.4

pvrvframe

#1

Hi !

I’m building an emulator for Android’s OpenGL API, it is, implementing the package android.opengl.* for Win/Linux, on Java.
So far, I’m able to run GLES20 and GLES30 applications (very simple Activity class implementations), using PowerVR SDK libs, bridging it with JNI.

But on GL ES 1.x I’m having some trouble. I can link GLES10, GLES10EXT and GLES11 functions with PowerVR’s libGLES_CM. BUT I’m failing to link the GLES11EXT functons.
The libGLES_CM def file, as well Dependency Walker tool, shows that exported GL11 ext functions are exported as “C++” and all other GL ES 1.x functions are “C”.
Example:
GLES 11 ext function signature (Links fail):
?glBindFramebufferOES@@YAXII@Z
?glBindRenderbufferOES@@YAXII@Z
?glBindVertexArrayOES@@YAXI@Z

GL ES 10/10ext/11 function signature (Links OK)
glActiveTexture
glAlphaFunc
glAlphaFuncx

Example of link error:
[exec] [size size={size}]C:\Users\Livia\workspace\Canvas\jni\target\windows64\gles.internal.GLES11ExtPipeline.o:gles.internal.GLES11ExtPipeline.cpp:[.text+0x13]: undefined reference to __imp_glBlendEquationSeparateOES' [exec] C:\Users\Livia\workspace\Canvas\jni\target\windows64\gles.internal.GLES11ExtPipeline.o:gles.internal.GLES11ExtPipeline.cpp:[.text+0x23]: undefined reference to__imp_glBlendFuncSeparateOES’
[exec] C:\Users\Livia\workspace\Canvas\jni\target\windows64\gles.internal.GLES11ExtPipeline.o:gles.internal.GLES11ExtPipeline.cpp:[.text+0x43]: undefined reference to `__imp_glBlendEquationOES’[/size]

Any ideas to workaround this issues ?
I’m using mingw and extracting *.a libs and *.def with pexports and dlltool. Except by the above issue with GLES 11Ext , all remaing GLES 1.x, 2.0 and 3.0 works fine.

For those interested in this project, it’s hosted at GitHub: https://github.com/AlessandroBorges/madri-gles
Still under development.


#2

Hi

Just figure out how to unmangle the C++ functions.
On DEF file I added some aliases like exemple below:

[color color={blue}]glDrawTexfOES[/color]=?glDrawTexfOES@@YAXMMMMM@Z
[color color={blue}]glDrawTexfvOES[/color]=?glDrawTexfvOES@@YAXPEBM@Z

It was done for all 72 C++ mangled functions of GL11 Ext

Also, I added some aliased to xxxOES functions, which are defined at glext.h but not available at libGLES_CM.dll:
[color color={blue}]glOrthofOES[/color]=glOrthof
[color color={blue}]glClipPlanefOES[/color]=glClipPlanef

After all changes, I created the .a lib required by GCC, as usual
dlltool --dllname libGLES_CM.dll --input-def libGLES_CM.def --output-lib libGLES_CM.a -k

The modified libGLES_CM.def file is attached, as txt.

Regards


#3

Well, the attachments failed.
So I’ll show it here:
libGLES_CM.def

LIBRARY libGLES_CM.dll
EXPORTS
?glBindFramebufferOES@@YAXII@Z
?glBindRenderbufferOES@@YAXII@Z
?glBindVertexArrayOES@@YAXI@Z
?glBlendEquationEXT@@YAXI@Z
?glBlendEquationOES@@YAXI@Z
?glBlendEquationSeparateOES@@YAXII@Z
?glBlendFuncSeparateOES@@YAXIIII@Z
?glCheckFramebufferStatusOES@@YAII@Z
?glClientWaitSyncAPPLE@@YAIPEAU__GLsync@@I_K@Z
?glCurrentPaletteMatrixOES@@YAXI@Z
?glDeleteFramebuffersOES@@YAXHPEBI@Z
?glDeleteRenderbuffersOES@@YAXHPEBI@Z
?glDeleteSyncAPPLE@@YAXPEAU__GLsync@@@Z
?glDeleteVertexArraysOES@@YAXHPEBI@Z
?glDiscardFramebufferEXT@@YAXIHPEBI@Z
?glDrawTexfOES@@YAXMMMMM@Z
?glDrawTexfvOES@@YAXPEBM@Z
?glDrawTexiOES@@YAXHHHHH@Z
?glDrawTexivOES@@YAXPEBH@Z
?glDrawTexsOES@@YAXFFFFF@Z
?glDrawTexsvOES@@YAXPEBF@Z
?glDrawTexxOES@@YAXHHHHH@Z
?glDrawTexxvOES@@YAXPEBH@Z
?glEGLImageTargetRenderbufferStorageOES@@YAXIPEAX@Z
?glEGLImageTargetTexture2DOES@@YAXIPEAX@Z
?glFenceSyncAPPLE@@YAPEAU__GLsync@@II@Z
?glFramebufferRenderbufferOES@@YAXIIII@Z
?glFramebufferTexture2DMultisampleEXT@@YAXIIIIHH@Z
?glFramebufferTexture2DMultisampleIMG@@YAXIIIIHH@Z
?glFramebufferTexture2DOES@@YAXIIIIH@Z
?glGenFramebuffersOES@@YAXHPEAI@Z
?glGenRenderbuffersOES@@YAXHPEAI@Z
?glGenVertexArraysOES@@YAXHPEAI@Z
?glGenerateMipmapOES@@YAXI@Z
?glGetBufferPointervOES@@YAXIIPEAPEAX@Z
?glGetFramebufferAttachmentParameterivOES@@YAXIIIPEAH@Z
?glGetGraphicsResetStatusEXT@@YAIXZ
?glGetInteger64vAPPLE@@YAXIPEA_J@Z
?glGetRenderbufferParameterivOES@@YAXIIPEAH@Z
?glGetSyncivAPPLE@@YAXPEAU__GLsync@@IHPEAH1@Z
?glGetTexGenfvOES@@YAXIIPEAM@Z
?glGetTexGenivOES@@YAXIIPEAH@Z
?glGetTexGenxvOES@@YAXIIPEAH@Z
?glIsFramebufferOES@@YAEI@Z
?glIsRenderbufferOES@@YAEI@Z
?glIsSyncAPPLE@@YAEPEAU__GLsync@@@Z
?glIsVertexArrayOES@@YAEI@Z
?glLoadPaletteFromModelViewMatrixOES@@YAXXZ
?glMapBufferOES@@YAPEAXII@Z
?glMatrixIndexPointerOES@@YAXHIHPEBX@Z
?glMultiDrawArraysEXT@@YAXIPEAH0H@Z
?glMultiDrawElementsEXT@@YAXIPEAHIPEAPEBXH@Z
?glQueryMatrixxOES@@YAIQEAH0@Z
?glReadnPixelsEXT@@YAXHHHHIIHPEAX@Z
?glRenderbufferStorageMultisampleEXT@@YAXIHIHH@Z
?glRenderbufferStorageMultisampleIMG@@YAXIHIHH@Z
?glRenderbufferStorageOES@@YAXIIHH@Z
?glTexGenfOES@@YAXIIM@Z
?glTexGenfvOES@@YAXIIPEBM@Z
?glTexGeniOES@@YAXIIH@Z
?glTexGenivOES@@YAXIIPEBH@Z
?glTexGenxOES@@YAXIIH@Z
?glTexGenxvOES@@YAXIIPEBH@Z
?glTexStorage1DEXT@@YAXIHIH@Z
?glTexStorage2DEXT@@YAXIHIHH@Z
?glTexStorage3DEXT@@YAXIHIHHH@Z
?glTextureStorage1DEXT@@YAXIIHIH@Z
?glTextureStorage2DEXT@@YAXIIHIHH@Z
?glTextureStorage3DEXT@@YAXIIHIHHH@Z
?glUnmapBufferOES@@YAEI@Z
?glWaitSyncAPPLE@@YAXPEAU__GLsync@@I_K@Z
?glWeightPointerOES@@YAXHIHPEBX@Z
glBindFramebufferOES=?glBindFramebufferOES@@YAXII@Z
glBindRenderbufferOES=?glBindRenderbufferOES@@YAXII@Z
glBindVertexArrayOES=?glBindVertexArrayOES@@YAXI@Z
glBlendEquationEXT=?glBlendEquationEXT@@YAXI@Z
glBlendEquationOES=?glBlendEquationOES@@YAXI@Z
glBlendEquationSeparateOES=?glBlendEquationSeparateOES@@YAXII@Z
glBlendFuncSeparateOES=?glBlendFuncSeparateOES@@YAXIIII@Z
glCheckFramebufferStatusOES=?glCheckFramebufferStatusOES@@YAII@Z
glClientWaitSyncAPPLE=?glClientWaitSyncAPPLE@@YAIPEAU__GLsync@@I_K@Z
glCurrentPaletteMatrixOES=?glCurrentPaletteMatrixOES@@YAXI@Z
glDeleteFramebuffersOES=?glDeleteFramebuffersOES@@YAXHPEBI@Z
glDeleteRenderbuffersOES=?glDeleteRenderbuffersOES@@YAXHPEBI@Z
glDeleteSyncAPPLE=?glDeleteSyncAPPLE@@YAXPEAU__GLsync@@@Z
glDeleteVertexArraysOES=?glDeleteVertexArraysOES@@YAXHPEBI@Z
glDiscardFramebufferEXT=?glDiscardFramebufferEXT@@YAXIHPEBI@Z
glDrawTexfOES=?glDrawTexfOES@@YAXMMMMM@Z
glDrawTexfvOES=?glDrawTexfvOES@@YAXPEBM@Z
glDrawTexiOES=?glDrawTexiOES@@YAXHHHHH@Z
glDrawTexivOES=?glDrawTexivOES@@YAXPEBH@Z
glDrawTexsOES=?glDrawTexsOES@@YAXFFFFF@Z
glDrawTexsvOES=?glDrawTexsvOES@@YAXPEBF@Z
glDrawTexxOES=?glDrawTexxOES@@YAXHHHHH@Z
glDrawTexxvOES=?glDrawTexxvOES@@YAXPEBH@Z
glEGLImageTargetRenderbufferStorageOES=?glEGLImageTargetRenderbufferStorageOES@@YAXIPEAX@Z
glEGLImageTargetTexture2DOES=?glEGLImageTargetTexture2DOES@@YAXIPEAX@Z
glFenceSyncAPPLE=?glFenceSyncAPPLE@@YAPEAU__GLsync@@II@Z
glFramebufferRenderbufferOES=?glFramebufferRenderbufferOES@@YAXIIII@Z
glFramebufferTexture2DMultisampleEXT=?glFramebufferTexture2DMultisampleEXT@@YAXIIIIHH@Z
glFramebufferTexture2DMultisampleIMG=?glFramebufferTexture2DMultisampleIMG@@YAXIIIIHH@Z
glFramebufferTexture2DOES=?glFramebufferTexture2DOES@@YAXIIIIH@Z
glGenFramebuffersOES=?glGenFramebuffersOES@@YAXHPEAI@Z
glGenRenderbuffersOES=?glGenRenderbuffersOES@@YAXHPEAI@Z
glGenVertexArraysOES=?glGenVertexArraysOES@@YAXHPEAI@Z
glGenerateMipmapOES=?glGenerateMipmapOES@@YAXI@Z
glGetBufferPointervOES=?glGetBufferPointervOES@@YAXIIPEAPEAX@Z
glGetFramebufferAttachmentParameterivOES=?glGetFramebufferAttachmentParameterivOES@@YAXIIIPEAH@Z
glGetGraphicsResetStatusEXT=?glGetGraphicsResetStatusEXT@@YAIXZ
glGetInteger64vAPPLE=?glGetInteger64vAPPLE@@YAXIPEA_J@Z
glGetRenderbufferParameterivOES=?glGetRenderbufferParameterivOES@@YAXIIPEAH@Z
glGetSyncivAPPLE=?glGetSyncivAPPLE@@YAXPEAU__GLsync@@IHPEAH1@Z
glGetTexGenfvOES=?glGetTexGenfvOES@@YAXIIPEAM@Z
glGetTexGenivOES=?glGetTexGenivOES@@YAXIIPEAH@Z
glGetTexGenxvOES=?glGetTexGenxvOES@@YAXIIPEAH@Z
glIsFramebufferOES=?glIsFramebufferOES@@YAEI@Z
glIsRenderbufferOES=?glIsRenderbufferOES@@YAEI@Z
glIsSyncAPPLE=?glIsSyncAPPLE@@YAEPEAU__GLsync@@@Z
glIsVertexArrayOES=?glIsVertexArrayOES@@YAEI@Z
glLoadPaletteFromModelViewMatrixOES=?glLoadPaletteFromModelViewMatrixOES@@YAXXZ
glMapBufferOES=?glMapBufferOES@@YAPEAXII@Z
glMatrixIndexPointerOES=?glMatrixIndexPointerOES@@YAXHIHPEBX@Z
glMultiDrawArraysEXT=?glMultiDrawArraysEXT@@YAXIPEAH0H@Z
glMultiDrawElementsEXT=?glMultiDrawElementsEXT@@YAXIPEAHIPEAPEBXH@Z
glQueryMatrixxOES=?glQueryMatrixxOES@@YAIQEAH0@Z
glReadnPixelsEXT=?glReadnPixelsEXT@@YAXHHHHIIHPEAX@Z
glRenderbufferStorageMultisampleEXT=?glRenderbufferStorageMultisampleEXT@@YAXIHIHH@Z
glRenderbufferStorageMultisampleIMG=?glRenderbufferStorageMultisampleIMG@@YAXIHIHH@Z
glRenderbufferStorageOES=?glRenderbufferStorageOES@@YAXIIHH@Z
glTexGenfOES=?glTexGenfOES@@YAXIIM@Z
glTexGenfvOES=?glTexGenfvOES@@YAXIIPEBM@Z
glTexGeniOES=?glTexGeniOES@@YAXIIH@Z
glTexGenivOES=?glTexGenivOES@@YAXIIPEBH@Z
glTexGenxOES=?glTexGenxOES@@YAXIIH@Z
glTexGenxvOES=?glTexGenxvOES@@YAXIIPEBH@Z
glTexStorage1DEXT=?glTexStorage1DEXT@@YAXIHIH@Z
glTexStorage2DEXT=?glTexStorage2DEXT@@YAXIHIHH@Z
glTexStorage3DEXT=?glTexStorage3DEXT@@YAXIHIHHH@Z
glTextureStorage1DEXT=?glTextureStorage1DEXT@@YAXIIHIH@Z
glTextureStorage2DEXT=?glTextureStorage2DEXT@@YAXIIHIHH@Z
glTextureStorage3DEXT=?glTextureStorage3DEXT@@YAXIIHIHHH@Z
glUnmapBufferOES=?glUnmapBufferOES@@YAEI@Z
glWaitSyncAPPLE=?glWaitSyncAPPLE@@YAXPEAU__GLsync@@I_K@Z
glWeightPointerOES=?glWeightPointerOES@@YAXHIHPEBX@Z
VFrame_GetTexImage
VFrame_GetTexLevelParameterfv
VFrame_GetTexLevelParameteriv
VFrame_ToggleWireframe
eglBindAPI
eglBindTexImage
eglChooseConfig
eglCopyBuffers
eglCreateContext
eglCreatePbufferFromClientBuffer
eglCreatePbufferSurface
eglCreatePixmapSurface
eglCreateWindowSurface
eglDestroyContext
eglDestroySurface
eglGetConfigAttrib
eglGetConfigs
eglGetCurrentContext
eglGetCurrentDisplay
eglGetCurrentSurface
eglGetDisplay
eglGetError
eglGetProcAddress
eglInitialize
eglMakeCurrent
eglQueryAPI
eglQueryContext
eglQueryString
eglQuerySurface
eglReleaseTexImage
eglReleaseThread
eglSurfaceAttrib
eglSwapBuffers
eglSwapInterval
eglTerminate
eglWaitClient
eglWaitGL
eglWaitNative
glActiveTexture
glAlphaFunc
glAlphaFuncx
glBindBuffer
glBindTexture
glBlendFunc
glBufferData
glBufferSubData
glClear
glClearColor
glClearColorx
glClearDepthf
glClearDepthx
glClearStencil
glClientActiveTexture
glClipPlanef
glClipPlanex
glColor4f
glColor4ub
glColor4x
glColorMask
glColorPointer
glCompressedTexImage2D
glCompressedTexSubImage2D
glCopyTexImage2D
glCopyTexSubImage2D
glCullFace
glDeleteBuffers
glDeleteTextures
glDepthFunc
glDepthMask
glDepthRangef
glDepthRangex
glDisable
glDisableClientState
glDrawArrays
glDrawElements
glEnable
glEnableClientState
glFinish
glFlush
glFogf
glFogfv
glFogx
glFogxv
glFrontFace
glFrustumf
glFrustumx
glGenBuffers
glGenTextures
glGetBooleanv
glGetBufferParameteriv
glGetClipPlanef
glGetClipPlanex
glGetError
glGetFixedv
glGetFloatv
glGetIntegerv
glGetLightfv
glGetLightxv
glGetMaterialfv
glGetMaterialxv
glGetPointerv
glGetString
glGetTexEnvfv
glGetTexEnviv
glGetTexEnvxv
glGetTexParameterfv
glGetTexParameteriv
glGetTexParameterxv
glHint
glIsBuffer
glIsEnabled
glIsTexture
glLightModelf
glLightModelfv
glLightModelx
glLightModelxv
glLightf
glLightfv
glLightx
glLightxv
glLineWidth
glLineWidthx
glLoadIdentity
glLoadMatrixf
glLoadMatrixx
glLogicOp
glMaterialf
glMaterialfv
glMaterialx
glMaterialxv
glMatrixMode
glMultMatrixf
glMultMatrixx
glMultiTexCoord4f
glMultiTexCoord4x
glNormal3f
glNormal3x
glNormalPointer
glOrthof
glOrthox
glPixelStorei
glPointParameterf
glPointParameterfv
glPointParameterx
glPointParameterxv
glPointSize
glPointSizePointerOES
glPointSizex
glPolygonOffset
glPolygonOffsetx
glPopMatrix
glPushMatrix
glReadPixels
glRotatef
glRotatex
glSampleCoverage
glSampleCoveragex
glScalef
glScalex
glScissor
glShadeModel
glStencilFunc
glStencilMask
glStencilOp
glTexCoordPointer
glTexEnvf
glTexEnvfv
glTexEnvi
glTexEnviv
glTexEnvx
glTexEnvxv
glTexImage2D
glTexParameterf
glTexParameterfv
glTexParameteri
glTexParameteriv
glTexParameterx
glTexParameterxv
glTexSubImage2D
glTranslatef
glTranslatex
glVertexPointer
glViewport
vfCreateEsContext
vfDeleteEsContext
vfGetExtProcAddress
vfGetTexImage
vfGetTexLevelParameterfv
vfGetTexLevelParameteriv
vfSetRenderMode
vfToggleWireframe
glAlphaFuncxOES=glAlphaFuncx
glClearColorxOES=glClearColorx
glClearDepthxOES=glClearDepthx
glClipPlanexOES=glClipPlanex
glClipPlanexOES=glClipPlanex
glColor4xOES=glColor4x
glDepthRangexOES=glDepthRangex
glFogxOES=glFogx
glFogxvOES=glFogxv
glFogxvOES=glFogxv
glFrustumxOES=glFrustumx
glGetClipPlanexOES=glGetClipPlanex
glGetClipPlanexOES=glGetClipPlanex
glGetFixedvOES=glGetFixedv
glGetFixedvOES=glGetFixedv
glGetLightxvOES=glGetLightxv
glGetLightxvOES=glGetLightxv
glGetMaterialxvOES=glGetMaterialxv
glGetMaterialxvOES=glGetMaterialxv
glGetTexEnvxvOES=glGetTexEnvxv
glGetTexEnvxvOES=glGetTexEnvxv
glGetTexParameterxvOES=glGetTexParameterxv
glGetTexParameterxvOES=glGetTexParameterxv
glLightModelxOES=glLightModelx
glLightModelxvOES=glLightModelxv
glLightModelxvOES=glLightModelxv
glLightxOES=glLightx
glLightxvOES=glLightxv
glLightxvOES=glLightxv
glLineWidthxOES=glLineWidthx
glLoadMatrixxOES=glLoadMatrixx
glLoadMatrixxOES=glLoadMatrixx
glMaterialxOES=glMaterialx
glMaterialxvOES=glMaterialxv
glMaterialxvOES=glMaterialxv
glMultMatrixxOES=glMultMatrixx
glMultMatrixxOES=glMultMatrixx
glMultiTexCoord4xOES=glMultiTexCoord4x
glNormal3xOES=glNormal3x
glOrthoxOES=glOrthox
glPointParameterxOES=glPointParameterx
glPointParameterxvOES=glPointParameterxv
glPointParameterxvOES=glPointParameterxv
glPointSizexOES=glPointSizex
glPolygonOffsetxOES=glPolygonOffsetx
glRotatexOES=glRotatex
glSampleCoveragexOES=glSampleCoveragex
glScalexOES=glScalex
glTexEnvxOES=glTexEnvx
glTexEnvxvOES=glTexEnvxv
glTexEnvxvOES=glTexEnvxv
glTexParameterxOES=glTexParameterx
glTexParameterxvOES=glTexParameterxv
glTexParameterxvOES=glTexParameterxv
glTranslatexOES=glTranslatex
glDepthRangefOES=glDepthRangef
glFrustumfOES=glFrustumf
glOrthofOES=glOrthof
glClipPlanefOES=glClipPlanef
glClipPlanefOES=glClipPlanef
glGetClipPlanefOES=glGetClipPlanef
glGetClipPlanefOES=glGetClipPlanef
glClearDepthfOES=glClearDepthf


#4

HI Alessandro,

Thanks for reporting the problem. As you’re currently using the PVRVFrame libraries from our previous release, can you try using the 3.5 SDK libraries to see if they resolve the issues you’re encountering?

We’ll start investigating and will aim to get back to you in the next few days.

Cheers,
Joe


#5

Can you try accessing extensions with eglGetProcAddress. This should reliably retrieve functions.


#6

Thanks Joe and PaulL,

I’ll migrate asap to 3.5. I saw it added some GL and trace functions, but still exports it with mangled names, C++ style. Meanwhile I’m fixing it with aliases DEF file at compile time.

PaulL, thanks for your idea. That’s more elegant than emending def files. I’ll try to implement it with eglGetProcAddress and getString gl_extensions, to get the available extensions functions at runtime , instead of an assumed availability at compile time.

Regards,
AB