Texture Rectangle implementation

This adds support for GL_ARB_texture_rectangle, as it is used in Chromium.
This is required in order to use EGL/GLES on MacOS using IOSurface,
in order to be able to run Chromium on top of SwiftShader on MacOS.

Change-Id: I3c0b6a137892583bbfbc68149874d5bec3026b4a
Reviewed-on: https://swiftshader-review.googlesource.com/16368
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/OpenGL/compiler/OutputASM.cpp b/src/OpenGL/compiler/OutputASM.cpp
index fbdc113..76a177a 100644
--- a/src/OpenGL/compiler/OutputASM.cpp
+++ b/src/OpenGL/compiler/OutputASM.cpp
@@ -139,6 +139,8 @@
 			return GL_UNSIGNED_INT_SAMPLER_2D;
 		case EbtSamplerCube:
 			return GL_SAMPLER_CUBE;
+		case EbtSampler2DRect:
+			return GL_SAMPLER_2D_RECT_ARB;
 		case EbtISamplerCube:
 			return GL_INT_SAMPLER_CUBE;
 		case EbtUSamplerCube:
@@ -497,6 +499,15 @@
 			proj = true;
 			offset = true;
 		}
+		else if(name == "texture2DRect")
+		{
+			method = RECT;
+		}
+		else if(name == "texture2DRectProj")
+		{
+			method = RECT;
+			proj = true;
+		}
 		else UNREACHABLE(0);
 	}
 
@@ -1464,6 +1475,9 @@
 						}
 						else UNREACHABLE(argumentCount);
 						break;
+					case TextureFunction::RECT:
+						emit(sw::Shader::OPCODE_TEXRECT, result, &coord, s);
+						break;
 					case TextureFunction::SIZE:
 						emit(sw::Shader::OPCODE_TEXSIZE, result, arg[1], s);
 						break;