Fix 8888 high-quality textures on GLES/arm
GLES doesn't support uint 8888 so bytes must be swapped on little endian architecture.
This commit is contained in:
parent
4fced53e25
commit
cc8569fcf8
|
@ -68,8 +68,16 @@ void palette_update();
|
||||||
|
|
||||||
// Unpack to 32-bit word
|
// Unpack to 32-bit word
|
||||||
|
|
||||||
|
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && defined(GLES)
|
||||||
|
// GLES doesn't have the native ordering 8888 so we need to put bytes in the RGBA memory order.
|
||||||
|
#define ARGB8888( word ) ( ((word >> 0) & 0xFF000000) | (((word >> 16) & 0xFF) << 0) | (((word >> 8) & 0xFF) << 8) | ((word & 0xFF) << 16) )
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#define ARGB8888( word ) ( ((word >> 24) & 0xFF) | (((word >> 16) & 0xFF) << 24) | (((word >> 8) & 0xFF) << 16) | ((word & 0xFF) << 8) )
|
#define ARGB8888( word ) ( ((word >> 24) & 0xFF) | (((word >> 16) & 0xFF) << 24) | (((word >> 8) & 0xFF) << 16) | ((word & 0xFF) << 8) )
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
template<class PixelPacker>
|
template<class PixelPacker>
|
||||||
__forceinline u32 YUV422(s32 Y,s32 Yu,s32 Yv)
|
__forceinline u32 YUV422(s32 Y,s32 Yu,s32 Yv)
|
||||||
{
|
{
|
||||||
|
@ -105,7 +113,11 @@ struct pp_8888
|
||||||
{
|
{
|
||||||
__forceinline static u32 packRGB(u8 R,u8 G,u8 B)
|
__forceinline static u32 packRGB(u8 R,u8 G,u8 B)
|
||||||
{
|
{
|
||||||
return (R << 24) | (G << 16) | (B << 8) | 0xFF;
|
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && defined(GLES)
|
||||||
|
return (R << 0) | (G << 8) | (B << 16);
|
||||||
|
#else
|
||||||
|
return (R << 24) | (G << 16) | (B << 8);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,9 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef GL_UNSIGNED_INT_8_8_8_8
|
||||||
|
#define GL_UNSIGNED_INT_8_8_8_8 0x8035
|
||||||
|
#endif
|
||||||
|
|
||||||
#define glCheck() do { if (unlikely(settings.validate.OpenGlChecks)) { verify(glGetError()==GL_NO_ERROR); } } while(0)
|
#define glCheck() do { if (unlikely(settings.validate.OpenGlChecks)) { verify(glGetError()==GL_NO_ERROR); } } while(0)
|
||||||
#define eglCheck() false
|
#define eglCheck() false
|
||||||
|
|
|
@ -341,8 +341,13 @@ struct TextureCacheData
|
||||||
if (texID) {
|
if (texID) {
|
||||||
//upload to OpenGL !
|
//upload to OpenGL !
|
||||||
glcache.BindTexture(GL_TEXTURE_2D, texID);
|
glcache.BindTexture(GL_TEXTURE_2D, texID);
|
||||||
GLuint comps=textype==GL_UNSIGNED_SHORT_5_6_5?GL_RGB:GL_RGBA;
|
#ifdef GLES
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0,comps , w, h, 0, comps, textype, temp_tex_buffer);
|
GLuint actual_textype = textype == GL_UNSIGNED_INT_8_8_8_8 ? GL_UNSIGNED_BYTE : textype;
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, comps, w, h, 0, comps, actual_textype,
|
||||||
|
temp_tex_buffer);
|
||||||
|
#else
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, comps, w, h, 0, comps, textype, temp_tex_buffer);
|
||||||
|
#endif
|
||||||
if (tcw.MipMapped && settings.rend.UseMipmaps)
|
if (tcw.MipMapped && settings.rend.UseMipmaps)
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
glGenerateMipmap(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue