A2R10G10B10 Support

A2B10G10R10 (RGBA) was already supported by
SwiftShader, but A2R10G10B10 (BGRA) was not. Most of
this cl is trivial, as it simply adds an equivalent
version of the new formats from the code used for the
already supported formats, with the R and B channels
swapped.

The only new piece of code is rounding for 1010102
formats at the top of the PixelRoutine::writeColor()
function. There was already rounding for 8 bit formats,
but not 1010102, which led to potential off by 1 errors
in the output, which is fairly large when it happens
on the 2 bit alpha channel. This fixes one of the
dEQP-VK.pipeline.blend.*a2r10g10b10* tests.

Tests: dEQP-VK.*a2r10g10b10*
Bug b/142661203

Change-Id: Ifcae17aecafab3ea7967fdc755391ddd5e651ca5
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/40008
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Pipeline/PixelProgram.cpp b/src/Pipeline/PixelProgram.cpp
index 0bfd0b0..7782f20 100644
--- a/src/Pipeline/PixelProgram.cpp
+++ b/src/Pipeline/PixelProgram.cpp
@@ -231,6 +231,7 @@
 			case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
 			case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
 			case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
+			case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
 				for(unsigned int q = 0; q < state.multiSample; q++)
 				{
 					if(state.multiSampleMask & (1 << q))
@@ -276,6 +277,7 @@
 			case VK_FORMAT_A8B8G8R8_UINT_PACK32:
 			case VK_FORMAT_A8B8G8R8_SINT_PACK32:
 			case VK_FORMAT_A2B10G10R10_UINT_PACK32:
+			case VK_FORMAT_A2R10G10B10_UINT_PACK32:
 				for(unsigned int q = 0; q < state.multiSample; q++)
 				{
 					if(state.multiSampleMask & (1 << q))
@@ -320,6 +322,7 @@
 			case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
 			case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
 			case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
+			case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
 				oC[index].x = Max(oC[index].x, Float4(0.0f));
 				oC[index].x = Min(oC[index].x, Float4(1.0f));
 				oC[index].y = Max(oC[index].y, Float4(0.0f));
@@ -357,6 +360,7 @@
 			case VK_FORMAT_A8B8G8R8_UINT_PACK32:
 			case VK_FORMAT_A8B8G8R8_SINT_PACK32:
 			case VK_FORMAT_A2B10G10R10_UINT_PACK32:
+			case VK_FORMAT_A2R10G10B10_UINT_PACK32:
 				break;
 			default:
 				UNIMPLEMENTED("VkFormat: %d", int(state.targetFormat[index]));