Move common image implementations to EGL.

BUG=18110152

Change-Id: Ic3bf93d61682985e56b1b22c9fafd8c6e63cf442
Reviewed-on: https://swiftshader-review.googlesource.com/1253
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/GLES2/libEGL/Image.hpp b/src/GLES2/libEGL/Image.hpp
index 25024f5..2ca4525 100644
--- a/src/GLES2/libEGL/Image.hpp
+++ b/src/GLES2/libEGL/Image.hpp
@@ -14,31 +14,92 @@
 class Image : public sw::Surface

 {

 public:

-	Image(sw::Resource *texture, int width, int height, int depth, sw::Format format, bool lockable, bool renderTarget)

-		: sw::Surface(texture, width, height, depth, format, lockable, renderTarget)

+	Image(sw::Resource *resource, GLsizei width, GLsizei height, GLenum format, GLenum type, sw::Format internalFormat)

+		: width(width), height(height), format(format), type(type), internalFormat(internalFormat), multiSampleDepth(1)

+		, sw::Surface(resource, width, height, 1, internalFormat, true, true)

 	{

+		shared = false;

 	}

 

-	virtual void loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *input) = 0;

-	virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels) = 0;

+	Image(sw::Resource *resource, int width, int height, int depth, sw::Format internalFormat, bool lockable, bool renderTarget)

+		: width(width), height(height), format(0 /*GL_NONE*/), type(0 /*GL_NONE*/), internalFormat(internalFormat), multiSampleDepth(depth)

+		, sw::Surface(resource, width, height, depth, internalFormat, lockable, renderTarget)

+	{

+		shared = false;

+	}

 

-	virtual void *lock(unsigned int left, unsigned int top, sw::Lock lock) = 0;

-	virtual unsigned int getPitch() const = 0;

-	virtual void unlock() = 0;

+	GLsizei getWidth()

+	{

+		return width;

+	}

 

-	virtual int getWidth() = 0;

-	virtual int getHeight() = 0;

-	virtual GLenum getFormat() = 0;

-	virtual GLenum getType() = 0;

-	virtual sw::Format getInternalFormat() = 0;

-	virtual int getMultiSampleDepth() = 0;

+	GLsizei getHeight()

+	{

+		return height;

+	}

+

+	GLenum Image::getFormat()

+	{

+		return format;

+	}

+	

+	GLenum Image::getType()

+	{

+		return type;

+	}

+

+	sw::Format getInternalFormat()

+	{

+		return internalFormat;

+	}

+

+	int getMultiSampleDepth()

+	{

+		return multiSampleDepth;

+	}

+

+	bool Image::isShared() const

+    {

+        return shared;

+    }

+

+    void Image::markShared()

+    {

+        shared = true;

+    }

+

+	void *Image::lock(unsigned int left, unsigned int top, sw::Lock lock)

+	{

+		return lockExternal(left, top, 0, lock, sw::PUBLIC);

+	}

+

+	unsigned int Image::getPitch() const

+	{

+		return getExternalPitchB();

+	}

+

+	void Image::unlock()

+	{

+		unlockExternal();

+	}

 

 	virtual void addRef() = 0;

 	virtual void release() = 0;

 	virtual void unbind() = 0;   // Break parent ownership and release

 

-	virtual bool isShared() const = 0;

-	virtual void markShared() = 0;

+	virtual void loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *input) = 0;

+	virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels) = 0;

+

+protected:

+	const GLsizei width;

+	const GLsizei height;

+	const GLenum format;

+	const GLenum type;

+	const sw::Format internalFormat;

+	const int multiSampleDepth;

+

+private:

+	bool shared;   // Used as an EGLImage

 };

 }

 

diff --git a/src/GLES2/libGLES_CM/Device.cpp b/src/GLES2/libGLES_CM/Device.cpp
index 6042715..387b8dd 100644
--- a/src/GLES2/libGLES_CM/Device.cpp
+++ b/src/GLES2/libGLES_CM/Device.cpp
@@ -243,7 +243,7 @@
 			UNREACHABLE();

 		}

 

-		Image *surface = new Image(0, width, height, format, GL_NONE_OES, GL_NONE_OES, multiSampleDepth, lockable, true);

+		Image *surface = new Image(0, width, height, format, multiSampleDepth, lockable, true);

 

 		if(!surface)

 		{

@@ -262,7 +262,7 @@
 			return 0;

 		}

 

