mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 16:19:28 +01: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:
parent
232e961b6f
commit
4f471ffeb6
@ -54,6 +54,40 @@ inline u32 DataReadU32()
|
||||
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()
|
||||
{
|
||||
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()
|
||||
{
|
||||
u32 val = DataReadU8()<<16;
|
||||
val|=DataReadU8()<<8;
|
||||
val|=DataReadU8();
|
||||
u32 val = DataReadU8() << 16;
|
||||
val |= DataReadU8() << 8;
|
||||
val |= DataReadU8();
|
||||
_SetCol6666(val);
|
||||
}
|
||||
|
||||
@ -121,10 +121,7 @@ void LOADERDECL Color_ReadDirect_24b_6666()
|
||||
void LOADERDECL Color_ReadDirect_32b_8888()
|
||||
{
|
||||
// TODO (mb2): check this
|
||||
u32 col = DataReadU8()<<RSHIFT;
|
||||
col |= DataReadU8()<<GSHIFT;
|
||||
col |= DataReadU8()<<BSHIFT;
|
||||
col |= DataReadU8()<<ASHIFT;
|
||||
u32 col = DataReadU32Unswapped();
|
||||
|
||||
// "kill" the alpha
|
||||
if (!colElements[colIndex])
|
||||
|
@ -305,8 +305,9 @@ void BPWritten(int addr, int changes, int newval)
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
if (!Renderer::SetScissorRect()) {
|
||||
if (addr == BPMEM_SCISSORBR )
|
||||
if (addr == BPMEM_SCISSORBR) {
|
||||
ERROR_LOG("bad scissor!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user