Added FORMAT_X32B32G32R32F as a renderable format

Added code to properly render to alphaless floating point formats.

Change-Id: I2e226fb787d8456f61a2946fb9c0d8a9dbb58243
Reviewed-on: https://swiftshader-review.googlesource.com/5128
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Shader/PixelPipeline.cpp b/src/Shader/PixelPipeline.cpp
index 99f91e7..8adeed8 100644
--- a/src/Shader/PixelPipeline.cpp
+++ b/src/Shader/PixelPipeline.cpp
@@ -351,6 +351,7 @@
 			break;
 		case FORMAT_R32F:
 		case FORMAT_G32R32F:
+		case FORMAT_X32B32G32R32F:
 		case FORMAT_A32B32G32R32F:
 			convertSigned12(oC, current);
 			PixelRoutine::fogBlend(oC, fog);
diff --git a/src/Shader/PixelProgram.cpp b/src/Shader/PixelProgram.cpp
index b005863..b0e47fd 100644
--- a/src/Shader/PixelProgram.cpp
+++ b/src/Shader/PixelProgram.cpp
@@ -615,6 +615,7 @@
 				break;
 			case FORMAT_R32F:
 			case FORMAT_G32R32F:
+			case FORMAT_X32B32G32R32F:
 			case FORMAT_A32B32G32R32F:
 			case FORMAT_R32I:
 			case FORMAT_G32R32I:
@@ -727,6 +728,7 @@
 				break;
 			case FORMAT_R32F:
 			case FORMAT_G32R32F:
+			case FORMAT_X32B32G32R32F:
 			case FORMAT_A32B32G32R32F:
 			case FORMAT_R32I:
 			case FORMAT_G32R32I:
diff --git a/src/Shader/PixelRoutine.cpp b/src/Shader/PixelRoutine.cpp
index 2b5f087..ca38074 100644
--- a/src/Shader/PixelRoutine.cpp
+++ b/src/Shader/PixelRoutine.cpp
@@ -2006,6 +2006,7 @@
 			pixel.y = pixel.z;
 			pixel.z = pixel.w = one;
 			break;
+		case FORMAT_X32B32G32R32F:
 		case FORMAT_A32B32G32R32F:
 		case FORMAT_A32B32G32R32I:
 		case FORMAT_A32B32G32R32UI:
@@ -2016,6 +2017,10 @@
 			pixel.z = *Pointer<Float4>(buffer + 16 * x, 16);
 			pixel.w = *Pointer<Float4>(buffer + 16 * x + 16, 16);
 			transpose4x4(pixel.x, pixel.y, pixel.z, pixel.w);
+			if(state.targetFormat[index] == FORMAT_X32B32G32R32F)
+			{
+				pixel.w = Float4(1.0f);
+			}
 			break;
 		default:
 			ASSERT(false);
@@ -2154,6 +2159,7 @@
 			oC.z = UnpackHigh(oC.z, oC.y);
 			oC.y = oC.z;
 			break;
+		case FORMAT_X32B32G32R32F:
 		case FORMAT_A32B32G32R32F:
 		case FORMAT_A32B32G32R32I:
 		case FORMAT_A32B32G32R32UI:
@@ -2257,6 +2263,7 @@
 			oC.y = As<Float4>(As<Int4>(oC.y) | As<Int4>(value));
 			*Pointer<Float4>(buffer) = oC.y;
 			break;
+		case FORMAT_X32B32G32R32F:
 		case FORMAT_A32B32G32R32F:
 		case FORMAT_A32B32G32R32I:
 		case FORMAT_A32B32G32R32UI:
@@ -2316,7 +2323,7 @@
 			}
 
 			{
-				value = *Pointer<Float4>(buffer + 16, 16);
+				value = (state.targetFormat[index] == FORMAT_X32B32G32R32F) ? Float4(1.0f) : *Pointer<Float4>(buffer + 16, 16);
 
 				if(rgbaWriteMask != 0x0000000F)
 				{
diff --git a/src/Shader/SamplerCore.cpp b/src/Shader/SamplerCore.cpp
index 8128617..4f8943a 100644
--- a/src/Shader/SamplerCore.cpp
+++ b/src/Shader/SamplerCore.cpp
@@ -261,6 +261,7 @@
 					c.y = Short4(0x1000, 0x1000, 0x1000, 0x1000);
 				case FORMAT_G32R32F:
 					c.z = Short4(0x1000, 0x1000, 0x1000, 0x1000);
+				case FORMAT_X32B32G32R32F:
 					c.w = Short4(0x1000, 0x1000, 0x1000, 0x1000);
 				case FORMAT_A32B32G32R32F:
 					break;
@@ -520,6 +521,7 @@
 					c.y = Float4(1.0f);
 				case FORMAT_G32R32F:
 					c.z = Float4(1.0f);
+				case FORMAT_X32B32G32R32F:
 					c.w = Float4(1.0f);
 				case FORMAT_A32B32G32R32F:
 					break;
@@ -2183,6 +2185,7 @@
 		case FORMAT_X8L8V8U8:
 		case FORMAT_R32F:
 		case FORMAT_G32R32F:
+		case FORMAT_X32B32G32R32F:
 		case FORMAT_A32B32G32R32F:
 		case FORMAT_A8:
 		case FORMAT_R8:
@@ -2249,6 +2252,7 @@
 		case FORMAT_R5G6B5:
 		case FORMAT_R32F:
 		case FORMAT_G32R32F:
+		case FORMAT_X32B32G32R32F:
 		case FORMAT_A32B32G32R32F:
 		case FORMAT_D32F:
 		case FORMAT_D32F_LOCKABLE:
@@ -2322,6 +2326,7 @@
 		case FORMAT_X8L8V8U8:
 		case FORMAT_R32F:
 		case FORMAT_G32R32F:
+		case FORMAT_X32B32G32R32F:
 		case FORMAT_A32B32G32R32F:
 		case FORMAT_A8:
 		case FORMAT_R8:
@@ -2396,6 +2401,7 @@
 		case FORMAT_X8L8V8U8:
 		case FORMAT_R32F:
 		case FORMAT_G32R32F:
+		case FORMAT_X32B32G32R32F:
 		case FORMAT_A32B32G32R32F:
 		case FORMAT_A8:
 		case FORMAT_R8:
@@ -2462,6 +2468,7 @@
 		case FORMAT_X8L8V8U8:       return false;
 		case FORMAT_R32F:           return component < 1;
 		case FORMAT_G32R32F:        return component < 2;
+		case FORMAT_X32B32G32R32F:  return component < 3;
 		case FORMAT_A32B32G32R32F:  return component < 3;
 		case FORMAT_A8:             return false;
 		case FORMAT_R8:             return component < 1;