Support HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED as RGBX8888

The 3.0 camera HAL makes extensive use of
HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, which Android defines as the
format that is best for the hardware. The fake camera implementation
decided that that was RGBX8888, so it seem like that is what we should
use.

Test: untested
Change-Id: Ia02ebbefd015f9ca099b4393daf5d464f38fe8fc
Reviewed-on: https://swiftshader-review.googlesource.com/8588
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/Main/FrameBufferAndroid.cpp b/src/Main/FrameBufferAndroid.cpp
index 7f617d8..7b05a19 100644
--- a/src/Main/FrameBufferAndroid.cpp
+++ b/src/Main/FrameBufferAndroid.cpp
@@ -117,6 +117,9 @@
 		case HAL_PIXEL_FORMAT_RGB_565: destFormat = FORMAT_R5G6B5; break;
 		case HAL_PIXEL_FORMAT_RGB_888: destFormat = FORMAT_R8G8B8; break;
 		case HAL_PIXEL_FORMAT_RGBA_8888: destFormat = FORMAT_A8B8G8R8; break;
+#if ANDROID_PLATFORM_SDK_VERSION > 16
+		case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED: destFormat = FORMAT_X8B8G8R8; break;
+#endif
 		case HAL_PIXEL_FORMAT_RGBX_8888: destFormat = FORMAT_X8B8G8R8; break;
 		case HAL_PIXEL_FORMAT_BGRA_8888: destFormat = FORMAT_A8R8G8B8; break;
 		}
diff --git a/src/OpenGL/common/Image.hpp b/src/OpenGL/common/Image.hpp
index dbbe0dc..5a4e289 100644
--- a/src/OpenGL/common/Image.hpp
+++ b/src/OpenGL/common/Image.hpp
@@ -199,6 +199,9 @@
 	switch(halFormat)
 	{
 	case HAL_PIXEL_FORMAT_RGBA_8888: return GL_RGBA8;
+#if ANDROID_PLATFORM_SDK_VERSION > 16
+	case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED: return GL_RGB8;
+#endif
 	case HAL_PIXEL_FORMAT_RGBX_8888: return GL_RGB8;
 	case HAL_PIXEL_FORMAT_RGB_888:   return GL_NONE;   // Unsupported
 	case HAL_PIXEL_FORMAT_BGRA_8888: return GL_BGRA8_EXT;
@@ -216,6 +219,9 @@
 	switch(halFormat)
 	{
 	case HAL_PIXEL_FORMAT_RGBA_8888: return GL_UNSIGNED_BYTE;
+#if ANDROID_PLATFORM_SDK_VERSION > 16
+	case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED: return GL_UNSIGNED_BYTE;
+#endif
 	case HAL_PIXEL_FORMAT_RGBX_8888: return GL_UNSIGNED_BYTE;
 	case HAL_PIXEL_FORMAT_RGB_888:   return GL_NONE;   // Unsupported
 	case HAL_PIXEL_FORMAT_BGRA_8888: return GL_UNSIGNED_BYTE;