Access library dependencies through a single object.

Bug 18752589

Change-Id: I93155cead50b30faa876023f9ed00f60b7c9e34e
Reviewed-on: https://swiftshader-review.googlesource.com/2831
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Greg Hartman <ghartman@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/libGLESv2/main.h b/src/OpenGL/libGLESv2/main.h
index 09ffb88..de5a2c4 100644
--- a/src/OpenGL/libGLESv2/main.h
+++ b/src/OpenGL/libGLESv2/main.h
@@ -17,7 +17,9 @@
 #include "Context.h"
 #include "Device.hpp"
 #include "common/debug.h"
+#include "libEGL/libEGL.hpp"
 #include "libEGL/Display.h"
+#include "libGLES_CM/libGLES_CM.hpp"
 
 #define GL_APICALL
 #include <GLES2/gl2.h>
@@ -29,6 +31,16 @@
 	Context *getContext();
 	egl::Display *getDisplay();
 	Device *getDevice();
+
+	void error(GLenum errorCode);
+
+	template<class T>
+	const T &error(GLenum errorCode, const T &returnValue)
+	{
+		error(errorCode);
+
+		return returnValue;
+	}
 }
 
 namespace egl
@@ -36,30 +48,7 @@
 	GLint getClientVersion();
 }
 
-void error(GLenum errorCode);
-
-template<class T>
-const T &error(GLenum errorCode, const T &returnValue)
-{
-    error(errorCode);
-
-    return returnValue;
-}
-
-// libEGL dependencies
-namespace egl
-{
-	extern egl::Context *(*getCurrentContext)();
-	extern egl::Display *(*getCurrentDisplay)();
-}
-
-// libGLES_CM dependencies
-namespace es1
-{
-	extern __eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname);
-}
-
-extern void *libEGL;       // Handle to the libEGL module
-extern void *libGLES_CM;   // Handle to the libGLES_CM module
+extern LibEGL libEGL;
+extern LibGLES_CM libGLES_CM;
 
 #endif   // LIBGLESV2_MAIN_H_