Enable R5G6B5 as an internal format.
Bug 20891368
Change-Id: Iea526eebe65616079578563126a6958d87647eb1
Reviewed-on: https://swiftshader-review.googlesource.com/3255
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/common/Image.cpp b/src/OpenGL/common/Image.cpp
index fd9ab52..a0f7ac6 100644
--- a/src/OpenGL/common/Image.cpp
+++ b/src/OpenGL/common/Image.cpp
@@ -186,17 +186,7 @@
template<>
void LoadImageRow<RGB565>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
{
- const unsigned short *source565 = reinterpret_cast<const unsigned short*>(source);
- unsigned char *destB = dest + xoffset * 4;
-
- for(int x = 0; x < width; x++)
- {
- unsigned short rgba = source565[x];
- destB[4 * x + 0] = ((rgba & 0x001F) << 3) | ((rgba & 0x001F) >> 2);
- destB[4 * x + 1] = ((rgba & 0x07E0) >> 3) | ((rgba & 0x07E0) >> 9);
- destB[4 * x + 2] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
- destB[4 * x + 3] = 0xFF;
- }
+ memcpy(dest + xoffset * 2, source, width * 2);
}
template<>
@@ -587,7 +577,7 @@
}
else if(type == GL_UNSIGNED_SHORT_5_6_5)
{
- return sw::FORMAT_X8R8G8B8;
+ return sw::FORMAT_R5G6B5;
}
else UNREACHABLE(type);