Texture3D copy to level

Bug 19126833

Change-Id: I6da0f1a3d09ab8f510f6f5b2600d911095e02a43
Reviewed-on: https://swiftshader-review.googlesource.com/2200
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/libGLESv2/Device.cpp b/src/OpenGL/libGLESv2/Device.cpp
index 777cbd4..edeb0d7 100644
--- a/src/OpenGL/libGLESv2/Device.cpp
+++ b/src/OpenGL/libGLESv2/Device.cpp
@@ -470,7 +470,7 @@
 		this->viewport = viewport;

 	}

 

-	bool Device::stretchRect(egl::Image *source, const sw::Rect *sourceRect, egl::Image *dest, const sw::Rect *destRect, bool filter)

+	bool Device::stretchRect(egl::Image *source, const sw::SliceRect *sourceRect, egl::Image *dest, const sw::SliceRect *destRect, bool filter)

 	{

 		if(!source || !dest || !validRectangle(sourceRect, source) || !validRectangle(destRect, dest))

 		{

@@ -483,8 +483,8 @@
 		int dWidth = dest->getExternalWidth();

 		int dHeight = dest->getExternalHeight();

 

-		Rect sRect;

-		Rect dRect;

+		SliceRect sRect;

+		SliceRect dRect;

 

 		if(sourceRect)

 		{

@@ -526,8 +526,8 @@
 		{

 			if(source->hasDepth())

 			{

-				sw::byte *sourceBuffer = (sw::byte*)source->lockInternal(0, 0, 0, LOCK_READONLY, PUBLIC);

-				sw::byte *destBuffer = (sw::byte*)dest->lockInternal(0, 0, 0, LOCK_DISCARD, PUBLIC);

+				sw::byte *sourceBuffer = (sw::byte*)source->lockInternal(0, 0, sourceRect->slice, LOCK_READONLY, PUBLIC);

+				sw::byte *destBuffer = (sw::byte*)dest->lockInternal(0, 0, destRect->slice, LOCK_DISCARD, PUBLIC);

 

 				unsigned int width = source->getInternalWidth();

 				unsigned int height = source->getInternalHeight();

@@ -568,8 +568,8 @@
 		}

 		else if(!scaling && equalFormats)

 		{

-			unsigned char *sourceBytes = (unsigned char*)source->lockInternal(sRect.x0, sRect.y0, 0, LOCK_READONLY, PUBLIC);

-			unsigned char *destBytes = (unsigned char*)dest->lockInternal(dRect.x0, dRect.y0, 0, LOCK_READWRITE, PUBLIC);

+			unsigned char *sourceBytes = (unsigned char*)source->lockInternal(sRect.x0, sRect.y0, sourceRect->slice, LOCK_READONLY, PUBLIC);

+			unsigned char *destBytes = (unsigned char*)dest->lockInternal(dRect.x0, dRect.y0, destRect->slice, LOCK_READWRITE, PUBLIC);

 			unsigned int sourcePitch = source->getInternalPitchB();

 			unsigned int destPitch = dest->getInternalPitchB();