-		Image *surface = new Image(0, width, height, format, GL_NONE_OES, GL_NONE_OES, multiSampleDepth, lockable, true);

+		Image *surface = new Image(0, width, height, format, multiSampleDepth, lockable, true);

 

 		if(!surface)

 		{

diff --git a/src/GLES2/libGLES_CM/Image.cpp b/src/GLES2/libGLES_CM/Image.cpp
index 41bacb2..a0d3895 100644
--- a/src/GLES2/libGLES_CM/Image.cpp
+++ b/src/GLES2/libGLES_CM/Image.cpp
@@ -32,19 +32,16 @@
 	}
 
 	Image::Image(Texture *parentTexture, GLsizei width, GLsizei height, GLenum format, GLenum type)
-		: parentTexture(parentTexture), width(width), height(height), format(format), type(type)
-		, internalFormat(selectInternalFormat(format, type)), multiSampleDepth(1)
-		, egl::Image(getParentResource(parentTexture), width, height, 1, selectInternalFormat(format, type), true, true)
+		: parentTexture(parentTexture)
+		, egl::Image(getParentResource(parentTexture), width, height, format, type, selectInternalFormat(format, type))
 	{
-        shared = false;
 		referenceCount = 1;
 	}
 
-	Image::Image(Texture *parentTexture, GLsizei width, GLsizei height, sw::Format internalFormat, GLenum format, GLenum type, int multiSampleDepth, bool lockable, bool renderTarget)
-		: parentTexture(parentTexture), width(width), height(height), internalFormat(internalFormat), format(format), type(type), multiSampleDepth(multiSampleDepth)
+	Image::Image(Texture *parentTexture, GLsizei width, GLsizei height, sw::Format internalFormat, int multiSampleDepth, bool lockable, bool renderTarget)
+		: parentTexture(parentTexture)
 		, egl::Image(getParentResource(parentTexture), width, height, multiSampleDepth, internalFormat, lockable, renderTarget)
 	{
-        shared = false;
 		referenceCount = 1;
 	}
 
@@ -53,51 +50,6 @@
 		ASSERT(referenceCount == 0);
 	}
 
-	void *Image::lock(unsigned int left, unsigned int top, sw::Lock lock)
-	{
-		return lockExternal(left, top, 0, lock, sw::PUBLIC);
-	}
-
-	unsigned int Image::getPitch() const
-	{
-		return getExternalPitchB();
-	}
-
-	void Image::unlock()
-	{
-		unlockExternal();
-	}
-
-	int Image::getWidth()
-	{
-		return width;
-	}
-	
-	int Image::getHeight()
-	{
-		return height;
-	}
-
-	GLenum Image::getFormat()
-	{
-		return format;
-	}
-	
-	GLenum Image::getType()
-	{
-		return type;
-	}
-	
-	sw::Format Image::getInternalFormat()
-	{
-		return internalFormat;
-	}
-	
-	int Image::getMultiSampleDepth()
-	{
-		return multiSampleDepth;
-	}
-
 	void Image::addRef()
 	{
 		if(parentTexture)
@@ -133,16 +85,6 @@
 		release();
 	}
 
-    bool Image::isShared() const
-    {
-        return shared;
-    }
-
-    void Image::markShared()
-    {
-        shared = true;
-    }
-
 	sw::Format Image::selectInternalFormat(GLenum format, GLenum type)
 	{
 		#if S3TC_SUPPORT
@@ -206,11 +148,6 @@
 		return sw::FORMAT_A8R8G8B8;
 	}
 
-	int Image::bytes(sw::Format format)
-	{
-		return sw::Surface::bytes(format);
-	}
-
 	void Image::loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *input)
 	{
 		GLsizei inputPitch = ComputePitch(width, format, type, unpackAlignment);
@@ -337,23 +274,6 @@
 		}
 	}
 
-	void Image::loadAlphaHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const
-	{
-		for(int y = 0; y < height; y++)
-		{
-			const unsigned short *source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-			unsigned short *dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(buffer) + (y + yoffset) * getPitch() + xoffset * 8);
-			
-			for(int x = 0; x < width; x++)
-			{
-				dest[4 * x + 0] = 0;
-				dest[4 * x + 1] = 0;
-				dest[4 * x + 2] = 0;
-				dest[4 * x + 3] = source[x];
-			}
-		}
-	}
-
 	void Image::loadLuminanceImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const
 	{
 		for(int y = 0; y < height; y++)
@@ -382,23 +302,6 @@
 		}
 	}
 
