Render3D:

- Fix some coloring issues on big-endian systems brought about by the recent changes to the colorspace conversion code. (Regression from r5455.)
This commit is contained in:
rogerman 2016-07-04 00:13:36 +00:00
parent 68825ec961
commit b129392683
3 changed files with 13 additions and 13 deletions

View File

@ -719,28 +719,28 @@ void RomIconToRGBA8888(uint32_t *bitmapData)
// Set the RGBA8888 bitmap pixels using our CLUT from earlier.
#ifdef __BIG_ENDIAN__
*bitmapPixPtr = clut[(pixRowColors & 0x0F000000) >> 24];
*bitmapPixPtr = LOCAL_TO_LE_32(clut[(pixRowColors & 0x0F000000) >> 24]);
bitmapPixPtr++;
*bitmapPixPtr = clut[(pixRowColors & 0xF0000000) >> 28];
*bitmapPixPtr = LOCAL_TO_LE_32(clut[(pixRowColors & 0xF0000000) >> 28]);
bitmapPixPtr++;
*bitmapPixPtr = clut[(pixRowColors & 0x000F0000) >> 16];
*bitmapPixPtr = LOCAL_TO_LE_32(clut[(pixRowColors & 0x000F0000) >> 16]);
bitmapPixPtr++;
*bitmapPixPtr = clut[(pixRowColors & 0x00F00000) >> 20];
*bitmapPixPtr = LOCAL_TO_LE_32(clut[(pixRowColors & 0x00F00000) >> 20]);
bitmapPixPtr++;
*bitmapPixPtr = clut[(pixRowColors & 0x00000F00) >> 8];
*bitmapPixPtr = LOCAL_TO_LE_32(clut[(pixRowColors & 0x00000F00) >> 8]);
bitmapPixPtr++;
*bitmapPixPtr = clut[(pixRowColors & 0x0000F000) >> 12];
*bitmapPixPtr = LOCAL_TO_LE_32(clut[(pixRowColors & 0x0000F000) >> 12]);
bitmapPixPtr++;
*bitmapPixPtr = clut[(pixRowColors & 0x0000000F)];
*bitmapPixPtr = LOCAL_TO_LE_32(clut[(pixRowColors & 0x0000000F)]);
bitmapPixPtr++;
*bitmapPixPtr = clut[(pixRowColors & 0x000000F0) >> 4];
*bitmapPixPtr = LOCAL_TO_LE_32(clut[(pixRowColors & 0x000000F0) >> 4]);
#else

View File

@ -1839,8 +1839,7 @@ Render3DError SoftRasterizerRenderer::UpdateToonTable(const u16 *toonTableBuffer
//convert the toon colors
for (size_t i = 0; i < 32; i++)
{
this->toonColor32LUT[i].color = ( COLOR555TO888(toonTableBuffer[i] & 0x7FFF) >> 2 ) & 0x003F3F3F;
//printf("%d %d %d %d\n", this->toonColor32LUT[i].r, this->toonColor32LUT[i].g, this->toonColor32LUT[i].b, this->toonColor32LUT[i].a);
this->toonColor32LUT[i].color = COLOR555TO666(toonTableBuffer[i] & 0x7FFF);
}
return RENDER3DERROR_NOERR;

View File

@ -635,11 +635,12 @@ Render3DError Render3D::ClearFramebuffer(const GFX3D_State &renderState)
{
Render3DError error = RENDER3DERROR_NOERR;
const u32 clearColorSwapped = LE_TO_LOCAL_32(renderState.clearColor);
FragmentColor clearColor6665;
clearColor6665.color = COLOR555TO6665(renderState.clearColor & 0x7FFF, (renderState.clearColor >> 16) & 0x1F);
clearColor6665.color = COLOR555TO6665(clearColorSwapped & 0x7FFF, (clearColorSwapped >> 16) & 0x1F);
FragmentAttributes clearFragment;
clearFragment.opaquePolyID = (renderState.clearColor >> 24) & 0x3F;
clearFragment.opaquePolyID = (clearColorSwapped >> 24) & 0x3F;
//special value for uninitialized translucent polyid. without this, fires in spiderman2 dont display
//I am not sure whether it is right, though. previously this was cleared to 0, as a guess,
//but in spiderman2 some fires with polyid 0 try to render on top of the background
@ -647,7 +648,7 @@ Render3DError Render3D::ClearFramebuffer(const GFX3D_State &renderState)
clearFragment.depth = renderState.clearDepth;
clearFragment.stencil = 0;
clearFragment.isTranslucentPoly = 0;
clearFragment.isFogged = BIT15(renderState.clearColor);
clearFragment.isFogged = BIT15(clearColorSwapped);
if (renderState.enableClearImage)
{