Commit d76b5df8 by Nicolas Capens Committed by Nicolas Capens

Delegate extensions to the right implementation based on client version.

BUG=18110152 Change-Id: I3e7ccef4b466e3980210ce931ae9c1f0ff411a5b Reviewed-on: https://swiftshader-review.googlesource.com/1272Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 6a7e8718
......@@ -1189,7 +1189,17 @@ __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const cha
}
}
return gl2::getProcAddress(procname);
if(gl2::getProcAddress != 0)
{
__eglMustCastToProperFunctionPointerType proc = gl2::getProcAddress(procname);
if(proc) return proc;
}
if(gl::getProcAddress != 0)
{
__eglMustCastToProperFunctionPointerType proc = gl::getProcAddress(procname);
if(proc) return proc;
}
}
catch(std::bad_alloc&)
{
......
......@@ -6088,7 +6088,7 @@ void GL_APIENTRY glTexImage3DOES(GLenum target, GLint level, GLenum internalform
try
{
UNIMPLEMENTED(); // FIXME
UNIMPLEMENTED(); // FIXME
}
catch(std::bad_alloc&)
{
......@@ -6098,6 +6098,12 @@ void GL_APIENTRY glTexImage3DOES(GLenum target, GLint level, GLenum internalform
void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
{
if(egl::getClientVersion() == 1)
{
static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)gl::getProcAddress("glEGLImageTargetTexture2DOES");
return glEGLImageTargetTexture2DOES(target, image);
}
TRACE("(GLenum target = 0x%X, GLeglImageOES image = 0x%0.8p)", target, image);
try
......
......@@ -53,6 +53,15 @@ CONSTRUCTOR static bool glAttachProcess()
egl::getCurrentContext = (egl::Context *(*)())getProcAddress(libEGL, "eglGetCurrentContext");
egl::getCurrentDisplay = (egl::Display *(*)())getProcAddress(libEGL, "eglGetCurrentDisplay");
#if defined(_WIN32)
const char *libGLES_CM_lib = "libGLES_CM.dll";
#else
const char *libGLES_CM_lib = "libGLES_CM.so.1";
#endif
libGLES_CM = loadLibrary(libGLES_CM_lib);
gl::getProcAddress = (__eglMustCastToProperFunctionPointerType (*)(const char*))getProcAddress(libGLES_CM, "glGetProcAddress");
return libEGL != 0;
}
......@@ -62,6 +71,7 @@ DESTRUCTOR static void glDetachProcess()
glDetachThread();
freeLibrary(libEGL);
freeLibrary(libGLES_CM);
}
#if defined(_WIN32)
......@@ -116,6 +126,16 @@ Device *getDevice()
}
}
namespace egl
{
GLint getClientVersion()
{
Context *context = egl::getCurrentContext();
return context ? context->getClientVersion() : 0;
}
}
// Records an error code
void error(GLenum errorCode)
{
......@@ -156,4 +176,10 @@ namespace egl
egl::Display *(*getCurrentDisplay)() = 0;
}
void *libEGL = 0; // Handle to the libEGL module
\ No newline at end of file
namespace gl
{
__eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname) = 0;
}
void *libEGL = 0; // Handle to the libEGL module
void *libGLES_CM = 0; // Handle to the libGLES_CM module
......@@ -30,6 +30,11 @@ namespace gl2
Device *getDevice();
}
namespace egl
{
GLint getClientVersion();
}
void error(GLenum errorCode);
template<class T>
......@@ -47,6 +52,13 @@ namespace egl
extern egl::Display *(*getCurrentDisplay)();
}
extern void *libEGL; // Handle to the libEGL module
// libGLES_CM dependencies
namespace gl
{
extern __eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname);
}
extern void *libEGL; // Handle to the libEGL module
extern void *libGLES_CM; // Handle to the libGLES_CM module
#endif // LIBGLESV2_MAIN_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment