From f02f226712a61f322e6f233007f7bd2a98f6caf1 Mon Sep 17 00:00:00 2001 From: cutealien Date: Sun, 18 Feb 2018 16:03:52 +0000 Subject: [PATCH] Fix wrong colors on big endian platforms with burnings renders. Thx @kas1e for reporting and @curaga for the patch (#318). Note: this patch just removes some old #ifdef __BIG_ENDIAN__ code, so it's slightly suspicious. But it does fix the wrong color problems on big-endian platforms. See http://irrlicht.sourceforge.net/forum/viewtopic.php?f=7&t=52177 for the discusssion. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5602 dfc29bdd-3216-0410-991c-e03cc46cb475 --- changes.txt | 1 + source/Irrlicht/SoftwareDriver2_helper.h | 15 --------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/changes.txt b/changes.txt index bda496d1..5a84eb6a 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,6 @@ -------------------------- Changes in 1.9 (not yet released) +- Fix wrong colors on big endian platforms with burnings renders. Thx @kas1e for reporting and @curaga for the patch (#318). Forum bug discussion at http://irrlicht.sourceforge.net/forum/viewtopic.php?f=7&t=52177. - Fix bug #440 where OpenGL driver enabled second texture for single-texture materials when setMaterial was called twice. Thx@ "number Zero" for bugreport and test-case. - Irrlicht icon now loaded with LR_DEFAULTSIZE to better support larger icon requests. Thx@ luthyr for report and bugfix. - Cursor on X11 behaves now like on Win32 and doesn't try to clip positions to the window diff --git a/source/Irrlicht/SoftwareDriver2_helper.h b/source/Irrlicht/SoftwareDriver2_helper.h index f8a18f55..7a300da3 100644 --- a/source/Irrlicht/SoftwareDriver2_helper.h +++ b/source/Irrlicht/SoftwareDriver2_helper.h @@ -646,17 +646,10 @@ inline s32 f32_to_23Bits(const f32 x) */ REALINLINE tVideoSample fix_to_color ( const tFixPoint r, const tFixPoint g, const tFixPoint b ) { -#ifdef __BIG_ENDIAN__ - return FIXPOINT_COLOR_MAX | - ( r & FIXPOINT_COLOR_MAX) >> ( FIX_POINT_PRE - 8) | - ( g & FIXPOINT_COLOR_MAX) << ( 16 - FIX_POINT_PRE ) | - ( b & FIXPOINT_COLOR_MAX) << ( 24 - FIX_POINT_PRE ); -#else return ( FIXPOINT_COLOR_MAX & FIXPOINT_COLOR_MAX) << ( SHIFT_A - FIX_POINT_PRE ) | ( r & FIXPOINT_COLOR_MAX) << ( SHIFT_R - FIX_POINT_PRE ) | ( g & FIXPOINT_COLOR_MAX) >> ( FIX_POINT_PRE - SHIFT_G ) | ( b & FIXPOINT_COLOR_MAX) >> ( FIX_POINT_PRE - SHIFT_B ); -#endif } @@ -665,18 +658,10 @@ REALINLINE tVideoSample fix_to_color ( const tFixPoint r, const tFixPoint g, con */ REALINLINE tVideoSample fix4_to_color ( const tFixPoint a, const tFixPoint r, const tFixPoint g, const tFixPoint b ) { -#ifdef __BIG_ENDIAN__ - return ( a & (FIX_POINT_FRACT_MASK - 1 )) >> ( FIX_POINT_PRE ) | - ( r & FIXPOINT_COLOR_MAX) >> ( FIX_POINT_PRE - 8) | - ( g & FIXPOINT_COLOR_MAX) << ( 16 - FIX_POINT_PRE ) | - ( b & FIXPOINT_COLOR_MAX) << ( 24 - FIX_POINT_PRE ); -#else return ( a & (FIX_POINT_FRACT_MASK - 1 )) << ( SHIFT_A - 1 ) | ( r & FIXPOINT_COLOR_MAX) << ( SHIFT_R - FIX_POINT_PRE ) | ( g & FIXPOINT_COLOR_MAX) >> ( FIX_POINT_PRE - SHIFT_G ) | ( b & FIXPOINT_COLOR_MAX) >> ( FIX_POINT_PRE - SHIFT_B ); -#endif - } /*!