-	void Image::loadLuminanceHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const
-	{
-		for(int y = 0; y < height; y++)
-		{
-			const unsigned short *source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-			unsigned short *dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(buffer) + (y + yoffset) * getPitch() + xoffset * 8);
-			
-			for(int x = 0; x < width; x++)
-			{
-				dest[4 * x + 0] = source[x];
-				dest[4 * x + 1] = source[x];
-				dest[4 * x + 2] = source[x];
-				dest[4 * x + 3] = 0x3C00; // SEEEEEMMMMMMMMMM, S = 0, E = 15, M = 0: 16bit flpt representation of 1
-			}
-		}
-	}
-
 	void Image::loadLuminanceAlphaImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const
 	{
 		for(int y = 0; y < height; y++)
@@ -427,23 +330,6 @@
 		}
 	}
 
-	void Image::loadLuminanceAlphaHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const
-	{
-		for(int y = 0; y < height; y++)
-		{
-			const unsigned short *source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-			unsigned short *dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(buffer) + (y + yoffset) * getPitch() + xoffset * 8);
-			
-			for(int x = 0; x < width; x++)
-			{
-				dest[4 * x + 0] = source[2*x+0];
-				dest[4 * x + 1] = source[2*x+0];
-				dest[4 * x + 2] = source[2*x+0];
-				dest[4 * x + 3] = source[2*x+1];
-			}
-		}
-	}
-
 	void Image::loadRGBUByteImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const
 	{
 		for(int y = 0; y < height; y++)
@@ -496,23 +382,6 @@
 		}
 	}
 
-	void Image::loadRGBHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const
-	{
-		for(int y = 0; y < height; y++)
-		{
-			const unsigned short *source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
-			unsigned short *dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(buffer) + (y + yoffset) * getPitch() + xoffset * 8);
-			
-			for(int x = 0; x < width; x++)
-			{
-				dest[4 * x + 0] = source[x * 3 + 0];
-				dest[4 * x + 1] = source[x * 3 + 1];
-				dest[4 * x + 2] = source[x * 3 + 2];
-				dest[4 * x + 3] = 0x3C00; // SEEEEEMMMMMMMMMM, S = 0, E = 15, M = 0: 16bit flpt representation of 1
-			}
-		}
-	}
-
 	void Image::loadRGBAUByteImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const
 	{
 		for(int y = 0; y < height; y++)
@@ -575,17 +444,6 @@
 		}
 	}
 
-	void Image::loadRGBAHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const
-	{
-		for(int y = 0; y < height; y++)
-		{
-			const unsigned char *source = static_cast<const unsigned char*>(input) + y * inputPitch;
-			unsigned char *dest = static_cast<unsigned char*>(buffer) + (y + yoffset) * getPitch() + xoffset * 8;
-			
-			memcpy(dest, source, width * 8);
-		}
-	}
-
 	void Image::loadBGRAImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const
 	{
 		for(int y = 0; y < height; y++)
diff --git a/src/GLES2/libGLES_CM/Image.hpp b/src/GLES2/libGLES_CM/Image.hpp
index 5995647..f9ef9bb 100644
--- a/src/GLES2/libGLES_CM/Image.hpp
+++ b/src/GLES2/libGLES_CM/Image.hpp
@@ -26,67 +26,39 @@
 	{
 	public:
 		Image(Texture *parentTexture, GLsizei width, GLsizei height, GLenum format, GLenum type);
-		Image(Texture *parentTexture, GLsizei width, GLsizei height, sw::Format internalFormat, GLenum format, GLenum type, int multiSampleDepth, bool lockable, bool renderTarget);
+		Image(Texture *parentTexture, GLsizei width, GLsizei height, sw::Format internalFormat, int multiSampleDepth, bool lockable, bool renderTarget);
 
 		void loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *input);
 		void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
 
-		void *lock(unsigned int left, unsigned int top, sw::Lock lock);
-		unsigned int getPitch() const;
-		void unlock();
-		
-		int getWidth();
-		int getHeight();
-		GLenum getFormat();
-		GLenum getType();
-		virtual sw::Format getInternalFormat();
-		virtual int getMultiSampleDepth();
-
 		virtual void addRef();
 		virtual void release();
 		void unbind();   // Break parent ownership and release
 
-		virtual bool isShared() const;
-		void markShared();
-
 		static sw::Format selectInternalFormat(GLenum format, GLenum type);
-		static int bytes(sw::Format format);
 
 	private:
 		virtual ~Image();
 
 		void loadAlphaImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
 		void loadAlphaFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
-		void loadAlphaHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
 		void loadLuminanceImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
 		void loadLuminanceFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
-		void loadLuminanceHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
 		void loadLuminanceAlphaImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
 		void loadLuminanceAlphaFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
-		void loadLuminanceAlphaHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
 		void loadRGBUByteImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
 		void loadRGB565ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
 		void loadRGBFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
-		void loadRGBHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
 		void loadRGBAUByteImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
 		void loadRGBA4444ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
 		void loadRGBA5551ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
 		void loadRGBAFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
-		void loadRGBAHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
 		void loadBGRAImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
 		void loadD16ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
 		void loadD32ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
 		void loadD24S8ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer);
 
 		Texture *parentTexture;
