Make the EGL surface class abstract.

gl::Surface is now the pure abstract interface for egl::Surface, which
can be used by libGLESv2 without requiring typeinfo.

Bug chromium:732667
Bug swiftshader:31

Change-Id: I7d8a5892c5b6186541f84c3cf39e72ac1d6c613d
Reviewed-on: https://swiftshader-review.googlesource.com/10129
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/libGLES_CM/Context.cpp b/src/OpenGL/libGLES_CM/Context.cpp
index 78fcec5..5e09b65 100644
--- a/src/OpenGL/libGLES_CM/Context.cpp
+++ b/src/OpenGL/libGLES_CM/Context.cpp
@@ -28,7 +28,7 @@
 #include "VertexDataManager.h"
 #include "IndexDataManager.h"
 #include "libEGL/Display.h"
-#include "libEGL/EGLSurface.h"
+#include "common/Surface.hpp"
 #include "Common/Half.hpp"
 
 #include <EGL/eglext.h>
@@ -281,7 +281,7 @@
 	delete device;
 }
 
-void Context::makeCurrent(egl::Surface *surface)
+void Context::makeCurrent(gl::Surface *surface)
 {
 	if(!mHasBeenCurrent)
 	{
@@ -3095,7 +3095,7 @@
 	mVertexDataManager->dirtyCurrentValue(index);
 }
 
-void Context::bindTexImage(egl::Surface *surface)
+void Context::bindTexImage(gl::Surface *surface)
 {
 	es1::Texture2D *textureObject = getTexture2D();
 
diff --git a/src/OpenGL/libGLES_CM/Context.h b/src/OpenGL/libGLES_CM/Context.h
index 63efb74..ab169be 100644
--- a/src/OpenGL/libGLES_CM/Context.h
+++ b/src/OpenGL/libGLES_CM/Context.h
@@ -33,10 +33,11 @@
 #include <map>
 #include <string>
 
+namespace gl { class Surface; }
+
 namespace egl
 {
 class Display;
-class Surface;
 class Config;
 }
 
@@ -296,7 +297,7 @@
 public:
 	Context(egl::Display *display, const Context *shareContext, const egl::Config *config);
 
-	void makeCurrent(egl::Surface *surface) override;
+	void makeCurrent(gl::Surface *surface) override;
 	EGLint getClientVersion() const override;
 	EGLint getConfigID() const override;
 
@@ -508,9 +509,9 @@
 
 	static int getSupportedMultisampleCount(int requested);
 
-	virtual void bindTexImage(egl::Surface *surface);
-	virtual EGLenum validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel);
-	virtual egl::Image *createSharedImage(EGLenum target, GLuint name, GLuint textureLevel);
+	void bindTexImage(gl::Surface *surface) override;
+	EGLenum validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel) override;
+	egl::Image *createSharedImage(EGLenum target, GLuint name, GLuint textureLevel) override;
 	egl::Image *getSharedImage(GLeglImageOES image);
 
 	Device *getDevice();
@@ -579,7 +580,7 @@
 	void setPointFadeThresholdSize(float threshold);
 
 private:
-	virtual ~Context();
+	~Context() override;
 
 	bool applyRenderTarget();
 	void applyState(GLenum drawMode);
diff --git a/src/OpenGL/libGLES_CM/Texture.cpp b/src/OpenGL/libGLES_CM/Texture.cpp
index d54885c..e2e8400 100644
--- a/src/OpenGL/libGLES_CM/Texture.cpp
+++ b/src/OpenGL/libGLES_CM/Texture.cpp
@@ -23,7 +23,7 @@
 #include "Framebuffer.h"
 #include "Device.hpp"
 #include "libEGL/Display.h"
-#include "libEGL/EGLSurface.h"
+#include "common/Surface.hpp"
 #include "common/debug.h"
 
 #include <algorithm>
@@ -474,7 +474,7 @@
 	Texture::setImage(format, type, unpackAlignment, pixels, image[level]);
 }
 
-void Texture2D::bindTexImage(egl::Surface *surface)
+void Texture2D::bindTexImage(gl::Surface *surface)
 {
 	GLenum format;
 
diff --git a/src/OpenGL/libGLES_CM/Texture.h b/src/OpenGL/libGLES_CM/Texture.h
index ba0c4d5..82e4b33 100644
--- a/src/OpenGL/libGLES_CM/Texture.h
+++ b/src/OpenGL/libGLES_CM/Texture.h
@@ -29,11 +29,8 @@
 
 #include <vector>
 
-namespace egl
-{
-class Surface;
-class Config;
-}
+namespace gl { class Surface; }
+namespace egl { class Config; }
 
 namespace es1
 {
@@ -155,7 +152,7 @@
 	virtual bool isSamplerComplete() const;
 	virtual bool isCompressed(GLenum target, GLint level) const;
 	virtual bool isDepth(GLenum target, GLint level) const;
-	virtual void bindTexImage(egl::Surface *surface);
+	virtual void bindTexImage(gl::Surface *surface);
 	virtual void releaseTexImage();
 
 	virtual void generateMipmaps();
@@ -174,7 +171,7 @@
 
 	egl::Image *image[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
 
-	egl::Surface *mSurface;
+	gl::Surface *mSurface;
 
 	// A specific internal reference count is kept for colorbuffer proxy references,
 	// because, as the renderbuffer acting as proxy will maintain a binding pointer
diff --git a/src/OpenGL/libGLES_CM/main.cpp b/src/OpenGL/libGLES_CM/main.cpp
index 036147f..f9b3cbd 100644
--- a/src/OpenGL/libGLES_CM/main.cpp
+++ b/src/OpenGL/libGLES_CM/main.cpp
@@ -18,7 +18,7 @@
 
 #include "libGLES_CM.hpp"
 #include "Framebuffer.h"
-#include "libEGL/EGLSurface.h"
+#include "common/Surface.hpp"
 #include "Common/Thread.hpp"
 #include "Common/SharedLibrary.hpp"
 #include "common/debug.h"