mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
color vertexloader: make read24 safer, speedup direct 8888 a tiny bit
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2253 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -54,6 +54,40 @@ inline u32 DataReadU32()
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline u32 DataReadU32Unswapped()
|
||||||
|
{
|
||||||
|
u32 tmp = *(u32*)g_pVideoData;
|
||||||
|
g_pVideoData += 4;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// These are not used yet. If they don't build under Linux, delete them and let me know. -ector
|
||||||
|
template<class T>
|
||||||
|
inline T DataRead()
|
||||||
|
{
|
||||||
|
T tmp = *(T*)g_pVideoData;
|
||||||
|
g_pVideoData += sizeof(T);
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
inline u16 DataRead()
|
||||||
|
{
|
||||||
|
u16 tmp = Common::swap16(*(u16*)g_pVideoData);
|
||||||
|
g_pVideoData += 2;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
inline u32 DataRead()
|
||||||
|
{
|
||||||
|
u32 tmp = Common::swap32(*(u32*)g_pVideoData);
|
||||||
|
g_pVideoData += 4;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline float DataReadF32()
|
inline float DataReadF32()
|
||||||
{
|
{
|
||||||
union {u32 i; float f;} temp;
|
union {u32 i; float f;} temp;
|
||||||
|
@ -67,14 +67,14 @@ void _SetCol565(u16 val)
|
|||||||
}
|
}
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
inline u32 _Read24(const u8 *iAddress)
|
inline u32 _Read24(const u8 *addr)
|
||||||
{
|
{
|
||||||
return *(const u32 *)iAddress | 0xFF000000;
|
return addr[0] | (addr[1] << 8) | (addr[2] << 16) | 0xFF000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline u32 _Read32(const u8 *iAddress)
|
inline u32 _Read32(const u8 *addr)
|
||||||
{
|
{
|
||||||
return *(const u32 *)iAddress;
|
return *(const u32 *)addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@ -105,9 +105,9 @@ void LOADERDECL Color_ReadDirect_16b_4444()
|
|||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadDirect_24b_6666()
|
void LOADERDECL Color_ReadDirect_24b_6666()
|
||||||
{
|
{
|
||||||
u32 val = DataReadU8()<<16;
|
u32 val = DataReadU8() << 16;
|
||||||
val|=DataReadU8()<<8;
|
val |= DataReadU8() << 8;
|
||||||
val|=DataReadU8();
|
val |= DataReadU8();
|
||||||
_SetCol6666(val);
|
_SetCol6666(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,10 +121,7 @@ void LOADERDECL Color_ReadDirect_24b_6666()
|
|||||||
void LOADERDECL Color_ReadDirect_32b_8888()
|
void LOADERDECL Color_ReadDirect_32b_8888()
|
||||||
{
|
{
|
||||||
// TODO (mb2): check this
|
// TODO (mb2): check this
|
||||||
u32 col = DataReadU8()<<RSHIFT;
|
u32 col = DataReadU32Unswapped();
|
||||||
col |= DataReadU8()<<GSHIFT;
|
|
||||||
col |= DataReadU8()<<BSHIFT;
|
|
||||||
col |= DataReadU8()<<ASHIFT;
|
|
||||||
|
|
||||||
// "kill" the alpha
|
// "kill" the alpha
|
||||||
if (!colElements[colIndex])
|
if (!colElements[colIndex])
|
||||||
|
@ -305,8 +305,9 @@ void BPWritten(int addr, int changes, int newval)
|
|||||||
VertexManager::Flush();
|
VertexManager::Flush();
|
||||||
((u32*)&bpmem)[addr] = newval;
|
((u32*)&bpmem)[addr] = newval;
|
||||||
if (!Renderer::SetScissorRect()) {
|
if (!Renderer::SetScissorRect()) {
|
||||||
if (addr == BPMEM_SCISSORBR )
|
if (addr == BPMEM_SCISSORBR) {
|
||||||
ERROR_LOG("bad scissor!\n");
|
ERROR_LOG("bad scissor!\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user