Implement new conversion

This commit is contained in:
Luke Benstead 2019-02-27 20:11:14 +00:00
parent b76dd102f7
commit f6af3ab3fb

View File

@ -532,6 +532,10 @@ static inline void _rgba8888_to_rgba8888(const GLubyte* source, GLubyte* dest) {
dst[3] = source[3];
}
static inline void _rgba8888_to_rgb565(const GLubyte* source, GLubyte* dest) {
*((GLushort*) dest) = ((source[0] & 0b11111000) << 8) | ((source[1] & 0b11111100) << 3) | (source[2] >> 3);
}
static inline void _rgb888_to_rgba8888(const GLubyte* source, GLubyte* dest) {
/* Noop */
GLubyte* dst = (GLubyte*) dest;
@ -592,6 +596,8 @@ static TextureConversionFunc _determineConversion(GLint internalFormat, GLenum f
case GL_RGB: {
if(type == GL_UNSIGNED_BYTE && format == GL_RGB) {
return _rgb888_to_rgb565;
} else if(type == GL_UNSIGNED_BYTE && format == GL_RGBA) {
return _rgba8888_to_rgb565;
} else if(type == GL_BYTE && format == GL_RGB) {
return _rgb888_to_rgb565;
} else if(type == GL_UNSIGNED_BYTE && format == GL_RED) {