Move loop register usage to relative addressing.

Bug 22652760

Change-Id: I50c6935bac91f586953b0dd2abd0d2a859468ee1
Reviewed-on: https://swiftshader-review.googlesource.com/4579
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/VertexProgram.cpp b/src/Shader/VertexProgram.cpp
index a19cca6..a6126db 100644
--- a/src/Shader/VertexProgram.cpp
+++ b/src/Shader/VertexProgram.cpp
@@ -401,15 +401,6 @@
 								if(dst.z) pDst.z = r.o[dst.index].z;
 								if(dst.w) pDst.w = r.o[dst.index].w;
 							}
-							else if(dst.rel.type == Shader::PARAMETER_LOOP)
-							{
-								Int aL = r.aL[r.loopDepth];
-
-								if(dst.x) pDst.x = r.o[dst.index + aL].x;
-								if(dst.y) pDst.y = r.o[dst.index + aL].y;
-								if(dst.z) pDst.z = r.o[dst.index + aL].z;
-								if(dst.w) pDst.w = r.o[dst.index + aL].w;
-							}
 							else
 							{
 								Int a = relativeAddress(dst);
@@ -541,15 +532,6 @@
 							if(dst.z) r.o[dst.index].z = d.z;
 							if(dst.w) r.o[dst.index].w = d.w;
 						}
-						else if(dst.rel.type == Shader::PARAMETER_LOOP)
-						{
-							Int aL = r.aL[r.loopDepth];
-
-							if(dst.x) r.o[dst.index + aL].x = d.x;
-							if(dst.y) r.o[dst.index + aL].y = d.y;
-							if(dst.z) r.o[dst.index + aL].z = d.z;
-							if(dst.w) r.o[dst.index + aL].w = d.w;
-						}
 						else
 						{
 							Int a = relativeAddress(dst);
@@ -876,6 +858,10 @@
 
 			return Extract(c, 0) * var.rel.scale;
 		}
+		else if(var.rel.type == Shader::PARAMETER_LOOP)
+		{
+			return r.aL[r.loopDepth];
+		}
 		else ASSERT(false);
 
 		return 0;