From df9eba79b2f9efd451bee3fdfb683b3b2976bb1b Mon Sep 17 00:00:00 2001 From: "memberTwo.mb2" Date: Mon, 29 Sep 2008 17:29:25 +0000 Subject: [PATCH] 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 --- Source/Core/VideoCommon/Src/Fifo.cpp | 32 +++- Source/Core/VideoCommon/Src/Fifo.h | 13 ++ .../Plugin_VideoDX9/Src/OpcodeDecoding.cpp | 5 + .../Plugin_VideoOGL/Src/DataReader.cpp | 12 ++ .../Plugins/Plugin_VideoOGL/Src/DataReader.h | 137 +++++++++++++++++- .../Plugin_VideoOGL/Src/OpcodeDecoding.cpp | 124 +++++++++++----- .../Plugin_VideoOGL/Src/VertexLoader.cpp | 37 +---- .../Plugin_VideoOGL/Src/VertexLoader.h | 8 +- .../Plugin_VideoOGL/Src/VertexLoader_Color.h | 57 ++++---- .../Src/VertexLoader_Normal.cpp | 80 +++++----- .../Src/VertexLoader_Position.h | 50 +++---- .../Src/VertexLoader_TextCoord.h | 70 ++++----- Source/Plugins/Plugin_VideoOGL/Src/main.cpp | 2 +- 13 files changed, 423 insertions(+), 204 deletions(-) diff --git a/Source/Core/VideoCommon/Src/Fifo.cpp b/Source/Core/VideoCommon/Src/Fifo.cpp index d6e6cef4b0..7f96ea1789 100644 --- a/Source/Core/VideoCommon/Src/Fifo.cpp +++ b/Source/Core/VideoCommon/Src/Fifo.cpp @@ -23,9 +23,11 @@ #include "Fifo.h" -#define FIFO_SIZE (1024*1024) - +#if defined(DATAREADER_INLINE) +extern u32 g_pVideoData; +#else FifoReader fifo; +#endif // STATE_TO_SAVE static u8 *videoBuffer; @@ -41,7 +43,9 @@ void Fifo_DoState(PointerWrap &p) { void Fifo_Init() { videoBuffer = (u8*)AllocateMemoryPages(FIFO_SIZE); +#ifndef DATAREADER_INLINE fifo.Init(videoBuffer, videoBuffer); //zero length. there is no data yet. +#endif } void Fifo_Shutdown() @@ -49,6 +53,11 @@ void Fifo_Shutdown() FreeMemoryPages(videoBuffer, FIFO_SIZE); } +u32 FAKE_GetFifoStartPtr() +{ + return (int)videoBuffer; +} + int FAKE_GetFifoSize() { if (size < readptr) @@ -57,6 +66,10 @@ int FAKE_GetFifoSize() } return (size - readptr); } +int FAKE_GetFifoEndAddr() +{ + return (int)(videoBuffer+size); +} u8 FAKE_PeekFifo8(u32 _uOffset) { @@ -83,6 +96,11 @@ int FAKE_GetPosition() return readptr; } +int FAKE_GetRealPtr() +{ + return (int)(videoBuffer+readptr); +} + u16 FAKE_ReadFifo16() { u16 val = Common::swap16(*(u16*)(videoBuffer+readptr)); @@ -104,10 +122,16 @@ void FAKE_SkipFifo(u32 skip) void Video_SendFifoData(u8* _uData) { + // TODO (mb2): unrolled loop faster than memcpy here? memcpy(videoBuffer + size, _uData, 32); size += 32; 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) { 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()); size = FAKE_GetFifoSize(); readptr = 0; +#ifdef DATAREADER_INLINE + if (g_pVideoData) // for DX9 plugin "compatibility" + g_pVideoData = FAKE_GetFifoStartPtr(); +#endif } OpcodeDecoder_Run(); } diff --git a/Source/Core/VideoCommon/Src/Fifo.h b/Source/Core/VideoCommon/Src/Fifo.h index ec1610c4ff..68bc0eed96 100644 --- a/Source/Core/VideoCommon/Src/Fifo.h +++ b/Source/Core/VideoCommon/Src/Fifo.h @@ -23,6 +23,18 @@ #include "Common.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! class FifoReader { @@ -54,6 +66,7 @@ public: extern FifoReader fifo; +#endif void Fifo_Init(); void Fifo_Shutdown(); void Fifo_EnterLoop(const SVideoInitialize &video_initialize); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.cpp b/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.cpp index f1e69de2f0..379c05abd6 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.cpp @@ -40,12 +40,17 @@ #include "XFStructs.h" #include "Utils.h" #include "main.h" +#include "Fifo.h" #include "DataReader.h" #include "DLCompiler.h" #define CMDBUFFER_SIZE 1024*1024 DecodedVArray tempvarray; +// TODO (mb2): all! DataReader inline for DX9 +#ifdef DATAREADER_INLINE +u32 g_pVideoData=0; +#endif void Decode(); extern u8 FAKE_PeekFifo8(u32 _uOffset); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/DataReader.cpp b/Source/Plugins/Plugin_VideoOGL/Src/DataReader.cpp index e74e0f4c56..d61aade85b 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/DataReader.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/DataReader.cpp @@ -18,6 +18,7 @@ #include "Globals.h" #include "DataReader.h" +#if !defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG) // ================================================================================================= // CDataReader_Fifo // ================================================================================================= @@ -27,6 +28,7 @@ extern u8 FAKE_ReadFifo8(); extern u16 FAKE_ReadFifo16(); extern u32 FAKE_ReadFifo32(); extern int FAKE_GetPosition(); +extern int FAKE_GetRealPtr(); extern void FAKE_SkipFifo(u32 skip); IDataReader::~IDataReader() @@ -61,6 +63,10 @@ int CDataReader_Fifo::GetPosition() { return FAKE_GetPosition(); } +int CDataReader_Fifo::GetRealPtr() +{ + return FAKE_GetRealPtr(); +} // ================================================================================================= @@ -108,3 +114,9 @@ void CDataReader_Memory::Skip(u32 skip) { m_uReadAddress += skip; } + +int CDataReader_Memory::GetRealPtr() +{ + return (int)Memory_GetPtr(m_uReadAddress); +} +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/DataReader.h b/Source/Plugins/Plugin_VideoOGL/Src/DataReader.h index dbd955f42a..5d58f3659f 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/DataReader.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/DataReader.h @@ -18,6 +18,10 @@ #ifndef _DATAREADER_H #define _DATAREADER_H +#include "Fifo.h" + + +#if !defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG) // ================================================================================================= // IDataReader // ================================================================================================= @@ -34,6 +38,7 @@ public: virtual u32 Read32() = 0; 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 u32 Read32(); virtual int GetPosition(); + virtual int GetRealPtr(); }; // ================================================================================================= @@ -76,8 +82,137 @@ public: virtual u16 Read16(); virtual u32 Read32(); virtual int GetPosition(); + virtual int GetRealPtr(); }; 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 diff --git a/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp b/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp index 49a8e616c4..9473436ee7 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp @@ -32,17 +32,36 @@ #include "TextureMngr.h" #include "BPStructs.h" +#include "Fifo.h" #include "DataReader.h" #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(); +#if !defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG) extern u8 FAKE_PeekFifo8(u32 _uOffset); extern u16 FAKE_PeekFifo16(u32 _uOffset); extern u32 FAKE_PeekFifo32(u32 _uOffset); 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 void Xchg(T& a, T&b) @@ -54,19 +73,30 @@ void Xchg(T& a, T&b) void ExecuteDisplayList(u32 address, u32 size) { +#if ! defined(DATAREADER_INLINE) || defined(DATAREADER_DEBUG) IDataReader* pOldReader = g_pDataReader; //address &= 0x01FFFFFF; // phys address CDataReader_Memory memoryReader(address); 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) Xchg(stats.thisFrame.numDLPrims, stats.thisFrame.numPrims); Xchg(stats.thisFrame.numXFLoadsInDL, stats.thisFrame.numXFLoads); Xchg(stats.thisFrame.numCPLoadsInDL, stats.thisFrame.numCPLoads); Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads); +#ifdef DATAREADER_INLINE + while((g_pVideoData - startAddress) < size) +#else while((memoryReader.GetReadAddress() - address) < size) +#endif { Decode(); } @@ -80,32 +110,37 @@ void ExecuteDisplayList(u32 address, u32 size) Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads); // reset to the old reader +#ifdef DATAREADER_INLINE + g_pVideoData = old_pVideoData; +#endif +#if defined(DATAREADER_DEBUG) || !defined(DATAREADER_INLINE) 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) { +#ifndef DATAREADER_INLINE 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) 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; switch(Cmd) @@ -149,7 +184,14 @@ bool FifoCommandRunnable(void) if (iBufferSize >= 5) { 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; iCommandSize += dwTransferSize * 4; } @@ -167,7 +209,14 @@ bool FifoCommandRunnable(void) if (iBufferSize >= 3) { 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]; iCommandSize += numVertices * vtxLoader.ComputeVertexSize(); } @@ -200,7 +249,7 @@ bool FifoCommandRunnable(void) void Decode(void) { - int Cmd = g_pDataReader->Read8(); + int Cmd = DataReadU8(); switch(Cmd) { case GX_NOP: @@ -208,8 +257,8 @@ void Decode(void) case GX_LOAD_CP_REG: //0x08 { - u32 SubCmd = g_pDataReader->Read8(); - u32 Value = g_pDataReader->Read32(); + u32 SubCmd = DataReadU8(); + u32 Value = DataReadU32(); VertexManager::LoadCPReg(SubCmd,Value); INCSTAT(stats.thisFrame.numCPLoads); } @@ -217,35 +266,35 @@ void Decode(void) case GX_LOAD_XF_REG: { - u32 Cmd2 = g_pDataReader->Read32(); + u32 Cmd2 = DataReadU32(); int dwTransferSize = ((Cmd2>>16)&15) + 1; u32 dwAddress = Cmd2 & 0xFFFF; static u32 pData[16]; for (int i=0; iRead32(); + pData[i] = DataReadU32(); VertexShaderMngr::LoadXFReg(dwTransferSize,dwAddress,pData); INCSTAT(stats.thisFrame.numXFLoads); } break; case GX_LOAD_INDX_A: //used for position matrices - VertexShaderMngr::LoadIndexedXF(g_pDataReader->Read32(),0xC); + VertexShaderMngr::LoadIndexedXF(DataReadU32(),0xC); break; case GX_LOAD_INDX_B: //used for normal matrices - VertexShaderMngr::LoadIndexedXF(g_pDataReader->Read32(),0xD); + VertexShaderMngr::LoadIndexedXF(DataReadU32(),0xD); break; case GX_LOAD_INDX_C: //used for postmatrices - VertexShaderMngr::LoadIndexedXF(g_pDataReader->Read32(),0xE); + VertexShaderMngr::LoadIndexedXF(DataReadU32(),0xE); break; case GX_LOAD_INDX_D: //used for lights - VertexShaderMngr::LoadIndexedXF(g_pDataReader->Read32(),0xF); + VertexShaderMngr::LoadIndexedXF(DataReadU32(),0xF); break; case GX_CMD_CALL_DL: { - u32 dwAddr = g_pDataReader->Read32(); - u32 dwCount = g_pDataReader->Read32(); + u32 dwAddr = DataReadU32(); + u32 dwCount = DataReadU32(); ExecuteDisplayList(dwAddr, dwCount); } break; @@ -260,7 +309,7 @@ void Decode(void) case GX_LOAD_BP_REG: //0x61 { - u32 cmd = g_pDataReader->Read32(); + u32 cmd = DataReadU32(); LoadBPReg(cmd); INCSTAT(stats.thisFrame.numBPLoads); } @@ -271,7 +320,7 @@ void Decode(void) if (Cmd&0x80) { // load vertices (use computed vertex size from FifoCommandRunnable above) - u16 numVertices = g_pDataReader->Read16(); + u16 numVertices = DataReadU16(); if (numVertices > 0) { 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() { +#if !defined(DATAREADER_INLINE) 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() { DVSTARTPROFILE(); - while (FifoCommandRunnable()) { + DATAREADER_DEBUG_CHECK_PTR; Decode(); } } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp index 594d8b2b61..983bb845ac 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp @@ -61,34 +61,6 @@ static int colIndex; #undef inline #define inline #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 @@ -98,7 +70,7 @@ static int s_texmtxwrite = 0, s_texmtxread = 0; void LOADERDECL PosMtx_ReadDirect_UByte(void* _p) { - s_curposmtx = ReadBuffer8()&0x3f; + s_curposmtx = DataReadU8()&0x3f; PRIM_LOG("posmtx: %d, ", s_curposmtx); } @@ -112,7 +84,7 @@ void LOADERDECL PosMtx_Write(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]); s_texmtxread++; } @@ -704,9 +676,10 @@ void VertexLoader::RunVertices(int primitive, int count) if( fnSetupVertexPointers != NULL && fnSetupVertexPointers != (void (*)())(void*)m_compiledCode ) 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 - g_pDataReader->Skip(count*m_VertexSize); + DataSkip(count*m_VertexSize); return; } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.h b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.h index c43af7abe2..c19220a6cf 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.h @@ -27,6 +27,7 @@ using namespace std; #include "CPMemory.h" +#include "DataReader.h" #define LOADERDECL __cdecl typedef void (LOADERDECL *TPipelineFunction)(void*); @@ -219,11 +220,4 @@ public: }; extern VertexLoader g_VertexLoaders[8]; - -u8 ReadBuffer8(); -u16 ReadBuffer16(); -u32 ReadBuffer32(); -float ReadBuffer32F(); -int GetBufferPosition(); - #endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Color.h b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Color.h index f1b057950b..d6cfa52709 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Color.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Color.h @@ -83,32 +83,32 @@ inline u32 _Read32(u32 iAddress) void LOADERDECL Color_ReadDirect_24b_888(void* _p) { - u32 col = ReadBuffer8()<PosElements) - ((float*)VertexManager::s_pCurBufferPointer)[2] = (float)ReadBuffer8() * posScale; + ((float*)VertexManager::s_pCurBufferPointer)[2] = (float)DataReadU8() * posScale; else ((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f; LOG_VTX(); @@ -39,10 +39,10 @@ void LOADERDECL Pos_ReadDirect_UByte(void* _p) void LOADERDECL Pos_ReadDirect_Byte(void* _p) { TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)ReadBuffer8() * posScale; - ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)ReadBuffer8() * posScale; + ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)DataReadU8() * posScale; + ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)DataReadU8() * posScale; if (pVtxAttr->PosElements) - ((float*)VertexManager::s_pCurBufferPointer)[2] = (float)(s8)ReadBuffer8() * posScale; + ((float*)VertexManager::s_pCurBufferPointer)[2] = (float)(s8)DataReadU8() * posScale; else ((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0; LOG_VTX(); @@ -52,10 +52,10 @@ void LOADERDECL Pos_ReadDirect_Byte(void* _p) void LOADERDECL Pos_ReadDirect_UShort(void* _p) { TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)ReadBuffer16() * posScale; - ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)ReadBuffer16() * posScale; + ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU16() * posScale; + ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)DataReadU16() * posScale; if (pVtxAttr->PosElements) - ((float*)VertexManager::s_pCurBufferPointer)[2] = (float)ReadBuffer16() * posScale; + ((float*)VertexManager::s_pCurBufferPointer)[2] = (float)DataReadU16() * posScale; else ((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f; LOG_VTX(); @@ -65,10 +65,10 @@ void LOADERDECL Pos_ReadDirect_UShort(void* _p) void LOADERDECL Pos_ReadDirect_Short(void* _p) { TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)ReadBuffer16() * posScale; - ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)ReadBuffer16() * posScale; + ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)DataReadU16() * posScale; + ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)DataReadU16() * posScale; if (pVtxAttr->PosElements) - ((float*)VertexManager::s_pCurBufferPointer)[2] = (float)(s16)ReadBuffer16() * posScale; + ((float*)VertexManager::s_pCurBufferPointer)[2] = (float)(s16)DataReadU16() * posScale; else ((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f; LOG_VTX(); @@ -78,10 +78,10 @@ void LOADERDECL Pos_ReadDirect_Short(void* _p) void LOADERDECL Pos_ReadDirect_Float(void* _p) { TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - ((float*)VertexManager::s_pCurBufferPointer)[0] = ReadBuffer32F(); - ((float*)VertexManager::s_pCurBufferPointer)[1] = ReadBuffer32F(); + ((float*)VertexManager::s_pCurBufferPointer)[0] = DataReadF32(); + ((float*)VertexManager::s_pCurBufferPointer)[1] = DataReadF32(); if (pVtxAttr->PosElements) - ((float*)VertexManager::s_pCurBufferPointer)[2] = ReadBuffer32F(); + ((float*)VertexManager::s_pCurBufferPointer)[2] = DataReadF32(); else ((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f; LOG_VTX(); @@ -130,35 +130,35 @@ void LOADERDECL Pos_ReadDirect_Float(void* _p) void LOADERDECL Pos_ReadIndex8_UByte(void* _p) { TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u8 Index = ReadBuffer8(); + u8 Index = DataReadU8(); Pos_ReadIndex_Byte(u8); } void LOADERDECL Pos_ReadIndex8_Byte(void* _p) { TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u8 Index = ReadBuffer8(); + u8 Index = DataReadU8(); Pos_ReadIndex_Byte(s8); } void LOADERDECL Pos_ReadIndex8_UShort(void* _p) { TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u8 Index = ReadBuffer8(); + u8 Index = DataReadU8(); Pos_ReadIndex_Short(u16); } void LOADERDECL Pos_ReadIndex8_Short(void* _p) { TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u8 Index = ReadBuffer8(); + u8 Index = DataReadU8(); Pos_ReadIndex_Short(s16); } void LOADERDECL Pos_ReadIndex8_Float(void* _p) { TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u8 Index = ReadBuffer8(); + u8 Index = DataReadU8(); Pos_ReadIndex_Float(); } @@ -168,33 +168,33 @@ void LOADERDECL Pos_ReadIndex8_Float(void* _p) void LOADERDECL Pos_ReadIndex16_UByte(void* _p){ TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u16 Index = ReadBuffer16(); + u16 Index = DataReadU16(); Pos_ReadIndex_Byte(u8); } void LOADERDECL Pos_ReadIndex16_Byte(void* _p){ TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u16 Index = ReadBuffer16(); + u16 Index = DataReadU16(); Pos_ReadIndex_Byte(s8); } void LOADERDECL Pos_ReadIndex16_UShort(void* _p){ TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u16 Index = ReadBuffer16(); + u16 Index = DataReadU16(); Pos_ReadIndex_Short(u16); } void LOADERDECL Pos_ReadIndex16_Short(void* _p) { TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u16 Index = ReadBuffer16(); + u16 Index = DataReadU16(); Pos_ReadIndex_Short(s16); } void LOADERDECL Pos_ReadIndex16_Float(void* _p) { TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u16 Index = ReadBuffer16(); + u16 Index = DataReadU16(); Pos_ReadIndex_Float(); } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_TextCoord.h b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_TextCoord.h index 00aa53ca73..fef4791b30 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_TextCoord.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_TextCoord.h @@ -30,15 +30,15 @@ void LOADERDECL TexCoord_Read_Dummy(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(); VertexManager::s_pCurBufferPointer += 4; tcIndex++; } void LOADERDECL TexCoord_ReadDirect_UByte2(void* _p) { - ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)ReadBuffer8() * tcScaleU[tcIndex]; - ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)ReadBuffer8() * tcScaleV[tcIndex]; + ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU8() * tcScaleU[tcIndex]; + ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)DataReadU8() * tcScaleV[tcIndex]; LOG_TEX2(); VertexManager::s_pCurBufferPointer += 8; tcIndex++; @@ -46,15 +46,15 @@ void LOADERDECL TexCoord_ReadDirect_UByte2(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(); VertexManager::s_pCurBufferPointer += 4; tcIndex++; } void LOADERDECL TexCoord_ReadDirect_Byte2(void* _p) { - ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)ReadBuffer8() * tcScaleU[tcIndex]; - ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)ReadBuffer8() * tcScaleV[tcIndex]; + ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)DataReadU8() * tcScaleU[tcIndex]; + ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)DataReadU8() * tcScaleV[tcIndex]; LOG_TEX2(); VertexManager::s_pCurBufferPointer += 8; tcIndex++; @@ -62,15 +62,15 @@ void LOADERDECL TexCoord_ReadDirect_Byte2(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(); VertexManager::s_pCurBufferPointer += 4; tcIndex++; } void LOADERDECL TexCoord_ReadDirect_UShort2(void* _p) { - ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)ReadBuffer16() * tcScaleU[tcIndex]; - ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)ReadBuffer16() * tcScaleV[tcIndex]; + ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU16() * tcScaleU[tcIndex]; + ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)DataReadU16() * tcScaleV[tcIndex]; LOG_TEX2(); VertexManager::s_pCurBufferPointer += 8; tcIndex++; @@ -78,15 +78,15 @@ void LOADERDECL TexCoord_ReadDirect_UShort2(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(); VertexManager::s_pCurBufferPointer += 4; tcIndex++; } void LOADERDECL TexCoord_ReadDirect_Short2(void* _p) { - ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)ReadBuffer16() * tcScaleU[tcIndex]; - ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)ReadBuffer16() * tcScaleV[tcIndex]; + ((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)DataReadU16() * tcScaleU[tcIndex]; + ((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)DataReadU16() * tcScaleV[tcIndex]; LOG_TEX2(); VertexManager::s_pCurBufferPointer += 8; tcIndex++; @@ -94,15 +94,15 @@ void LOADERDECL TexCoord_ReadDirect_Short2(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(); VertexManager::s_pCurBufferPointer += 4; tcIndex++; } void LOADERDECL TexCoord_ReadDirect_Float2(void* _p) { - ((float*)VertexManager::s_pCurBufferPointer)[0] = ReadBuffer32F() * tcScaleU[tcIndex]; - ((float*)VertexManager::s_pCurBufferPointer)[1] = ReadBuffer32F() * tcScaleV[tcIndex]; + ((float*)VertexManager::s_pCurBufferPointer)[0] = DataReadF32() * tcScaleU[tcIndex]; + ((float*)VertexManager::s_pCurBufferPointer)[1] = DataReadF32() * tcScaleV[tcIndex]; LOG_TEX2(); VertexManager::s_pCurBufferPointer += 8; tcIndex++; @@ -111,7 +111,7 @@ void LOADERDECL TexCoord_ReadDirect_Float2(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]); ((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) { - u8 Index = ReadBuffer8(); + u8 Index = DataReadU8(); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+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) { - u8 Index = ReadBuffer8(); + u8 Index = DataReadU8(); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+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) { - u8 Index = ReadBuffer8(); + u8 Index = DataReadU8(); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+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) { - u8 Index = ReadBuffer8(); + u8 Index = DataReadU8(); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+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) { - u8 Index = ReadBuffer8(); + u8 Index = DataReadU8(); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+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) { - u8 Index = ReadBuffer8(); + u8 Index = DataReadU8(); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+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) { - u8 Index = ReadBuffer8(); + u8 Index = DataReadU8(); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+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) { - u16 Index = ReadBuffer8(); + u16 Index = DataReadU8(); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 uTemp; uTemp = Memory_Read_U32(iAddress); @@ -210,7 +210,7 @@ void LOADERDECL TexCoord_ReadIndex8_Float1(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 uTemp; uTemp = Memory_Read_U32(iAddress); @@ -225,7 +225,7 @@ void LOADERDECL TexCoord_ReadIndex8_Float2(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]); ((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) { - u16 Index = ReadBuffer16(); + u16 Index = DataReadU16(); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+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) { - u16 Index = ReadBuffer16(); + u16 Index = DataReadU16(); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+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) { - u16 Index = ReadBuffer16(); + u16 Index = DataReadU16(); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+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) { - u16 Index = ReadBuffer16(); + u16 Index = DataReadU16(); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+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) { - u16 Index = ReadBuffer16(); + u16 Index = DataReadU16(); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+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) { - u16 Index = ReadBuffer16(); + u16 Index = DataReadU16(); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+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) { - u16 Index = ReadBuffer16(); + u16 Index = DataReadU16(); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+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) { - u16 Index = ReadBuffer16(); + u16 Index = DataReadU16(); u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); u32 uTemp; uTemp = Memory_Read_U32(iAddress ); @@ -324,7 +324,7 @@ void LOADERDECL TexCoord_ReadIndex16_Float1(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 uTemp; uTemp = Memory_Read_U32(iAddress ); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 69b9cc44fc..28a84beb27 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -201,8 +201,8 @@ void Video_Prepare(void) BPInit(); VertexManager::Init(); + Fifo_Init(); // must be done before OpcodeDecoder_Init() OpcodeDecoder_Init(); - Fifo_Init(); VertexShaderMngr::Init(); PixelShaderMngr::Init(); GL_REPORT_ERRORD();