-		bool shared;   // Used as an EGLImage
-
-		const GLsizei width;
-		const GLsizei height;
-		const GLenum format;
-		const GLenum type;
-		const sw::Format internalFormat;
-		const int multiSampleDepth;
 
 		volatile int referenceCount;
 	};
diff --git a/src/GLES2/libGLES_CM/Texture.cpp b/src/GLES2/libGLES_CM/Texture.cpp
index cd53de6..3898707 100644
--- a/src/GLES2/libGLES_CM/Texture.cpp
+++ b/src/GLES2/libGLES_CM/Texture.cpp
@@ -766,7 +766,7 @@
 			UNREACHABLE();

 		}

 

-		gl::Image *surface = new gl::Image(0, width, height, format, GL_NONE_OES, GL_NONE_OES, multiSampleDepth, lockable, true);

+		gl::Image *surface = new gl::Image(0, width, height, format, multiSampleDepth, lockable, true);

 

 		if(!surface)

 		{

diff --git a/src/GLES2/libGLESv2/Device.cpp b/src/GLES2/libGLESv2/Device.cpp
index 7a0488b..dbd2bf5 100644
--- a/src/GLES2/libGLESv2/Device.cpp
+++ b/src/GLES2/libGLESv2/Device.cpp
@@ -265,7 +265,7 @@
 			UNREACHABLE();

 		}

 

-		Image *surface = new Image(0, width, height, format, GL_NONE, GL_NONE, multiSampleDepth, lockable, true);

+		Image *surface = new Image(0, width, height, format, multiSampleDepth, lockable, true);

 

 		if(!surface)

 		{

@@ -284,7 +284,7 @@
 			return 0;

 		}

 

-		Image *surface = new Image(0, width, height, format, GL_NONE, GL_NONE, multiSampleDepth, lockable, true);

+		Image *surface = new Image(0, width, height, format, multiSampleDepth, lockable, true);

 

 		if(!surface)

 		{

diff --git a/src/GLES2/libGLESv2/Image.cpp b/src/GLES2/libGLESv2/Image.cpp
index 85bfa1e..fb9976c 100644
--- a/src/GLES2/libGLESv2/Image.cpp
+++ b/src/GLES2/libGLESv2/Image.cpp
@@ -31,19 +31,16 @@
 	}
 
 	Image::Image(Texture *parentTexture, GLsizei width, GLsizei height, GLenum format, GLenum type)
-		: parentTexture(parentTexture), width(width), height(height), format(format), type(type)
-		, internalFormat(selectInternalFormat(format, type)), multiSampleDepth(1)
-		, egl::Image(getParentResource(parentTexture), width, height, 1, selectInternalFormat(format, type), true, true)
+		: parentTexture(parentTexture)
+		, egl::Image(getParentResource(parentTexture), width, height, format, type, selectInternalFormat(format, type))
 	{
-        shared = false;
 		referenceCount = 1;
 	}
 
-	Image::Image(Texture *parentTexture, GLsizei width, GLsizei height, sw::Format internalFormat, GLenum format, GLenum type, int multiSampleDepth, bool lockable, bool renderTarget)
-		: parentTexture(parentTexture), width(width), height(height), internalFormat(internalFormat), format(format), type(type), multiSampleDepth(multiSampleDepth)
+	Image::Image(Texture *parentTexture, GLsizei width, GLsizei height, sw::Format internalFormat, int multiSampleDepth, bool lockable, bool renderTarget)
+		: parentTexture(parentTexture)
 		, egl::Image(getParentResource(parentTexture), width, height, multiSampleDepth, internalFormat, lockable, renderTarget)
 	{
-        shared = false;
 		referenceCount = 1;
 	}
 
