Render3D:

- In the OpenGL renderer, fix framebuffer color conversions on big-endian systems.
- In SoftRasterizer, fix toon table coloring on big-endian systems.
This commit is contained in:
rogerman 2016-02-18 20:38:48 +00:00
parent 532f78740a
commit 3c710f33dd
3 changed files with 12 additions and 20 deletions

View File

@ -517,22 +517,22 @@ static const char *FramebufferOutputFragShader_100 = {"\
FORCEINLINE u32 BGRA8888_32_To_RGBA6665_32(const u32 srcPix)
{
const u32 dstPix = (srcPix >> 2) & 0x3F3F3F3F;
const u32 dstPix = (srcPix >> 2);
return (dstPix & 0x0000FF00) << 16 | // R
(dstPix & 0x00FF0000) | // G
(dstPix & 0xFF000000) >> 16 | // B
((dstPix >> 1) & 0x000000FF); // A
return (dstPix & 0x00003F00) << 16 | // R
(dstPix & 0x003F0000) | // G
(dstPix & 0x3F000000) >> 16 | // B
((dstPix >> 1) & 0x0000001F); // A
}
FORCEINLINE u32 BGRA8888_32Rev_To_RGBA6665_32Rev(const u32 srcPix)
{
const u32 dstPix = (srcPix >> 2) & 0x3F3F3F3F;
const u32 dstPix = (srcPix >> 2);
return (dstPix & 0x00FF0000) >> 16 | // R
(dstPix & 0x0000FF00) | // G
(dstPix & 0x000000FF) << 16 | // B
((dstPix >> 1) & 0xFF000000); // A
return (dstPix & 0x003F0000) >> 16 | // R
(dstPix & 0x00003F00) | // G
(dstPix & 0x0000003F) << 16 | // B
((dstPix >> 1) & 0x1F000000); // A
}
bool IsVersionSupported(unsigned int checkVersionMajor, unsigned int checkVersionMinor, unsigned int checkVersionRevision)

View File

@ -520,7 +520,7 @@ struct POLY {
#define POLYLIST_SIZE 20000
struct POLYLIST {
POLY list[POLYLIST_SIZE];
int count;
size_t count;
};
//just a vert with a 4 float position
@ -588,7 +588,7 @@ struct VERT {
#define VERTLIST_SIZE (POLYLIST_SIZE * 4)
struct VERTLIST {
VERT list[VERTLIST_SIZE];
int count;
size_t count;
};
#define INDEXLIST_SIZE (POLYLIST_SIZE * 4)

View File

@ -551,7 +551,6 @@ public:
dst.b = modulate_table[mainTexColor.b][toonColor.b];
dst.a = modulate_table[GFX3D_5TO6(mainTexColor.a)][GFX3D_5TO6(src.a)] >> 1;
}
}
break;
@ -1845,14 +1844,7 @@ Render3DError SoftRasterizerRenderer::UpdateToonTable(const u16 *toonTableBuffer
//convert the toon colors
for (size_t i = 0; i < 32; i++)
{
#ifdef WORDS_BIGENDIAN
u32 u32temp = RGB15TO32_NOALPHA(toonTableBuffer[i]);
this->toonColor32LUT[i].r = (u32temp >> 2) & 0x3F;
this->toonColor32LUT[i].g = (u32temp >> 10) & 0x3F;
this->toonColor32LUT[i].b = (u32temp >> 18) & 0x3F;
#else
this->toonColor32LUT[i].color = (RGB15TO32_NOALPHA(toonTableBuffer[i])>>2)&0x3F3F3F3F;
#endif
//printf("%d %d %d %d\n", this->toonColor32LUT[i].r, this->toonColor32LUT[i].g, this->toonColor32LUT[i].b, this->toonColor32LUT[i].a);
}