DataReader migration to faster one: first step.

TODO: doing it for DX9, move DataReader to VideoCommon, remove dirty debug #def if ok

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@729 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
memberTwo.mb2 2008-09-29 17:29:25 +00:00
parent d80178bd89
commit df9eba79b2
13 changed files with 423 additions and 204 deletions

View File

@ -23,9 +23,11 @@
#include "Fifo.h" #include "Fifo.h"
#define FIFO_SIZE (1024*1024) #if defined(DATAREADER_INLINE)
extern u32 g_pVideoData;
#else
FifoReader fifo; FifoReader fifo;
#endif
// STATE_TO_SAVE // STATE_TO_SAVE
static u8 *videoBuffer; static u8 *videoBuffer;
@ -41,7 +43,9 @@ void Fifo_DoState(PointerWrap &p) {
void Fifo_Init() void Fifo_Init()
{ {
videoBuffer = (u8*)AllocateMemoryPages(FIFO_SIZE); videoBuffer = (u8*)AllocateMemoryPages(FIFO_SIZE);
#ifndef DATAREADER_INLINE
fifo.Init(videoBuffer, videoBuffer); //zero length. there is no data yet. fifo.Init(videoBuffer, videoBuffer); //zero length. there is no data yet.
#endif
} }
void Fifo_Shutdown() void Fifo_Shutdown()
@ -49,6 +53,11 @@ void Fifo_Shutdown()
FreeMemoryPages(videoBuffer, FIFO_SIZE); FreeMemoryPages(videoBuffer, FIFO_SIZE);
} }
u32 FAKE_GetFifoStartPtr()
{
return (int)videoBuffer;
}
int FAKE_GetFifoSize() int FAKE_GetFifoSize()
{ {
if (size < readptr) if (size < readptr)
@ -57,6 +66,10 @@ int FAKE_GetFifoSize()
} }
return (size - readptr); return (size - readptr);
} }
int FAKE_GetFifoEndAddr()
{
return (int)(videoBuffer+size);
}
u8 FAKE_PeekFifo8(u32 _uOffset) u8 FAKE_PeekFifo8(u32 _uOffset)
{ {
@ -83,6 +96,11 @@ int FAKE_GetPosition()
return readptr; return readptr;
} }
int FAKE_GetRealPtr()
{
return (int)(videoBuffer+readptr);
}
u16 FAKE_ReadFifo16() u16 FAKE_ReadFifo16()
{ {
u16 val = Common::swap16(*(u16*)(videoBuffer+readptr)); u16 val = Common::swap16(*(u16*)(videoBuffer+readptr));
@ -104,10 +122,16 @@ void FAKE_SkipFifo(u32 skip)
void Video_SendFifoData(u8* _uData) void Video_SendFifoData(u8* _uData)
{ {
// TODO (mb2): unrolled loop faster than memcpy here?
memcpy(videoBuffer + size, _uData, 32); memcpy(videoBuffer + size, _uData, 32);
size += 32; size += 32;
if (size + 32 >= FIFO_SIZE) if (size + 32 >= FIFO_SIZE)
{ {
// TODO (mb2): Better and DataReader inline for DX9
#ifdef DATAREADER_INLINE
if (g_pVideoData) // for DX9 plugin "compatibility"
readptr = g_pVideoData-(u32)videoBuffer;
#endif
if (FAKE_GetFifoSize() > readptr) if (FAKE_GetFifoSize() > readptr)
{ {
PanicAlert("FIFO out of bounds (sz = %i, at %08x)", FAKE_GetFifoSize(), readptr); PanicAlert("FIFO out of bounds (sz = %i, at %08x)", FAKE_GetFifoSize(), readptr);
@ -117,6 +141,10 @@ void Video_SendFifoData(u8* _uData)
// memset(&videoBuffer[FAKE_GetFifoSize()], 0, FIFO_SIZE - FAKE_GetFifoSize()); // memset(&videoBuffer[FAKE_GetFifoSize()], 0, FIFO_SIZE - FAKE_GetFifoSize());
size = FAKE_GetFifoSize(); size = FAKE_GetFifoSize();
readptr = 0; readptr = 0;
#ifdef DATAREADER_INLINE
if (g_pVideoData) // for DX9 plugin "compatibility"
g_pVideoData = FAKE_GetFifoStartPtr();
#endif
} }
OpcodeDecoder_Run(); OpcodeDecoder_Run();
} }

View File

@ -23,6 +23,18 @@
#include "Common.h" #include "Common.h"
#include "ChunkFile.h" #include "ChunkFile.h"
// TODO (mb2) clean this if ok
#define DATAREADER_INLINE // uncomment to use the previous IDataReader way
//#define DATAREADER_DEBUG // simple compare with the previous IDataReader way
#if defined(DATAREADER_DEBUG) && !defined(DATAREADER_INLINE)
#define DATAREADER_INLINE
#endif
#define FIFO_SIZE (1024*1024)
#ifndef DATAREADER_INLINE
// inline for speed! // inline for speed!
class FifoReader class FifoReader
{ {
@ -54,6 +66,7 @@ public:
extern FifoReader fifo; extern FifoReader fifo;
#endif
void Fifo_Init(); void Fifo_Init();
void Fifo_Shutdown(); void Fifo_Shutdown();
void Fifo_EnterLoop(const SVideoInitialize &video_initialize); void Fifo_EnterLoop(const SVideoInitialize &video_initialize);

View File

@ -40,12 +40,17 @@
#include "XFStructs.h" #include "XFStructs.h"
#include "Utils.h" #include "Utils.h"
#include "main.h" #include "main.h"
#include "Fifo.h"
#include "DataReader.h" #include "DataReader.h"
#include "DLCompiler.h" #include "DLCompiler.h"
#define CMDBUFFER_SIZE 1024*1024 #define CMDBUFFER_SIZE 1024*1024
DecodedVArray tempvarray; DecodedVArray tempvarray;
// TODO (mb2): all! DataReader inline for DX9
#ifdef DATAREADER_INLINE
u32 g_pVideoData=0;
#endif
void Decode(); void Decode();
extern u8 FAKE_PeekFifo8(u32 _uOffset); extern u8 FAKE_PeekFifo8(u32 _uOffset);

View File

@ -18,6 +18,7 @@
#include "Globals.h" #include "Globals.h"
#include "DataReader.h" #include "DataReader.h"
#if !defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG)
// ================================================================================================= // =================================================================================================
// CDataReader_Fifo // CDataReader_Fifo
// ================================================================================================= // =================================================================================================
@ -27,6 +28,7 @@ extern u8 FAKE_ReadFifo8();
extern u16 FAKE_ReadFifo16(); extern u16 FAKE_ReadFifo16();
extern u32 FAKE_ReadFifo32(); extern u32 FAKE_ReadFifo32();
extern int FAKE_GetPosition(); extern int FAKE_GetPosition();
extern int FAKE_GetRealPtr();
extern void FAKE_SkipFifo(u32 skip); extern void FAKE_SkipFifo(u32 skip);
IDataReader::~IDataReader() IDataReader::~IDataReader()
@ -61,6 +63,10 @@ int CDataReader_Fifo::GetPosition()
{ {
return FAKE_GetPosition(); return FAKE_GetPosition();
} }
int CDataReader_Fifo::GetRealPtr()
{
return FAKE_GetRealPtr();
}
// ================================================================================================= // =================================================================================================
@ -108,3 +114,9 @@ void CDataReader_Memory::Skip(u32 skip)
{ {
m_uReadAddress += skip; m_uReadAddress += skip;
} }
int CDataReader_Memory::GetRealPtr()
{
return (int)Memory_GetPtr(m_uReadAddress);
}
#endif

View File

@ -18,6 +18,10 @@
#ifndef _DATAREADER_H #ifndef _DATAREADER_H
#define _DATAREADER_H #define _DATAREADER_H
#include "Fifo.h"
#if !defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG)
// ================================================================================================= // =================================================================================================
// IDataReader // IDataReader
// ================================================================================================= // =================================================================================================
@ -34,6 +38,7 @@ public:
virtual u32 Read32() = 0; virtual u32 Read32() = 0;
virtual int GetPosition() = 0; // return values can be anything, as long as relative distances are correct virtual int GetPosition() = 0; // return values can be anything, as long as relative distances are correct
virtual int GetRealPtr() = 0;
}; };
// ================================================================================================= // =================================================================================================
@ -52,6 +57,7 @@ public:
virtual u16 Read16(); virtual u16 Read16();
virtual u32 Read32(); virtual u32 Read32();
virtual int GetPosition(); virtual int GetPosition();
virtual int GetRealPtr();
}; };
// ================================================================================================= // =================================================================================================
@ -76,8 +82,137 @@ public:
virtual u16 Read16(); virtual u16 Read16();
virtual u32 Read32(); virtual u32 Read32();
virtual int GetPosition(); virtual int GetPosition();
virtual int GetRealPtr();
}; };
extern IDataReader* g_pDataReader; extern IDataReader* g_pDataReader;
#endif
#ifdef DATAREADER_INLINE
extern u32 g_pVideoData;
#endif
#ifdef DATAREADER_DEBUG
extern u32 g_pDataReaderRealPtr;
#define DATAREADER_DEBUG_CHECK_PTR g_pDataReaderRealPtr = g_pDataReader->GetRealPtr(); \
if (g_pDataReaderRealPtr!=g_pVideoData) _asm int 3
#define DATAREADER_DEBUG_CHECK_PTR_VAL g_pDataReaderRealPtr = g_pDataReader->GetRealPtr(); \
if ((g_pDataReaderRealPtr != g_pVideoData) || (tmp != tmpdb)) _asm int 3
//#define DATAREADER_DEBUG_CHECK_PTR_VAL DATAREADER_DEBUG_CHECK_PTR
#else
#define DATAREADER_DEBUG_CHECK_PTR
#define DATAREADER_DEBUG_CHECK_PTR_VAL
#endif
#ifdef DATAREADER_INLINE
inline u8 DataPeek8(u32 _uOffset)
{
u8 tmp = *(u8*)(g_pVideoData + _uOffset);
return tmp;
}
inline u16 DataPeek16(u32 _uOffset)
{
u16 tmp = Common::swap16(*(u16*)(g_pVideoData + _uOffset));
return tmp;
}
inline u32 DataPeek32(u32 _uOffset) {
u32 tmp = Common::swap32(*(u32*)(g_pVideoData + _uOffset));
return tmp;
}
inline u8 DataReadU8()
{
u8 tmp = *(u8*)g_pVideoData;
g_pVideoData++;
#ifdef DATAREADER_DEBUG
u8 tmpdb = g_pDataReader->Read8();
DATAREADER_DEBUG_CHECK_PTR_VAL;
#endif
return tmp;
}
inline u16 DataReadU16()
{
u16 tmp = Common::swap16(*(u16*)g_pVideoData);
g_pVideoData+=2;
#ifdef DATAREADER_DEBUG
u16 tmpdb = g_pDataReader->Read16();
DATAREADER_DEBUG_CHECK_PTR_VAL;
#endif
return tmp;
}
inline u32 DataReadU32()
{
u32 tmp = Common::swap32(*(u32*)g_pVideoData);
g_pVideoData+=4;
#ifdef DATAREADER_DEBUG
u32 tmpdb = g_pDataReader->Read32();
DATAREADER_DEBUG_CHECK_PTR_VAL;
#endif
return tmp;
}
inline float DataReadF32()
{
union {u32 i; float f;} temp;
temp.i = Common::swap32(*(u32*)g_pVideoData);
g_pVideoData+=4;
float tmp = temp.f;
#ifdef DATAREADER_DEBUG
//TODO clean up
u32 tmp3 = g_pDataReader->Read32();
float tmpdb = *(float*)(&tmp3);
DATAREADER_DEBUG_CHECK_PTR_VAL;
#endif
return tmp;
}
inline u32 DataGetPosition()
{
#ifdef DATAREADER_DEBUG
DATAREADER_DEBUG_CHECK_PTR;
#endif
return g_pVideoData;
}
inline void DataSkip(u32 skip)
{
g_pVideoData += skip;
#ifdef DATAREADER_DEBUG
g_pDataReader->Skip(skip);
DATAREADER_DEBUG_CHECK_PTR;
#endif
}
#else
inline u8 DataReadU8()
{
u8 tmp = g_pDataReader->Read8();
return tmp;
}
inline u16 DataReadU16()
{
u16 tmp = g_pDataReader->Read16();
return tmp;
}
inline u32 DataReadU32()
{
u32 tmp = g_pDataReader->Read32();
return tmp;
}
inline float DataReadF32()
{
u32 tmp2 = g_pDataReader->Read32();
float tmp = *(float*)(&tmp2);
return tmp;
}
inline void DataSkip(u32 skip)
{
g_pDataReader->Skip(skip);
}
#endif
#endif #endif

