Fix some graphical bugs on big-endian systems. (Regressions from commits f8d129b
and f97283e.)
This commit is contained in:
parent
f377bfeb76
commit
4e1bdab8c7
|
@ -792,7 +792,7 @@ enum GPUEngineID
|
||||||
#define ADDRESS_STEP_512KB 0x80000
|
#define ADDRESS_STEP_512KB 0x80000
|
||||||
#define ADDRESS_MASK_256KB (ADDRESS_STEP_256KB-1)
|
#define ADDRESS_MASK_256KB (ADDRESS_STEP_256KB-1)
|
||||||
|
|
||||||
#ifdef LOCAL_BE
|
#ifdef MSB_FIRST
|
||||||
struct _TILEENTRY
|
struct _TILEENTRY
|
||||||
{
|
{
|
||||||
/*14*/ unsigned Palette:4;
|
/*14*/ unsigned Palette:4;
|
||||||
|
@ -823,7 +823,7 @@ typedef union
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct _COLOR { // abgr x555
|
struct _COLOR { // abgr x555
|
||||||
#ifdef LOCAL_BE
|
#ifdef MSB_FIRST
|
||||||
unsigned alpha:1; // sometimes it is unused (pad)
|
unsigned alpha:1; // sometimes it is unused (pad)
|
||||||
unsigned blue:5;
|
unsigned blue:5;
|
||||||
unsigned green:5;
|
unsigned green:5;
|
||||||
|
|
|
@ -36,6 +36,12 @@
|
||||||
#include "./utils/colorspacehandler/colorspacehandler_SSE2.h"
|
#include "./utils/colorspacehandler/colorspacehandler_SSE2.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MSB_FIRST
|
||||||
|
#define GL_TEXTURE_SRC_FORMAT GL_UNSIGNED_INT_8_8_8_8
|
||||||
|
#else
|
||||||
|
#define GL_TEXTURE_SRC_FORMAT GL_UNSIGNED_INT_8_8_8_8_REV
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
unsigned int major;
|
unsigned int major;
|
||||||
|
@ -758,11 +764,11 @@ void OpenGLTexture::Load(bool isNewTexture)
|
||||||
|
|
||||||
if (isNewTexture)
|
if (isNewTexture)
|
||||||
{
|
{
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this->_sizeS, this->_sizeT, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, textureSrc);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this->_sizeS, this->_sizeT, 0, GL_RGBA, GL_TEXTURE_SRC_FORMAT, textureSrc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, this->_sizeS, this->_sizeT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, textureSrc);
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, this->_sizeS, this->_sizeT, GL_RGBA, GL_TEXTURE_SRC_FORMAT, textureSrc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -776,13 +782,13 @@ void OpenGLTexture::Load(bool isNewTexture)
|
||||||
|
|
||||||
if (isNewTexture)
|
if (isNewTexture)
|
||||||
{
|
{
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this->_sizeS*2, this->_sizeT*2, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, this->_upscaleBuffer);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this->_sizeS*2, this->_sizeT*2, 0, GL_RGBA, GL_TEXTURE_SRC_FORMAT, this->_upscaleBuffer);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, this->_sizeS*1, this->_sizeT*1, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, textureSrc);
|
glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, this->_sizeS*1, this->_sizeT*1, 0, GL_RGBA, GL_TEXTURE_SRC_FORMAT, textureSrc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, this->_sizeS*2, this->_sizeT*2, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, this->_upscaleBuffer);
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, this->_sizeS*2, this->_sizeT*2, GL_RGBA, GL_TEXTURE_SRC_FORMAT, this->_upscaleBuffer);
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 1, 0, 0, this->_sizeS*1, this->_sizeT*1, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, textureSrc);
|
glTexSubImage2D(GL_TEXTURE_2D, 1, 0, 0, this->_sizeS*1, this->_sizeT*1, GL_RGBA, GL_TEXTURE_SRC_FORMAT, textureSrc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -796,21 +802,21 @@ void OpenGLTexture::Load(bool isNewTexture)
|
||||||
|
|
||||||
if (isNewTexture)
|
if (isNewTexture)
|
||||||
{
|
{
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this->_sizeS*4, this->_sizeT*4, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, this->_upscaleBuffer);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this->_sizeS*4, this->_sizeT*4, 0, GL_RGBA, GL_TEXTURE_SRC_FORMAT, this->_upscaleBuffer);
|
||||||
|
|
||||||
this->_Upscale<2>(textureSrc, this->_upscaleBuffer);
|
this->_Upscale<2>(textureSrc, this->_upscaleBuffer);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, this->_sizeS*2, this->_sizeT*2, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, this->_upscaleBuffer);
|
glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, this->_sizeS*2, this->_sizeT*2, 0, GL_RGBA, GL_TEXTURE_SRC_FORMAT, this->_upscaleBuffer);
|
||||||
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 2, GL_RGBA, this->_sizeS*1, this->_sizeT*1, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, textureSrc);
|
glTexImage2D(GL_TEXTURE_2D, 2, GL_RGBA, this->_sizeS*1, this->_sizeT*1, 0, GL_RGBA, GL_TEXTURE_SRC_FORMAT, textureSrc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, this->_sizeS*4, this->_sizeT*4, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, this->_upscaleBuffer);
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, this->_sizeS*4, this->_sizeT*4, GL_RGBA, GL_TEXTURE_SRC_FORMAT, this->_upscaleBuffer);
|
||||||
|
|
||||||
this->_Upscale<2>(textureSrc, this->_upscaleBuffer);
|
this->_Upscale<2>(textureSrc, this->_upscaleBuffer);
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 1, 0, 0, this->_sizeS*2, this->_sizeT*2, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, this->_upscaleBuffer);
|
glTexSubImage2D(GL_TEXTURE_2D, 1, 0, 0, this->_sizeS*2, this->_sizeT*2, GL_RGBA, GL_TEXTURE_SRC_FORMAT, this->_upscaleBuffer);
|
||||||
|
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 2, 0, 0, this->_sizeS*1, this->_sizeT*1, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, textureSrc);
|
glTexSubImage2D(GL_TEXTURE_2D, 2, 0, 0, this->_sizeS*1, this->_sizeT*1, GL_RGBA, GL_TEXTURE_SRC_FORMAT, textureSrc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2011 Roger Manuel
|
Copyright (C) 2011 Roger Manuel
|
||||||
Copyright (C) 2012 DeSmuME team
|
Copyright (C) 2012-2017 DeSmuME team
|
||||||
|
|
||||||
This file is free software: you can redistribute it and/or modify
|
This file is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -32,5 +32,9 @@
|
||||||
#define HAVE_JIT
|
#define HAVE_JIT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__ppc__) || defined(__ppc64__)
|
||||||
|
#define MSB_FIRST 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#define PORT_VERSION "Cocoa"
|
#define PORT_VERSION "Cocoa"
|
||||||
#define PORT_VERSION_OS_X_APP
|
#define PORT_VERSION_OS_X_APP
|
||||||
|
|
|
@ -472,7 +472,7 @@ TextureStore::TextureStore(const u32 texAttributes, const u32 palAttributes)
|
||||||
{
|
{
|
||||||
MemSpan currentPaletteMS = MemSpan_TexPalette(_paletteAddress, _paletteSize, false);
|
MemSpan currentPaletteMS = MemSpan_TexPalette(_paletteAddress, _paletteSize, false);
|
||||||
|
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef MSB_FIRST
|
||||||
currentPaletteMS.dump16(_paletteColorTable);
|
currentPaletteMS.dump16(_paletteColorTable);
|
||||||
#else
|
#else
|
||||||
currentPaletteMS.dump(_paletteColorTable);
|
currentPaletteMS.dump(_paletteColorTable);
|
||||||
|
@ -594,7 +594,7 @@ void TextureStore::SetTexturePalette(const MemSpan &packedPalette)
|
||||||
{
|
{
|
||||||
if (this->_paletteSize > 0)
|
if (this->_paletteSize > 0)
|
||||||
{
|
{
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef MSB_FIRST
|
||||||
packedPalette.dump16(this->_paletteColorTable);
|
packedPalette.dump16(this->_paletteColorTable);
|
||||||
#else
|
#else
|
||||||
packedPalette.dump(this->_paletteColorTable);
|
packedPalette.dump(this->_paletteColorTable);
|
||||||
|
@ -783,7 +783,7 @@ void TextureStore::VRAMCompareAndUpdate()
|
||||||
currentPackedTexIndexMS.dump(this->_workingData + this->_packSize);
|
currentPackedTexIndexMS.dump(this->_workingData + this->_packSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef MSB_FIRST
|
||||||
currentPaletteMS.dump16(this->_workingData + this->_packSize + this->_packIndexSize);
|
currentPaletteMS.dump16(this->_workingData + this->_packSize + this->_packIndexSize);
|
||||||
#else
|
#else
|
||||||
currentPaletteMS.dump(this->_workingData + this->_packSize + this->_packIndexSize);
|
currentPaletteMS.dump(this->_workingData + this->_packSize + this->_packIndexSize);
|
||||||
|
@ -1210,7 +1210,7 @@ void NDSTextureUnpack4x4(const size_t srcSize, const u32 *__restrict srcData, co
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
#ifdef LOCAL_BE
|
#ifdef MSB_FIRST
|
||||||
tmp_col[2] = ( (((tmp_col[0] & 0xFF000000) >> 1)+((tmp_col[1] & 0xFF000000) >> 1)) & 0xFF000000 ) |
|
tmp_col[2] = ( (((tmp_col[0] & 0xFF000000) >> 1)+((tmp_col[1] & 0xFF000000) >> 1)) & 0xFF000000 ) |
|
||||||
( (((tmp_col[0] & 0x00FF0000) + (tmp_col[1] & 0x00FF0000)) >> 1) & 0x00FF0000 ) |
|
( (((tmp_col[0] & 0x00FF0000) + (tmp_col[1] & 0x00FF0000)) >> 1) & 0x00FF0000 ) |
|
||||||
( (((tmp_col[0] & 0x0000FF00) + (tmp_col[1] & 0x0000FF00)) >> 1) & 0x0000FF00 ) |
|
( (((tmp_col[0] & 0x0000FF00) + (tmp_col[1] & 0x0000FF00)) >> 1) & 0x0000FF00 ) |
|
||||||
|
@ -1231,7 +1231,7 @@ void NDSTextureUnpack4x4(const size_t srcSize, const u32 *__restrict srcData, co
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
#ifdef LOCAL_BE
|
#ifdef MSB_FIRST
|
||||||
const u32 r0 = (tmp_col[0]>>24) & 0x000000FF;
|
const u32 r0 = (tmp_col[0]>>24) & 0x000000FF;
|
||||||
const u32 r1 = (tmp_col[1]>>24) & 0x000000FF;
|
const u32 r1 = (tmp_col[1]>>24) & 0x000000FF;
|
||||||
const u32 g0 = (tmp_col[0]>>16) & 0x000000FF;
|
const u32 g0 = (tmp_col[0]>>16) & 0x000000FF;
|
||||||
|
|
Loading…
Reference in New Issue