Fixed size verification assert to include border

Whenever a cube map was being used, these asserts would fire as soon
as any border computation would happen. Fixed the asserts to allow
cube maps to work properly.

Change-Id: Iedc2661e63db37e5b4e77e08f97ce044e9f88837
Reviewed-on: https://swiftshader-review.googlesource.com/19468
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Renderer/Surface.cpp b/src/Renderer/Surface.cpp
index 5fc506d..cc1c5a7 100644
--- a/src/Renderer/Surface.cpp
+++ b/src/Renderer/Surface.cpp
@@ -44,7 +44,9 @@
 
 	void Surface::Buffer::write(int x, int y, int z, const Color<float> &color)
 	{
-		ASSERT(x < width && y < height && z < depth);
+		ASSERT((x >= -border) && (x < (width + border)));
+		ASSERT((y >= -border) && (y < (height + border)));
+		ASSERT((z >= 0) && (z < depth));
 
 		byte *element = (byte*)buffer + (x + border) * bytes + (y + border) * pitchB + z * samples * sliceB;
 
@@ -57,7 +59,8 @@
 
 	void Surface::Buffer::write(int x, int y, const Color<float> &color)
 	{
-		ASSERT(x < width && y < height);
+		ASSERT((x >= -border) && (x < (width + border)));
+		ASSERT((y >= -border) && (y < (height + border)));
 
 		byte *element = (byte*)buffer + (x + border) * bytes + (y + border) * pitchB;
 
@@ -400,7 +403,9 @@
 
 	Color<float> Surface::Buffer::read(int x, int y, int z) const
 	{
-		ASSERT(x < width && y < height && z < depth);
+		ASSERT((x >= -border) && (x < (width + border)));
+		ASSERT((y >= -border) && (y < (height + border)));
+		ASSERT((z >= 0) && (z < depth));
 
 		void *element = (unsigned char*)buffer + (x + border) * bytes + (y + border) * pitchB + z * samples * sliceB;
 
@@ -409,7 +414,8 @@
 
 	Color<float> Surface::Buffer::read(int x, int y) const
 	{
-		ASSERT(x < width && y < height);
+		ASSERT((x >= -border) && (x < (width + border)));
+		ASSERT((y >= -border) && (y < (height + border)));
 
 		void *element = (unsigned char*)buffer + (x + border) * bytes + (y + border) * pitchB;