Add 6-bit and 5-bit sRGB conversion.

Bug 20891368

Change-Id: I3b7066f20f0e669dc1d3abe9222654318ae3b011
Reviewed-on: https://swiftshader-review.googlesource.com/3114
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/Shader/PixelRoutine.cpp b/src/Shader/PixelRoutine.cpp
index dda011a..773ceaf 100644
--- a/src/Shader/PixelRoutine.cpp
+++ b/src/Shader/PixelRoutine.cpp
@@ -2561,7 +2561,7 @@
 
 		if(postBlendSRGB && state.writeSRGB)
 		{
-			sRGBtoLinear16_16(r, pixel);	
+			sRGBtoLinear16_12_16(r, pixel);	
 		}
 
 		// Final Color = ObjectColor * SourceBlendFactor + PixelColor * DestinationBlendFactor
@@ -2682,7 +2682,7 @@
 
 		if(postBlendSRGB && state.writeSRGB)
 		{
-			linearToSRGB16_16(r, current);
+			linearToSRGB16_12_16(r, current);
 		}
 
 		if(exactColorRounding)
@@ -4365,7 +4365,7 @@
 		return Float4(cs) * Float4(1.0f / 0xFFFF);
 	}
 
-	void PixelRoutine::sRGBtoLinear16_16(Registers &r, Vector4s &c)
+	void PixelRoutine::sRGBtoLinear16_12_16(Registers &r, Vector4s &c)
 	{
 		c.x = As<UShort4>(c.x) >> 4;
 		c.y = As<UShort4>(c.y) >> 4;
@@ -4376,7 +4376,7 @@
 
 	void PixelRoutine::sRGBtoLinear12_16(Registers &r, Vector4s &c)
 	{
-		Pointer<Byte> LUT = r.constants + OFFSET(Constants,sRGBtoLin12_16);
+		Pointer<Byte> LUT = r.constants + OFFSET(Constants,sRGBtoLinear12_16);
 
 		c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 0))), 0);
 		c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 1))), 1);
@@ -4394,7 +4394,7 @@
 		c.z = Insert(c.z, *Pointer<Short>(LUT + 2 * Int(Extract(c.z, 3))), 3);
 	}
 
-	void PixelRoutine::linearToSRGB16_16(Registers &r, Vector4s &c)
+	void PixelRoutine::linearToSRGB16_12_16(Registers &r, Vector4s &c)
 	{
 		c.x = As<UShort4>(c.x) >> 4;
 		c.y = As<UShort4>(c.y) >> 4;
@@ -4405,7 +4405,7 @@
 
 	void PixelRoutine::linearToSRGB12_16(Registers &r, Vector4s &c)
 	{
-		Pointer<Byte> LUT = r.constants + OFFSET(Constants,linToSRGB12_16);
+		Pointer<Byte> LUT = r.constants + OFFSET(Constants,linearToSRGB12_16);
 
 		c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 0))), 0);
 		c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 1))), 1);