Refactor Byte4 unpacking.

Change-Id: I82f8215ce4366e0795ce249b4d8f6c8e391af96c
Reviewed-on: https://swiftshader-review.googlesource.com/8568
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/Shader/SamplerCore.cpp b/src/Shader/SamplerCore.cpp
index 67b0f05..18feac3 100644
--- a/src/Shader/SamplerCore.cpp
+++ b/src/Shader/SamplerCore.cpp
@@ -1690,7 +1690,7 @@
 			uuuu = applyOffset(uuuu, offset.x, Int4(*Pointer<UShort4>(mipmap + OFFSET(Mipmap, width))), texelFetch ? ADDRESSING_TEXELFETCH : state.addressingModeU);
 			vvvv = applyOffset(vvvv, offset.y, Int4(*Pointer<UShort4>(mipmap + OFFSET(Mipmap, height))), texelFetch ? ADDRESSING_TEXELFETCH : state.addressingModeV);
 		}
-		
+
 		Short4 uuu2 = uuuu;
 		uuuu = As<Short4>(UnpackLow(uuuu, vvvv));
 		uuu2 = As<Short4>(UnpackHigh(uuu2, vvvv));
@@ -1776,12 +1776,12 @@
 			{
 			case 4:
 				{
-					Byte8 c0 = *Pointer<Byte8>(buffer[f0] + 4 * index[0]);
-					Byte8 c1 = *Pointer<Byte8>(buffer[f1] + 4 * index[1]);
-					Byte8 c2 = *Pointer<Byte8>(buffer[f2] + 4 * index[2]);
-					Byte8 c3 = *Pointer<Byte8>(buffer[f3] + 4 * index[3]);
-					c.x = UnpackLow(c0, c1);
-					c.y = UnpackLow(c2, c3);
+					Byte4 c0 = *Pointer<Byte4>(buffer[f0] + 4 * index[0]);
+					Byte4 c1 = *Pointer<Byte4>(buffer[f1] + 4 * index[1]);
+					Byte4 c2 = *Pointer<Byte4>(buffer[f2] + 4 * index[2]);
+					Byte4 c3 = *Pointer<Byte4>(buffer[f3] + 4 * index[3]);
+					c.x = Unpack(c0, c1);
+					c.y = Unpack(c2, c3);
 
 					switch(state.textureFormat)
 					{
@@ -1819,12 +1819,12 @@
 				break;
 			case 3:
 				{
-					Byte8 c0 = *Pointer<Byte8>(buffer[f0] + 4 * index[0]);
-					Byte8 c1 = *Pointer<Byte8>(buffer[f1] + 4 * index[1]);
-					Byte8 c2 = *Pointer<Byte8>(buffer[f2] + 4 * index[2]);
-					Byte8 c3 = *Pointer<Byte8>(buffer[f3] + 4 * index[3]);
-					c.x = UnpackLow(c0, c1);
-					c.y = UnpackLow(c2, c3);
+					Byte4 c0 = *Pointer<Byte4>(buffer[f0] + 4 * index[0]);
+					Byte4 c1 = *Pointer<Byte4>(buffer[f1] + 4 * index[1]);
+					Byte4 c2 = *Pointer<Byte4>(buffer[f2] + 4 * index[2]);
+					Byte4 c3 = *Pointer<Byte4>(buffer[f3] + 4 * index[3]);
+					c.x = Unpack(c0, c1);
+					c.y = Unpack(c2, c3);
 
 					switch(state.textureFormat)
 					{