View File

@ -32,17 +32,36 @@
#include "TextureMngr.h" #include "TextureMngr.h"
#include "BPStructs.h" #include "BPStructs.h"
#include "Fifo.h"
#include "DataReader.h" #include "DataReader.h"
#define CMDBUFFER_SIZE 1024*1024 #define CMDBUFFER_SIZE 1024*1024
#if ! defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG)
CDataReader_Fifo g_fifoReader;
#endif
#ifdef DATAREADER_DEBUG
u32 g_pDataReaderRealPtr=0;
#endif
#ifdef DATAREADER_INLINE
u32 g_pVideoData=0;
extern bool g_IsFifoRewinded;
#endif
void Decode(); void Decode();
#if !defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG)
extern u8 FAKE_PeekFifo8(u32 _uOffset); extern u8 FAKE_PeekFifo8(u32 _uOffset);
extern u16 FAKE_PeekFifo16(u32 _uOffset); extern u16 FAKE_PeekFifo16(u32 _uOffset);
extern u32 FAKE_PeekFifo32(u32 _uOffset); extern u32 FAKE_PeekFifo32(u32 _uOffset);
extern int FAKE_GetFifoSize(); extern int FAKE_GetFifoSize();
#endif
extern int FAKE_GetFifoEndAddr();
extern u32 FAKE_GetFifoStartPtr();
extern int FAKE_GetRealPtr();
extern void FAKE_SkipFifo(u32 skip);
CDataReader_Fifo g_fifoReader;
template <class T> template <class T>
void Xchg(T& a, T&b) void Xchg(T& a, T&b)
@ -54,19 +73,30 @@ void Xchg(T& a, T&b)
void ExecuteDisplayList(u32 address, u32 size) void ExecuteDisplayList(u32 address, u32 size)
{ {
#if ! defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG)
IDataReader* pOldReader = g_pDataReader; IDataReader* pOldReader = g_pDataReader;
//address &= 0x01FFFFFF; // phys address //address &= 0x01FFFFFF; // phys address
CDataReader_Memory memoryReader(address); CDataReader_Memory memoryReader(address);
g_pDataReader = &memoryReader; g_pDataReader = &memoryReader;
#endif
#ifdef DATAREADER_INLINE
u32 old_pVideoData = g_pVideoData;
const u32 startAddress = (u32)Memory_GetPtr(address);
g_pVideoData = startAddress;
#endif
// temporarily swap dl and non-dl(small "hack" for the stats) // temporarily swap dl and non-dl(small "hack" for the stats)
Xchg(stats.thisFrame.numDLPrims, stats.thisFrame.numPrims); Xchg(stats.thisFrame.numDLPrims, stats.thisFrame.numPrims);
Xchg(stats.thisFrame.numXFLoadsInDL, stats.thisFrame.numXFLoads); Xchg(stats.thisFrame.numXFLoadsInDL, stats.thisFrame.numXFLoads);
Xchg(stats.thisFrame.numCPLoadsInDL, stats.thisFrame.numCPLoads); Xchg(stats.thisFrame.numCPLoadsInDL, stats.thisFrame.numCPLoads);
Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads); Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads);
#ifdef DATAREADER_INLINE
while((g_pVideoData - startAddress) < size)
#else
while((memoryReader.GetReadAddress() - address) < size) while((memoryReader.GetReadAddress() - address) < size)
#endif
{ {
Decode(); Decode();
} }
@ -80,32 +110,37 @@ void ExecuteDisplayList(u32 address, u32 size)
Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads); Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads);
// reset to the old reader // reset to the old reader
#ifdef DATAREADER_INLINE
g_pVideoData = old_pVideoData;
#endif
#if defined(DATAREADER_DEBUG) || !defined(DATAREADER_INLINE)
g_pDataReader = pOldReader; g_pDataReader = pOldReader;
} #endif
inline u8 PeekFifo8(u32 _uOffset)
{
return FAKE_PeekFifo8(_uOffset);
} }
inline u16 PeekFifo16(u32 _uOffset)
{
return FAKE_PeekFifo16(_uOffset);
}
inline u32 PeekFifo32(u32 _uOffset)
{
return FAKE_PeekFifo32(_uOffset);
}
bool FifoCommandRunnable(void) bool FifoCommandRunnable(void)
{ {
#ifndef DATAREADER_INLINE
u32 iBufferSize = FAKE_GetFifoSize(); u32 iBufferSize = FAKE_GetFifoSize();
#else
u32 iBufferSize = FAKE_GetFifoEndAddr()-g_pVideoData;
#ifdef DATAREADER_DEBUG
u32 iBufferSizedb = FAKE_GetFifoSize();
if( iBufferSize != iBufferSizedb) _asm int 3
#endif
#endif
if (iBufferSize == 0) if (iBufferSize == 0)
return false; return false;
u8 Cmd = PeekFifo8(0); #if !defined(DATAREADER_INLINE)
u8 Cmd = FAKE_PeekFifo8(0);
#else
u8 Cmd = DataPeek8(0);
#ifdef DATAREADER_DEBUG
if( Cmd != FAKE_PeekFifo8(0)) _asm int 3
#endif
#endif
u32 iCommandSize = 0; u32 iCommandSize = 0;
switch(Cmd) switch(Cmd)
@ -149,7 +184,14 @@ bool FifoCommandRunnable(void)
if (iBufferSize >= 5) if (iBufferSize >= 5)
{ {
iCommandSize = 1 + 4; iCommandSize = 1 + 4;
u32 Cmd2 = PeekFifo32(1); #if !defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG)
u32 Cmd2 = FAKE_PeekFifo32(1);
#ifdef DATAREADER_DEBUG
if( Cmd2 != DataPeek32(1)) _asm int 3
#endif
#else
u32 Cmd2 = DataPeek32(1);
#endif
int dwTransferSize = ((Cmd2 >> 16) & 15) + 1; int dwTransferSize = ((Cmd2 >> 16) & 15) + 1;
iCommandSize += dwTransferSize * 4; iCommandSize += dwTransferSize * 4;
} }
@ -167,7 +209,14 @@ bool FifoCommandRunnable(void)
if (iBufferSize >= 3) if (iBufferSize >= 3)
{ {
iCommandSize = 1 + 2; iCommandSize = 1 + 2;
u16 numVertices = PeekFifo16(1); #if !defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG)
u16 numVertices = FAKE_PeekFifo16(1);
#ifdef DATAREADER_DEBUG
if( numVertices != DataPeek16(1)) _asm int 3
#endif
#else
u16 numVertices = DataPeek16(1);
#endif
VertexLoader& vtxLoader = g_VertexLoaders[Cmd & GX_VAT_MASK]; VertexLoader& vtxLoader = g_VertexLoaders[Cmd & GX_VAT_MASK];
iCommandSize += numVertices * vtxLoader.ComputeVertexSize(); iCommandSize += numVertices * vtxLoader.ComputeVertexSize();
} }
@ -200,7 +249,7 @@ bool FifoCommandRunnable(void)
void Decode(void) void Decode(void)
{ {
int Cmd = g_pDataReader->Read8(); int Cmd = DataReadU8();
switch(Cmd) switch(Cmd)
{ {
case GX_NOP: case GX_NOP:
@ -208,8 +257,8 @@ void Decode(void)
case GX_LOAD_CP_REG: //0x08 case GX_LOAD_CP_REG: //0x08
{ {
u32 SubCmd = g_pDataReader->Read8(); u32 SubCmd = DataReadU8();
u32 Value = g_pDataReader->Read32(); u32 Value = DataReadU32();
VertexManager::LoadCPReg(SubCmd,Value); VertexManager::LoadCPReg(SubCmd,Value);
INCSTAT(stats.thisFrame.numCPLoads); INCSTAT(stats.thisFrame.numCPLoads);
} }
@ -217,35 +266,35 @@ void Decode(void)
case GX_LOAD_XF_REG: case GX_LOAD_XF_REG:
{ {
u32 Cmd2 = g_pDataReader->Read32(); u32 Cmd2 = DataReadU32();
int dwTransferSize = ((Cmd2>>16)&15) + 1; int dwTransferSize = ((Cmd2>>16)&15) + 1;
u32 dwAddress = Cmd2 & 0xFFFF; u32 dwAddress = Cmd2 & 0xFFFF;
static u32 pData[16]; static u32 pData[16];
for (int i=0; i<dwTransferSize; i++) for (int i=0; i<dwTransferSize; i++)
pData[i] = g_pDataReader->Read32(); pData[i] = DataReadU32();
VertexShaderMngr::LoadXFReg(dwTransferSize,dwAddress,pData); VertexShaderMngr::LoadXFReg(dwTransferSize,dwAddress,pData);
INCSTAT(stats.thisFrame.numXFLoads); INCSTAT(stats.thisFrame.numXFLoads);
} }
break; break;
case GX_LOAD_INDX_A: //used for position matrices case GX_LOAD_INDX_A: //used for position matrices
VertexShaderMngr::LoadIndexedXF(g_pDataReader->Read32(),0xC); VertexShaderMngr::LoadIndexedXF(DataReadU32(),0xC);
break; break;
case GX_LOAD_INDX_B: //used for normal matrices case GX_LOAD_INDX_B: //used for normal matrices
VertexShaderMngr::LoadIndexedXF(g_pDataReader->Read32(),0xD); VertexShaderMngr::LoadIndexedXF(DataReadU32(),0xD);
break; break;
case GX_LOAD_INDX_C: //used for postmatrices case GX_LOAD_INDX_C: //used for postmatrices
VertexShaderMngr::LoadIndexedXF(g_pDataReader->Read32(),0xE); VertexShaderMngr::LoadIndexedXF(DataReadU32(),0xE);
break; break;
case GX_LOAD_INDX_D: //used for lights case GX_LOAD_INDX_D: //used for lights
VertexShaderMngr::LoadIndexedXF(g_pDataReader->Read32(),0xF); VertexShaderMngr::LoadIndexedXF(DataReadU32(),0xF);
break; break;
case GX_CMD_CALL_DL: case GX_CMD_CALL_DL:
{ {
u32 dwAddr = g_pDataReader->Read32(); u32 dwAddr = DataReadU32();
u32 dwCount = g_pDataReader->Read32(); u32 dwCount = DataReadU32();
ExecuteDisplayList(dwAddr, dwCount); ExecuteDisplayList(dwAddr, dwCount);
} }
break; break;
@ -260,7 +309,7 @@ void Decode(void)
case GX_LOAD_BP_REG: //0x61 case GX_LOAD_BP_REG: //0x61
{ {
u32 cmd = g_pDataReader->Read32(); u32 cmd = DataReadU32();
LoadBPReg(cmd); LoadBPReg(cmd);
INCSTAT(stats.thisFrame.numBPLoads); INCSTAT(stats.thisFrame.numBPLoads);
} }
@ -271,7 +320,7 @@ void Decode(void)
if (Cmd&0x80) if (Cmd&0x80)
{ {
// load vertices (use computed vertex size from FifoCommandRunnable above) // load vertices (use computed vertex size from FifoCommandRunnable above)
u16 numVertices = g_pDataReader->Read16(); u16 numVertices = DataReadU16();
if (numVertices > 0) { if (numVertices > 0) {
g_VertexLoaders[Cmd & GX_VAT_MASK].RunVertices((Cmd & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT, numVertices); g_VertexLoaders[Cmd & GX_VAT_MASK].RunVertices((Cmd & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT, numVertices);
} }
@ -291,7 +340,16 @@ void Decode(void)
void OpcodeDecoder_Init() void OpcodeDecoder_Init()
{ {
#if !defined(DATAREADER_INLINE)
g_pDataReader = &g_fifoReader; g_pDataReader = &g_fifoReader;
#else
g_pVideoData = FAKE_GetFifoStartPtr();
#if defined(DATAREADER_DEBUG)
g_pDataReader = &g_fifoReader;
g_pDataReaderRealPtr = g_pDataReader->GetRealPtr();
DATAREADER_DEBUG_CHECK_PTR;
#endif
#endif
} }
@ -302,9 +360,9 @@ void OpcodeDecoder_Shutdown()
void OpcodeDecoder_Run() void OpcodeDecoder_Run()
{ {
DVSTARTPROFILE(); DVSTARTPROFILE();
while (FifoCommandRunnable()) while (FifoCommandRunnable())
{ {
DATAREADER_DEBUG_CHECK_PTR;
Decode(); Decode();
} }
} }

View File

@ -61,34 +61,6 @@ static int colIndex;
#undef inline #undef inline
#define inline #define inline
#endif #endif
inline u8 ReadBuffer8()
{
return g_pDataReader->Read8();
}
inline u16 ReadBuffer16()
{
//PowerPC byte ordering :(
return g_pDataReader->Read16();
}
inline u32 ReadBuffer32()
{
//PowerPC byte ordering :(
return g_pDataReader->Read32();
}
inline float ReadBuffer32F()
{
u32 temp = g_pDataReader->Read32();
return *(float*)(&temp);
}
inline int GetBufferPosition()
{
return g_pDataReader->GetPosition();
}
// ============================================================================== // ==============================================================================
// Direct // Direct
@ -98,7 +70,7 @@ static int s_texmtxwrite = 0, s_texmtxread = 0;
void LOADERDECL PosMtx_ReadDirect_UByte(void* _p) void LOADERDECL PosMtx_ReadDirect_UByte(void* _p)
{ {
s_curposmtx = ReadBuffer8()&0x3f; s_curposmtx = DataReadU8()&0x3f;
PRIM_LOG("posmtx: %d, ", s_curposmtx); PRIM_LOG("posmtx: %d, ", s_curposmtx);
} }
@ -112,7 +84,7 @@ void LOADERDECL PosMtx_Write(void* _p)
void LOADERDECL TexMtx_ReadDirect_UByte(void* _p) void LOADERDECL TexMtx_ReadDirect_UByte(void* _p)
{ {
s_curtexmtx[s_texmtxread] = ReadBuffer8()&0x3f; s_curtexmtx[s_texmtxread] = DataReadU8()&0x3f;
PRIM_LOG("texmtx%d: %d, ", s_texmtxread, s_curtexmtx[s_texmtxread]); PRIM_LOG("texmtx%d: %d, ", s_texmtxread, s_curtexmtx[s_texmtxread]);
s_texmtxread++; s_texmtxread++;
} }
@ -704,9 +676,10 @@ void VertexLoader::RunVertices(int primitive, int count)
if( fnSetupVertexPointers != NULL && fnSetupVertexPointers != (void (*)())(void*)m_compiledCode ) if( fnSetupVertexPointers != NULL && fnSetupVertexPointers != (void (*)())(void*)m_compiledCode )
VertexManager::Flush(); VertexManager::Flush();
if( bpmem.genMode.cullmode == 3 && primitive < 5) { if( bpmem.genMode.cullmode == 3 && primitive < 5)
{
// if cull mode is none, ignore triangles and quads // if cull mode is none, ignore triangles and quads
g_pDataReader->Skip(count*m_VertexSize); DataSkip(count*m_VertexSize);
return; return;
} }

View File

@ -27,6 +27,7 @@
using namespace std; using namespace std;
#include "CPMemory.h" #include "CPMemory.h"
#include "DataReader.h"
#define LOADERDECL __cdecl #define LOADERDECL __cdecl
typedef void (LOADERDECL *TPipelineFunction)(void*); typedef void (LOADERDECL *TPipelineFunction)(void*);
@ -219,11 +220,4 @@ public:
}; };
extern VertexLoader g_VertexLoaders[8]; extern VertexLoader g_VertexLoaders[8];
u8 ReadBuffer8();
u16 ReadBuffer16();
u32 ReadBuffer32();
float ReadBuffer32F();
int GetBufferPosition();
#endif #endif

View File

@ -83,32 +83,32 @@ inline u32 _Read32(u32 iAddress)
void LOADERDECL Color_ReadDirect_24b_888(void* _p) void LOADERDECL Color_ReadDirect_24b_888(void* _p)
{ {
u32 col = ReadBuffer8()<<RSHIFT; u32 col = DataReadU8()<<RSHIFT;
col |= ReadBuffer8()<<GSHIFT; col |= DataReadU8()<<GSHIFT;
col |= ReadBuffer8()<<BSHIFT; col |= DataReadU8()<<BSHIFT;
_SetCol(col | (0xFF<<ASHIFT)); _SetCol(col | (0xFF<<ASHIFT));
} }
void LOADERDECL Color_ReadDirect_32b_888x(void* _p){ void LOADERDECL Color_ReadDirect_32b_888x(void* _p){
u32 col = ReadBuffer8()<<RSHIFT; u32 col = DataReadU8()<<RSHIFT;
col |= ReadBuffer8()<<GSHIFT; col |= DataReadU8()<<GSHIFT;
col |= ReadBuffer8()<<BSHIFT; col |= DataReadU8()<<BSHIFT;
_SetCol(col | (0xFF<<ASHIFT)); _SetCol(col | (0xFF<<ASHIFT));
ReadBuffer8(); DataReadU8();
} }
void LOADERDECL Color_ReadDirect_16b_565(void* _p) void LOADERDECL Color_ReadDirect_16b_565(void* _p)
{ {
_SetCol565(ReadBuffer16()); _SetCol565(DataReadU16());
} }
void LOADERDECL Color_ReadDirect_16b_4444(void *_p) void LOADERDECL Color_ReadDirect_16b_4444(void *_p)
{ {
_SetCol4444(ReadBuffer16()); _SetCol4444(DataReadU16());
} }
void LOADERDECL Color_ReadDirect_24b_6666(void* _p) void LOADERDECL Color_ReadDirect_24b_6666(void* _p)
{ {
u32 val = ReadBuffer8()<<16; u32 val = DataReadU8()<<16;
val|=ReadBuffer8()<<8; val|=DataReadU8()<<8;
val|=ReadBuffer8(); val|=DataReadU8();
_SetCol6666(val); _SetCol6666(val);
} }
@ -121,10 +121,11 @@ void LOADERDECL Color_ReadDirect_24b_6666(void* _p)
// //
void LOADERDECL Color_ReadDirect_32b_8888(void* _p) void LOADERDECL Color_ReadDirect_32b_8888(void* _p)
{ {
u32 col = ReadBuffer8()<<RSHIFT; // TODO (mb2): check this
col |= ReadBuffer8()<<GSHIFT; u32 col = DataReadU8()<<RSHIFT;
col |= ReadBuffer8()<<BSHIFT; col |= DataReadU8()<<GSHIFT;
col |= ReadBuffer8()<<ASHIFT; col |= DataReadU8()<<BSHIFT;
col |= DataReadU8()<<ASHIFT;
// "kill" the alpha // "kill" the alpha
if (!colElements[colIndex]) if (!colElements[colIndex])
@ -137,33 +138,33 @@ void LOADERDECL Color_ReadDirect_32b_8888(void* _p)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
void LOADERDECL Color_ReadIndex8_16b_565(void* _p) void LOADERDECL Color_ReadIndex8_16b_565(void* _p)
{ {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]); u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u16 val = Memory_Read_U16(iAddress); u16 val = Memory_Read_U16(iAddress);
_SetCol565(val); _SetCol565(val);
} }
void LOADERDECL Color_ReadIndex8_24b_888(void* _p) void LOADERDECL Color_ReadIndex8_24b_888(void* _p)
{ {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]); u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
_SetCol(_Read24(iAddress)); _SetCol(_Read24(iAddress));
} }
void LOADERDECL Color_ReadIndex8_32b_888x(void* _p) void LOADERDECL Color_ReadIndex8_32b_888x(void* _p)
{ {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR]+colIndex); u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR]+colIndex);
_SetCol(_Read24(iAddress)); _SetCol(_Read24(iAddress));
} }
void LOADERDECL Color_ReadIndex8_16b_4444(void* _p) void LOADERDECL Color_ReadIndex8_16b_4444(void* _p)
{ {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]); u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u16 val = Memory_Read_U16(iAddress); u16 val = Memory_Read_U16(iAddress);
_SetCol4444(val); _SetCol4444(val);
} }
void LOADERDECL Color_ReadIndex8_24b_6666(void* _p) void LOADERDECL Color_ReadIndex8_24b_6666(void* _p)
{ {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]); u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u32 val = Memory_Read_U8(iAddress+2) | u32 val = Memory_Read_U8(iAddress+2) |
(Memory_Read_U8(iAddress+1)<<8) | (Memory_Read_U8(iAddress+1)<<8) |
@ -173,7 +174,7 @@ void LOADERDECL Color_ReadIndex8_24b_6666(void* _p)
} }
void LOADERDECL Color_ReadIndex8_32b_8888(void* _p) void LOADERDECL Color_ReadIndex8_32b_8888(void* _p)
{ {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]); u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
_SetCol(_Read32(iAddress)); _SetCol(_Read32(iAddress));
} }
@ -182,33 +183,33 @@ void LOADERDECL Color_ReadIndex8_32b_8888(void* _p)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
void LOADERDECL Color_ReadIndex16_16b_565(void* _p) void LOADERDECL Color_ReadIndex16_16b_565(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]); u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u16 val = Memory_Read_U16(iAddress); u16 val = Memory_Read_U16(iAddress);
_SetCol565(val); _SetCol565(val);
} }
void LOADERDECL Color_ReadIndex16_24b_888(void* _p) void LOADERDECL Color_ReadIndex16_24b_888(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]); u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
_SetCol(_Read24(iAddress)); _SetCol(_Read24(iAddress));
} }
void LOADERDECL Color_ReadIndex16_32b_888x(void* _p) void LOADERDECL Color_ReadIndex16_32b_888x(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]); u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
_SetCol(_Read24(iAddress)); _SetCol(_Read24(iAddress));
} }
void LOADERDECL Color_ReadIndex16_16b_4444(void* _p) void LOADERDECL Color_ReadIndex16_16b_4444(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]); u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u16 val = Memory_Read_U16(iAddress); u16 val = Memory_Read_U16(iAddress);
_SetCol4444(val); _SetCol4444(val);
} }
void LOADERDECL Color_ReadIndex16_24b_6666(void* _p) void LOADERDECL Color_ReadIndex16_24b_6666(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]); u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u32 val = Memory_Read_U8(iAddress+2) | u32 val = Memory_Read_U8(iAddress+2) |
(Memory_Read_U8(iAddress+1)<<8) | (Memory_Read_U8(iAddress+1)<<8) |
@ -217,7 +218,7 @@ void LOADERDECL Color_ReadIndex16_24b_6666(void* _p)
} }
void LOADERDECL Color_ReadIndex16_32b_8888(void* _p) void LOADERDECL Color_ReadIndex16_32b_8888(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]); u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
_SetCol(_Read32(iAddress)); _SetCol(_Read32(iAddress));
} }