@@ -52,51 +49,6 @@
 		ASSERT(referenceCount == 0);
 	}
 
-	void *Image::lock(unsigned int left, unsigned int top, sw::Lock lock)
-	{
-		return lockExternal(left, top, 0, lock, sw::PUBLIC);
-	}
-
-	unsigned int Image::getPitch() const
-	{
-		return getExternalPitchB();
-	}
-
-	void Image::unlock()
-	{
-		unlockExternal();
-	}
-
-	int Image::getWidth()
-	{
-		return width;
-	}
-	
-	int Image::getHeight()
-	{
-		return height;
-	}
-
-	GLenum Image::getFormat()
-	{
-		return format;
-	}
-	
-	GLenum Image::getType()
-	{
-		return type;
-	}
-	
-	sw::Format Image::getInternalFormat()
-	{
-		return internalFormat;
-	}
-	
-	int Image::getMultiSampleDepth()
-	{
-		return multiSampleDepth;
-	}
-
 	void Image::addRef()
 	{
 		if(parentTexture)
@@ -132,16 +84,6 @@
 		release();
 	}
 
-    bool Image::isShared() const
-    {
-        return shared;
-    }
-
-    void Image::markShared()
-    {
-        shared = true;
-    }
-
 	sw::Format Image::selectInternalFormat(GLenum format, GLenum type)
 	{
 		#if S3TC_SUPPORT
@@ -225,11 +167,6 @@
 		return sw::FORMAT_A8R8G8B8;
 	}
 
-	int Image::bytes(sw::Format format)
-	{
-		return sw::Surface::bytes(format);
-	}
-
 	void Image::loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *input)
 	{
 		GLsizei inputPitch = ComputePitch(width, format, type, unpackAlignment);
diff --git a/src/GLES2/libGLESv2/Image.hpp b/src/GLES2/libGLESv2/Image.hpp
index e796bcd..feea102 100644
--- a/src/GLES2/libGLESv2/Image.hpp
+++ b/src/GLES2/libGLESv2/Image.hpp
@@ -26,31 +26,16 @@
 	{
 	public:
 		Image(Texture *parentTexture, GLsizei width, GLsizei height, GLenum format, GLenum type);
-		Image(Texture *parentTexture, GLsizei width, GLsizei height, sw::Format internalFormat, GLenum format, GLenum type, int multiSampleDepth, bool lockable, bool renderTarget);
+		Image(Texture *parentTexture, GLsizei width, GLsizei height, sw::Format internalFormat, int multiSampleDepth, bool lockable, bool renderTarget);
 
 		void loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *input);
 		void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
 
-		void *lock(unsigned int left, unsigned int top, sw::Lock lock);
-		unsigned int getPitch() const;
-		void unlock();
-		
-		int getWidth();
-		int getHeight();
-		GLenum getFormat();
-		GLenum getType();
-		virtual sw::Format getInternalFormat();
-		virtual int getMultiSampleDepth();
-
 		virtual void addRef();
 		virtual void release();
 		void unbind();   // Break parent ownership and release
 
-		virtual bool isShared() const;
-		void markShared();
-
 		static sw::Format selectInternalFormat(GLenum format, GLenum type);
-		static int bytes(sw::Format format);
 
 	private:
 		virtual ~Image();
@@ -79,14 +64,6 @@
 		void loadD24S8ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer);
 
 		Texture *parentTexture;
-		bool shared;   // Used as an EGLImage
-
-		const GLsizei width;
-		const GLsizei height;
-		const GLenum format;
-		const GLenum type;
-		const sw::Format internalFormat;
-		const int multiSampleDepth;
 
 		volatile int referenceCount;
 	};
diff --git a/src/GLES2/libGLESv2/Texture.cpp b/src/GLES2/libGLESv2/Texture.cpp
index 30eebe4..09998ce 100644
--- a/src/GLES2/libGLESv2/Texture.cpp
+++ b/src/GLES2/libGLESv2/Texture.cpp
@@ -1199,7 +1199,7 @@
 			UNREACHABLE();

 		}

 

-		gl::Image *surface = new gl::Image(0, width, height, format, GL_NONE, GL_NONE, multiSampleDepth, lockable, true);

+		gl::Image *surface = new gl::Image(0, width, height, format, multiSampleDepth, lockable, true);

 

 		if(!surface)

 		{