From 533b810efeb4869b2ffa2f4d01c33894798de1ae Mon Sep 17 00:00:00 2001 From: rogerman Date: Fri, 8 Feb 2013 23:38:10 +0000 Subject: [PATCH] OpenGL Renderer: - Fix polygon coloring bug when converting the framebuffer on big-endian systems. (Disabling textures will show the correct polygon coloring. Endianness bugs remain with texturing enabled.) --- desmume/src/OGLRender.cpp | 12 ++++++------ desmume/src/OGLRender.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/desmume/src/OGLRender.cpp b/desmume/src/OGLRender.cpp index ce63cc59f..f6ebcb7cb 100644 --- a/desmume/src/OGLRender.cpp +++ b/desmume/src/OGLRender.cpp @@ -347,14 +347,14 @@ static const char *fragmentShader_100 = {"\ } \n\ "}; -FORCEINLINE u32 BGRA8888_32_To_RGBA6665_32Rev(const u32 srcPix) +FORCEINLINE u32 BGRA8888_32_To_RGBA6665_32(const u32 srcPix) { const u32 dstPix = (srcPix >> 2) & 0x3F3F3F3F; - return (dstPix & 0x0000FF00) >> 8 | // R - (dstPix & 0x00FF0000) >> 8 | // G - (dstPix & 0xFF000000) >> 8 | // B - ((dstPix >> 1) & 0x000000FF) << 24; // A + return (dstPix & 0x0000FF00) << 16 | // R + (dstPix & 0x00FF0000) | // G + (dstPix & 0xFF000000) >> 16 | // B + ((dstPix >> 1) & 0x000000FF); // A } FORCEINLINE u32 BGRA8888_32Rev_To_RGBA6665_32Rev(const u32 srcPix) @@ -819,7 +819,7 @@ void OpenGLRenderer::ConvertFramebuffer(const u32 *__restrict srcBuffer, u32 *ds // Use the correct endian format since OpenGL uses the native endian of // the architecture it is running on. #ifdef WORDS_BIGENDIAN - *dst++ = BGRA8888_32_To_RGBA6665_32Rev(srcBuffer[i]); + *dst++ = BGRA8888_32_To_RGBA6665_32(srcBuffer[i]); #else *dst++ = BGRA8888_32Rev_To_RGBA6665_32Rev(srcBuffer[i]); #endif diff --git a/desmume/src/OGLRender.h b/desmume/src/OGLRender.h index b372db78e..546ce3faf 100644 --- a/desmume/src/OGLRender.h +++ b/desmume/src/OGLRender.h @@ -388,7 +388,7 @@ extern CACHE_ALIGN GLfloat material_8bit_to_float[256]; extern CACHE_ALIGN GLuint dsDepthToD24S8_LUT[32768]; extern const GLfloat divide5bitBy31_LUT[32]; -FORCEINLINE u32 BGRA8888_32_To_RGBA6665_32Rev(const u32 srcPix); +FORCEINLINE u32 BGRA8888_32_To_RGBA6665_32(const u32 srcPix); FORCEINLINE u32 BGRA8888_32Rev_To_RGBA6665_32Rev(const u32 srcPix); bool IsVersionSupported(unsigned int checkVersionMajor, unsigned int checkVersionMinor, unsigned int checkVersionRevision);