View File

@ -123,30 +123,30 @@ TPipelineFunction VertexLoader_Normal::GetFunction(unsigned int _type, unsigned
///////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////
void LOADERDECL VertexLoader_Normal::Normal_DirectByte(void* _p) void LOADERDECL VertexLoader_Normal::Normal_DirectByte(void* _p)
{ {
*VertexManager::s_pCurBufferPointer++ = ReadBuffer8(); *VertexManager::s_pCurBufferPointer++ = DataReadU8();
*VertexManager::s_pCurBufferPointer++ = ReadBuffer8(); *VertexManager::s_pCurBufferPointer++ = DataReadU8();
*VertexManager::s_pCurBufferPointer++ = ReadBuffer8(); *VertexManager::s_pCurBufferPointer++ = DataReadU8();
LOG_NORM8(); LOG_NORM8();
// ((float*)VertexManager::s_pCurBufferPointer)[0] = ((float)(signed char)ReadBuffer8()+0.5f) / 127.5f; // ((float*)VertexManager::s_pCurBufferPointer)[0] = ((float)(signed char)DataReadU8()+0.5f) / 127.5f;
} }
void LOADERDECL VertexLoader_Normal::Normal_DirectShort(void* _p) void LOADERDECL VertexLoader_Normal::Normal_DirectShort(void* _p)
{ {
((u16*)VertexManager::s_pCurBufferPointer)[0] = ReadBuffer16(); ((u16*)VertexManager::s_pCurBufferPointer)[0] = DataReadU16();
((u16*)VertexManager::s_pCurBufferPointer)[1] = ReadBuffer16(); ((u16*)VertexManager::s_pCurBufferPointer)[1] = DataReadU16();
((u16*)VertexManager::s_pCurBufferPointer)[2] = ReadBuffer16(); ((u16*)VertexManager::s_pCurBufferPointer)[2] = DataReadU16();
VertexManager::s_pCurBufferPointer += 6; VertexManager::s_pCurBufferPointer += 6;
LOG_NORM16() LOG_NORM16()
// ((float*)VertexManager::s_pCurBufferPointer)[0] = ((float)(signed short)ReadBuffer16()+0.5f) / 32767.5f; // ((float*)VertexManager::s_pCurBufferPointer)[0] = ((float)(signed short)DataReadU16()+0.5f) / 32767.5f;
// ((float*)VertexManager::s_pCurBufferPointer)[1] = ((float)(signed short)ReadBuffer16()+0.5f) / 32767.5f; // ((float*)VertexManager::s_pCurBufferPointer)[1] = ((float)(signed short)DataReadU16()+0.5f) / 32767.5f;
// ((float*)VertexManager::s_pCurBufferPointer)[2] = ((float)(signed short)ReadBuffer16()+0.5f) / 32767.5f; // ((float*)VertexManager::s_pCurBufferPointer)[2] = ((float)(signed short)DataReadU16()+0.5f) / 32767.5f;
} }
void LOADERDECL VertexLoader_Normal::Normal_DirectFloat(void* _p) void LOADERDECL VertexLoader_Normal::Normal_DirectFloat(void* _p)
{ {
((float*)VertexManager::s_pCurBufferPointer)[0] = ReadBuffer32F(); ((float*)VertexManager::s_pCurBufferPointer)[0] = DataReadF32();
((float*)VertexManager::s_pCurBufferPointer)[1] = ReadBuffer32F(); ((float*)VertexManager::s_pCurBufferPointer)[1] = DataReadF32();
((float*)VertexManager::s_pCurBufferPointer)[2] = ReadBuffer32F(); ((float*)VertexManager::s_pCurBufferPointer)[2] = DataReadF32();
VertexManager::s_pCurBufferPointer += 12; VertexManager::s_pCurBufferPointer += 12;
LOG_NORMF() LOG_NORMF()
} }
@ -155,9 +155,9 @@ void LOADERDECL VertexLoader_Normal::Normal_DirectByte3(void* _p)
{ {
for (int i=0; i<3; i++) for (int i=0; i<3; i++)
{ {
*VertexManager::s_pCurBufferPointer++ = ReadBuffer8(); *VertexManager::s_pCurBufferPointer++ = DataReadU8();
*VertexManager::s_pCurBufferPointer++ = ReadBuffer8(); *VertexManager::s_pCurBufferPointer++ = DataReadU8();
*VertexManager::s_pCurBufferPointer++ = ReadBuffer8(); *VertexManager::s_pCurBufferPointer++ = DataReadU8();
LOG_NORM8(); LOG_NORM8();
} }
} }
@ -166,9 +166,9 @@ void LOADERDECL VertexLoader_Normal::Normal_DirectShort3(void* _p)
{ {
for (int i=0; i<3; i++) for (int i=0; i<3; i++)
{ {
((u16*)VertexManager::s_pCurBufferPointer)[0] = ReadBuffer16(); ((u16*)VertexManager::s_pCurBufferPointer)[0] = DataReadU16();
((u16*)VertexManager::s_pCurBufferPointer)[1] = ReadBuffer16(); ((u16*)VertexManager::s_pCurBufferPointer)[1] = DataReadU16();
((u16*)VertexManager::s_pCurBufferPointer)[2] = ReadBuffer16(); ((u16*)VertexManager::s_pCurBufferPointer)[2] = DataReadU16();
VertexManager::s_pCurBufferPointer += 6; VertexManager::s_pCurBufferPointer += 6;
LOG_NORM16(); LOG_NORM16();
} }
@ -178,9 +178,9 @@ void LOADERDECL VertexLoader_Normal::Normal_DirectFloat3(void* _p)
{ {
for (int i=0; i<3; i++) for (int i=0; i<3; i++)
{ {
((float*)VertexManager::s_pCurBufferPointer)[0] = ReadBuffer32F(); ((float*)VertexManager::s_pCurBufferPointer)[0] = DataReadF32();
((float*)VertexManager::s_pCurBufferPointer)[1] = ReadBuffer32F(); ((float*)VertexManager::s_pCurBufferPointer)[1] = DataReadF32();
((float*)VertexManager::s_pCurBufferPointer)[2] = ReadBuffer32F(); ((float*)VertexManager::s_pCurBufferPointer)[2] = DataReadF32();
VertexManager::s_pCurBufferPointer += 12; VertexManager::s_pCurBufferPointer += 12;
LOG_NORMF(); LOG_NORMF();
} }
@ -191,7 +191,7 @@ void LOADERDECL VertexLoader_Normal::Normal_DirectFloat3(void* _p)
///////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////
void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte(void* _p) void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte(void* _p)
{ {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress); *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress);
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1); *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1);
@ -205,7 +205,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte(void* _p)
void LOADERDECL VertexLoader_Normal::Normal_Index8_Short(void* _p) void LOADERDECL VertexLoader_Normal::Normal_Index8_Short(void* _p)
{ {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress); ((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress);
((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2); ((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2);
@ -216,7 +216,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Short(void* _p)
void LOADERDECL VertexLoader_Normal::Normal_Index8_Float(void* _p) void LOADERDECL VertexLoader_Normal::Normal_Index8_Float(void* _p)
{ {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
((float*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_Float(iAddress); ((float*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_Float(iAddress);
((float*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_Float(iAddress+4); ((float*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_Float(iAddress+4);
@ -229,7 +229,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte3(void* _p)
{ {
if (index3) { if (index3) {
for (int i=0; i<3; i++) { for (int i=0; i<3; i++) {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i; u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i;
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress); *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress);
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1); *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1);
@ -238,7 +238,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte3(void* _p)
} }
} }
else { else {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
for (int i=0; i<3; i++) { for (int i=0; i<3; i++) {
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i; u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i;
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress); *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress);
@ -253,7 +253,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Short3(void* _p)
{ {
if (index3) { if (index3) {
for (int i=0; i<3; i++) { for (int i=0; i<3; i++) {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i; u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i;
((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress); ((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress);
((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2); ((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2);
@ -263,7 +263,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Short3(void* _p)
} }
} }
else { else {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
for (int i=0; i<3; i++) { for (int i=0; i<3; i++) {
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i; u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i;
((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress); ((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress);
@ -279,7 +279,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Float3(void* _p)
{ {
if (index3) { if (index3) {
for (int i=0; i<3; i++) { for (int i=0; i<3; i++) {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i; u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i;
((float*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_Float(iAddress); ((float*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_Float(iAddress);
((float*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_Float(iAddress+4); ((float*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_Float(iAddress+4);
@ -289,7 +289,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Float3(void* _p)
} }
} }
else { else {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
for (int i=0; i<3; i++) { for (int i=0; i<3; i++) {
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i; u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i;
((float*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_Float(iAddress); ((float*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_Float(iAddress);
@ -307,7 +307,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Float3(void* _p)
void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte(void* _p) void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress); *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress);
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1); *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1);
@ -317,7 +317,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte(void* _p)
void LOADERDECL VertexLoader_Normal::Normal_Index16_Short(void* _p) void LOADERDECL VertexLoader_Normal::Normal_Index16_Short(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress); ((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress);
((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2); ((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2);
@ -328,7 +328,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Short(void* _p)
void LOADERDECL VertexLoader_Normal::Normal_Index16_Float(void* _p) void LOADERDECL VertexLoader_Normal::Normal_Index16_Float(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
((float*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_Float(iAddress); ((float*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_Float(iAddress);
((float*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_Float(iAddress+4); ((float*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_Float(iAddress+4);
@ -341,7 +341,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte3(void* _p)
{ {
if (index3) { if (index3) {
for (int i=0; i<3; i++) { for (int i=0; i<3; i++) {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i; u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i;
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress); *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress);
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1); *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1);
@ -350,7 +350,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte3(void* _p)
} }
} }
else { else {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
for (int i=0; i<3; i++) { for (int i=0; i<3; i++) {
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i; u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i;
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress); *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress);
@ -367,7 +367,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Short3(void* _p)
{ {
for (int i=0; i<3; i++) for (int i=0; i<3; i++)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i; u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i;
((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress); ((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress);
((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2); ((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2);
@ -378,7 +378,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Short3(void* _p)
} }
else else
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
for (int i=0; i<3; i++) for (int i=0; i<3; i++)
{ {
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i; u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i;
@ -397,7 +397,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Float3(void* _p)
{ {
for (int i=0; i<3; i++) for (int i=0; i<3; i++)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i; u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i;
((float*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_Float(iAddress); ((float*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_Float(iAddress);
((float*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_Float(iAddress+4); ((float*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_Float(iAddress+4);
@ -408,7 +408,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Float3(void* _p)
} }
else else
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
for (int i=0; i<3; i++) for (int i=0; i<3; i++)
{ {
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i; u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i;

View File

@ -26,10 +26,10 @@
void LOADERDECL Pos_ReadDirect_UByte(void* _p) void LOADERDECL Pos_ReadDirect_UByte(void* _p)
{ {
TVtxAttr* pVtxAttr = (TVtxAttr*)_p; TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)ReadBuffer8() * posScale; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU8() * posScale;
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)ReadBuffer8() * posScale; ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)DataReadU8() * posScale;
if (pVtxAttr->PosElements) if (pVtxAttr->PosElements)
((float*)VertexManager::s_pCurBufferPointer)[2] = (float)ReadBuffer8() * posScale; ((float*)VertexManager::s_pCurBufferPointer)[2] = (float)DataReadU8() * posScale;
else else
((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f; ((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f;
LOG_VTX(); LOG_VTX();
@ -39,10 +39,10 @@ void LOADERDECL Pos_ReadDirect_UByte(void* _p)
void LOADERDECL Pos_ReadDirect_Byte(void* _p) void LOADERDECL Pos_ReadDirect_Byte(void* _p)
{ {
TVtxAttr* pVtxAttr = (TVtxAttr*)_p; TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)ReadBuffer8() * posScale; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)DataReadU8() * posScale;
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)ReadBuffer8() * posScale; ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)DataReadU8() * posScale;
if (pVtxAttr->PosElements) if (pVtxAttr->PosElements)
((float*)VertexManager::s_pCurBufferPointer)[2] = (float)(s8)ReadBuffer8() * posScale; ((float*)VertexManager::s_pCurBufferPointer)[2] = (float)(s8)DataReadU8() * posScale;
else else
((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0; ((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0;
LOG_VTX(); LOG_VTX();
@ -52,10 +52,10 @@ void LOADERDECL Pos_ReadDirect_Byte(void* _p)
void LOADERDECL Pos_ReadDirect_UShort(void* _p) void LOADERDECL Pos_ReadDirect_UShort(void* _p)
{ {
TVtxAttr* pVtxAttr = (TVtxAttr*)_p; TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)ReadBuffer16() * posScale; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU16() * posScale;
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)ReadBuffer16() * posScale; ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)DataReadU16() * posScale;
if (pVtxAttr->PosElements) if (pVtxAttr->PosElements)
((float*)VertexManager::s_pCurBufferPointer)[2] = (float)ReadBuffer16() * posScale; ((float*)VertexManager::s_pCurBufferPointer)[2] = (float)DataReadU16() * posScale;
else else
((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f; ((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f;
LOG_VTX(); LOG_VTX();
@ -65,10 +65,10 @@ void LOADERDECL Pos_ReadDirect_UShort(void* _p)
void LOADERDECL Pos_ReadDirect_Short(void* _p) void LOADERDECL Pos_ReadDirect_Short(void* _p)
{ {
TVtxAttr* pVtxAttr = (TVtxAttr*)_p; TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)ReadBuffer16() * posScale; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)DataReadU16() * posScale;
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)ReadBuffer16() * posScale; ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)DataReadU16() * posScale;
if (pVtxAttr->PosElements) if (pVtxAttr->PosElements)
((float*)VertexManager::s_pCurBufferPointer)[2] = (float)(s16)ReadBuffer16() * posScale; ((float*)VertexManager::s_pCurBufferPointer)[2] = (float)(s16)DataReadU16() * posScale;
else else
((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f; ((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f;
LOG_VTX(); LOG_VTX();
@ -78,10 +78,10 @@ void LOADERDECL Pos_ReadDirect_Short(void* _p)
void LOADERDECL Pos_ReadDirect_Float(void* _p) void LOADERDECL Pos_ReadDirect_Float(void* _p)
{ {
TVtxAttr* pVtxAttr = (TVtxAttr*)_p; TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
((float*)VertexManager::s_pCurBufferPointer)[0] = ReadBuffer32F(); ((float*)VertexManager::s_pCurBufferPointer)[0] = DataReadF32();
((float*)VertexManager::s_pCurBufferPointer)[1] = ReadBuffer32F(); ((float*)VertexManager::s_pCurBufferPointer)[1] = DataReadF32();
if (pVtxAttr->PosElements) if (pVtxAttr->PosElements)
((float*)VertexManager::s_pCurBufferPointer)[2] = ReadBuffer32F(); ((float*)VertexManager::s_pCurBufferPointer)[2] = DataReadF32();
else else
((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f; ((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f;
LOG_VTX(); LOG_VTX();
@ -130,35 +130,35 @@ void LOADERDECL Pos_ReadDirect_Float(void* _p)
void LOADERDECL Pos_ReadIndex8_UByte(void* _p) void LOADERDECL Pos_ReadIndex8_UByte(void* _p)
{ {
TVtxAttr* pVtxAttr = (TVtxAttr*)_p; TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
Pos_ReadIndex_Byte(u8); Pos_ReadIndex_Byte(u8);
} }
void LOADERDECL Pos_ReadIndex8_Byte(void* _p) void LOADERDECL Pos_ReadIndex8_Byte(void* _p)
{ {
TVtxAttr* pVtxAttr = (TVtxAttr*)_p; TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
Pos_ReadIndex_Byte(s8); Pos_ReadIndex_Byte(s8);
} }
void LOADERDECL Pos_ReadIndex8_UShort(void* _p) void LOADERDECL Pos_ReadIndex8_UShort(void* _p)
{ {
TVtxAttr* pVtxAttr = (TVtxAttr*)_p; TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
Pos_ReadIndex_Short(u16); Pos_ReadIndex_Short(u16);
} }
void LOADERDECL Pos_ReadIndex8_Short(void* _p) void LOADERDECL Pos_ReadIndex8_Short(void* _p)
{ {
TVtxAttr* pVtxAttr = (TVtxAttr*)_p; TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
Pos_ReadIndex_Short(s16); Pos_ReadIndex_Short(s16);
} }
void LOADERDECL Pos_ReadIndex8_Float(void* _p) void LOADERDECL Pos_ReadIndex8_Float(void* _p)
{ {
TVtxAttr* pVtxAttr = (TVtxAttr*)_p; TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
Pos_ReadIndex_Float(); Pos_ReadIndex_Float();
} }
@ -168,33 +168,33 @@ void LOADERDECL Pos_ReadIndex8_Float(void* _p)
void LOADERDECL Pos_ReadIndex16_UByte(void* _p){ void LOADERDECL Pos_ReadIndex16_UByte(void* _p){
TVtxAttr* pVtxAttr = (TVtxAttr*)_p; TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
Pos_ReadIndex_Byte(u8); Pos_ReadIndex_Byte(u8);
} }
void LOADERDECL Pos_ReadIndex16_Byte(void* _p){ void LOADERDECL Pos_ReadIndex16_Byte(void* _p){
TVtxAttr* pVtxAttr = (TVtxAttr*)_p; TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
Pos_ReadIndex_Byte(s8); Pos_ReadIndex_Byte(s8);
} }
void LOADERDECL Pos_ReadIndex16_UShort(void* _p){ void LOADERDECL Pos_ReadIndex16_UShort(void* _p){
TVtxAttr* pVtxAttr = (TVtxAttr*)_p; TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
Pos_ReadIndex_Short(u16); Pos_ReadIndex_Short(u16);
} }
void LOADERDECL Pos_ReadIndex16_Short(void* _p) void LOADERDECL Pos_ReadIndex16_Short(void* _p)
{ {
TVtxAttr* pVtxAttr = (TVtxAttr*)_p; TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
Pos_ReadIndex_Short(s16); Pos_ReadIndex_Short(s16);
} }
void LOADERDECL Pos_ReadIndex16_Float(void* _p) void LOADERDECL Pos_ReadIndex16_Float(void* _p)
{ {
TVtxAttr* pVtxAttr = (TVtxAttr*)_p; TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
Pos_ReadIndex_Float(); Pos_ReadIndex_Float();
} }

View File

@ -30,15 +30,15 @@ void LOADERDECL TexCoord_Read_Dummy(void* _p)
void LOADERDECL TexCoord_ReadDirect_UByte1(void* _p) void LOADERDECL TexCoord_ReadDirect_UByte1(void* _p)
{ {
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)ReadBuffer8() * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU8() * tcScaleU[tcIndex];
LOG_TEX1(); LOG_TEX1();
VertexManager::s_pCurBufferPointer += 4; VertexManager::s_pCurBufferPointer += 4;
tcIndex++; tcIndex++;
} }
void LOADERDECL TexCoord_ReadDirect_UByte2(void* _p) void LOADERDECL TexCoord_ReadDirect_UByte2(void* _p)
{ {
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)ReadBuffer8() * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU8() * tcScaleU[tcIndex];
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)ReadBuffer8() * tcScaleV[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)DataReadU8() * tcScaleV[tcIndex];
LOG_TEX2(); LOG_TEX2();
VertexManager::s_pCurBufferPointer += 8; VertexManager::s_pCurBufferPointer += 8;
tcIndex++; tcIndex++;
@ -46,15 +46,15 @@ void LOADERDECL TexCoord_ReadDirect_UByte2(void* _p)
void LOADERDECL TexCoord_ReadDirect_Byte1(void* _p) void LOADERDECL TexCoord_ReadDirect_Byte1(void* _p)
{ {
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)ReadBuffer8() * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)DataReadU8() * tcScaleU[tcIndex];
LOG_TEX1(); LOG_TEX1();
VertexManager::s_pCurBufferPointer += 4; VertexManager::s_pCurBufferPointer += 4;
tcIndex++; tcIndex++;
} }
void LOADERDECL TexCoord_ReadDirect_Byte2(void* _p) void LOADERDECL TexCoord_ReadDirect_Byte2(void* _p)
{ {
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)ReadBuffer8() * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)DataReadU8() * tcScaleU[tcIndex];
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)ReadBuffer8() * tcScaleV[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)DataReadU8() * tcScaleV[tcIndex];
LOG_TEX2(); LOG_TEX2();
VertexManager::s_pCurBufferPointer += 8; VertexManager::s_pCurBufferPointer += 8;
tcIndex++; tcIndex++;
@ -62,15 +62,15 @@ void LOADERDECL TexCoord_ReadDirect_Byte2(void* _p)
void LOADERDECL TexCoord_ReadDirect_UShort1(void* _p) void LOADERDECL TexCoord_ReadDirect_UShort1(void* _p)
{ {
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)ReadBuffer16() * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU16() * tcScaleU[tcIndex];
LOG_TEX1(); LOG_TEX1();
VertexManager::s_pCurBufferPointer += 4; VertexManager::s_pCurBufferPointer += 4;
tcIndex++; tcIndex++;
} }
void LOADERDECL TexCoord_ReadDirect_UShort2(void* _p) void LOADERDECL TexCoord_ReadDirect_UShort2(void* _p)
{ {
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)ReadBuffer16() * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU16() * tcScaleU[tcIndex];
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)ReadBuffer16() * tcScaleV[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)DataReadU16() * tcScaleV[tcIndex];
LOG_TEX2(); LOG_TEX2();
VertexManager::s_pCurBufferPointer += 8; VertexManager::s_pCurBufferPointer += 8;
tcIndex++; tcIndex++;
@ -78,15 +78,15 @@ void LOADERDECL TexCoord_ReadDirect_UShort2(void* _p)
void LOADERDECL TexCoord_ReadDirect_Short1(void* _p) void LOADERDECL TexCoord_ReadDirect_Short1(void* _p)
{ {
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)ReadBuffer16() * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)DataReadU16() * tcScaleU[tcIndex];
LOG_TEX1(); LOG_TEX1();
VertexManager::s_pCurBufferPointer += 4; VertexManager::s_pCurBufferPointer += 4;
tcIndex++; tcIndex++;
} }
void LOADERDECL TexCoord_ReadDirect_Short2(void* _p) void LOADERDECL TexCoord_ReadDirect_Short2(void* _p)
{ {
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)ReadBuffer16() * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)DataReadU16() * tcScaleU[tcIndex];
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)ReadBuffer16() * tcScaleV[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)DataReadU16() * tcScaleV[tcIndex];
LOG_TEX2(); LOG_TEX2();
VertexManager::s_pCurBufferPointer += 8; VertexManager::s_pCurBufferPointer += 8;
tcIndex++; tcIndex++;
@ -94,15 +94,15 @@ void LOADERDECL TexCoord_ReadDirect_Short2(void* _p)
void LOADERDECL TexCoord_ReadDirect_Float1(void* _p) void LOADERDECL TexCoord_ReadDirect_Float1(void* _p)
{ {
((float*)VertexManager::s_pCurBufferPointer)[0] = ReadBuffer32F() * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = DataReadF32() * tcScaleU[tcIndex];
LOG_TEX1(); LOG_TEX1();
VertexManager::s_pCurBufferPointer += 4; VertexManager::s_pCurBufferPointer += 4;
tcIndex++; tcIndex++;
} }
void LOADERDECL TexCoord_ReadDirect_Float2(void* _p) void LOADERDECL TexCoord_ReadDirect_Float2(void* _p)
{ {
((float*)VertexManager::s_pCurBufferPointer)[0] = ReadBuffer32F() * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = DataReadF32() * tcScaleU[tcIndex];
((float*)VertexManager::s_pCurBufferPointer)[1] = ReadBuffer32F() * tcScaleV[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[1] = DataReadF32() * tcScaleV[tcIndex];
LOG_TEX2(); LOG_TEX2();
VertexManager::s_pCurBufferPointer += 8; VertexManager::s_pCurBufferPointer += 8;
tcIndex++; tcIndex++;
@ -111,7 +111,7 @@ void LOADERDECL TexCoord_ReadDirect_Float2(void* _p)
// ================================================================================== // ==================================================================================
void LOADERDECL TexCoord_ReadIndex8_UByte1(void* _p) void LOADERDECL TexCoord_ReadIndex8_UByte1(void* _p)
{ {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex];
@ -121,7 +121,7 @@ void LOADERDECL TexCoord_ReadIndex8_UByte1(void* _p)
} }
void LOADERDECL TexCoord_ReadIndex8_UByte2(void* _p) void LOADERDECL TexCoord_ReadIndex8_UByte2(void* _p)
{ {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex];
@ -133,7 +133,7 @@ void LOADERDECL TexCoord_ReadIndex8_UByte2(void* _p)
void LOADERDECL TexCoord_ReadIndex8_Byte1(void* _p) void LOADERDECL TexCoord_ReadIndex8_Byte1(void* _p)
{ {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex];
@ -143,7 +143,7 @@ void LOADERDECL TexCoord_ReadIndex8_Byte1(void* _p)
} }
void LOADERDECL TexCoord_ReadIndex8_Byte2(void* _p) void LOADERDECL TexCoord_ReadIndex8_Byte2(void* _p)
{ {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex];
@ -155,7 +155,7 @@ void LOADERDECL TexCoord_ReadIndex8_Byte2(void* _p)
void LOADERDECL TexCoord_ReadIndex8_UShort1(void* _p) void LOADERDECL TexCoord_ReadIndex8_UShort1(void* _p)
{ {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex];
@ -165,7 +165,7 @@ void LOADERDECL TexCoord_ReadIndex8_UShort1(void* _p)
} }
void LOADERDECL TexCoord_ReadIndex8_UShort2(void* _p) void LOADERDECL TexCoord_ReadIndex8_UShort2(void* _p)
{ {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex];
@ -177,7 +177,7 @@ void LOADERDECL TexCoord_ReadIndex8_UShort2(void* _p)
void LOADERDECL TexCoord_ReadIndex8_Short1(void* _p) void LOADERDECL TexCoord_ReadIndex8_Short1(void* _p)
{ {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex];
@ -187,7 +187,7 @@ void LOADERDECL TexCoord_ReadIndex8_Short1(void* _p)
} }
void LOADERDECL TexCoord_ReadIndex8_Short2(void* _p) void LOADERDECL TexCoord_ReadIndex8_Short2(void* _p)
{ {
u8 Index = ReadBuffer8(); u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex];
@ -199,7 +199,7 @@ void LOADERDECL TexCoord_ReadIndex8_Short2(void* _p)
void LOADERDECL TexCoord_ReadIndex8_Float1(void* _p) void LOADERDECL TexCoord_ReadIndex8_Float1(void* _p)
{ {
u16 Index = ReadBuffer8(); u16 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
u32 uTemp; u32 uTemp;
uTemp = Memory_Read_U32(iAddress); uTemp = Memory_Read_U32(iAddress);
@ -210,7 +210,7 @@ void LOADERDECL TexCoord_ReadIndex8_Float1(void* _p)
} }
void LOADERDECL TexCoord_ReadIndex8_Float2(void* _p) void LOADERDECL TexCoord_ReadIndex8_Float2(void* _p)
{ {
u16 Index = ReadBuffer8(); u16 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
u32 uTemp; u32 uTemp;
uTemp = Memory_Read_U32(iAddress); uTemp = Memory_Read_U32(iAddress);
@ -225,7 +225,7 @@ void LOADERDECL TexCoord_ReadIndex8_Float2(void* _p)
// ================================================================================== // ==================================================================================
void LOADERDECL TexCoord_ReadIndex16_UByte1(void* _p) void LOADERDECL TexCoord_ReadIndex16_UByte1(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex];
@ -235,7 +235,7 @@ void LOADERDECL TexCoord_ReadIndex16_UByte1(void* _p)
} }
void LOADERDECL TexCoord_ReadIndex16_UByte2(void* _p) void LOADERDECL TexCoord_ReadIndex16_UByte2(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex];
@ -247,7 +247,7 @@ void LOADERDECL TexCoord_ReadIndex16_UByte2(void* _p)
void LOADERDECL TexCoord_ReadIndex16_Byte1(void* _p) void LOADERDECL TexCoord_ReadIndex16_Byte1(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex];
@ -257,7 +257,7 @@ void LOADERDECL TexCoord_ReadIndex16_Byte1(void* _p)
} }
void LOADERDECL TexCoord_ReadIndex16_Byte2(void* _p) void LOADERDECL TexCoord_ReadIndex16_Byte2(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex];
@ -269,7 +269,7 @@ void LOADERDECL TexCoord_ReadIndex16_Byte2(void* _p)
void LOADERDECL TexCoord_ReadIndex16_UShort1(void* _p) void LOADERDECL TexCoord_ReadIndex16_UShort1(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex];
@ -279,7 +279,7 @@ void LOADERDECL TexCoord_ReadIndex16_UShort1(void* _p)
} }
void LOADERDECL TexCoord_ReadIndex16_UShort2(void* _p) void LOADERDECL TexCoord_ReadIndex16_UShort2(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex];
@ -291,7 +291,7 @@ void LOADERDECL TexCoord_ReadIndex16_UShort2(void* _p)
void LOADERDECL TexCoord_ReadIndex16_Short1(void* _p) void LOADERDECL TexCoord_ReadIndex16_Short1(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex];
@ -301,7 +301,7 @@ void LOADERDECL TexCoord_ReadIndex16_Short1(void* _p)
} }
void LOADERDECL TexCoord_ReadIndex16_Short2(void* _p) void LOADERDECL TexCoord_ReadIndex16_Short2(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]; ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex];
@ -313,7 +313,7 @@ void LOADERDECL TexCoord_ReadIndex16_Short2(void* _p)
void LOADERDECL TexCoord_ReadIndex16_Float1(void* _p) void LOADERDECL TexCoord_ReadIndex16_Float1(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
u32 uTemp; u32 uTemp;
uTemp = Memory_Read_U32(iAddress ); uTemp = Memory_Read_U32(iAddress );
@ -324,7 +324,7 @@ void LOADERDECL TexCoord_ReadIndex16_Float1(void* _p)
} }
void LOADERDECL TexCoord_ReadIndex16_Float2(void* _p) void LOADERDECL TexCoord_ReadIndex16_Float2(void* _p)
{ {
u16 Index = ReadBuffer16(); u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
u32 uTemp; u32 uTemp;
uTemp = Memory_Read_U32(iAddress ); uTemp = Memory_Read_U32(iAddress );

View File

@ -201,8 +201,8 @@ void Video_Prepare(void)
BPInit(); BPInit();
VertexManager::Init(); VertexManager::Init();
Fifo_Init(); // must be done before OpcodeDecoder_Init()
OpcodeDecoder_Init(); OpcodeDecoder_Init();
Fifo_Init();
VertexShaderMngr::Init(); VertexShaderMngr::Init();
PixelShaderMngr::Init(); PixelShaderMngr::Init();
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();