mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-04 06:40:03 +00:00
Some gfx code reorg, make the two OpcodeDecoding.cpp identical - next change will move them to videocommon
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1659 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
dcc48d6c41
commit
65e702030a
@ -837,4 +837,6 @@ struct BPMemory
|
|||||||
|
|
||||||
extern BPMemory bpmem;
|
extern BPMemory bpmem;
|
||||||
|
|
||||||
|
void LoadBPReg(u32 value0);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -258,4 +258,7 @@ struct VAT
|
|||||||
extern TVtxDesc g_VtxDesc;
|
extern TVtxDesc g_VtxDesc;
|
||||||
extern VAT g_VtxAttr[8];
|
extern VAT g_VtxAttr[8];
|
||||||
|
|
||||||
|
// Might move this into its own file later.
|
||||||
|
void LoadCPReg(u32 SubCmd, u32 Value);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -32,12 +32,6 @@ namespace VertexLoaderManager
|
|||||||
|
|
||||||
// For debugging
|
// For debugging
|
||||||
void AppendListToString(std::string *dest);
|
void AppendListToString(std::string *dest);
|
||||||
|
|
||||||
// TODO - don't expose these like this.
|
|
||||||
// static u8* s_pCurBufferPointer;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Might move this into its own file later.
|
|
||||||
void LoadCPReg(u32 SubCmd, u32 Value);
|
|
||||||
|
|
||||||
#endif // _VERTEXLOADERMANAGER_H
|
#endif // _VERTEXLOADERMANAGER_H
|
56
Source/Core/VideoCommon/Src/VideoCommon.h
Normal file
56
Source/Core/VideoCommon/Src/VideoCommon.h
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
// Copyright (C) 2003-2008 Dolphin Project.
|
||||||
|
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
|
// Official SVN repository and contact information can be found at
|
||||||
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
|
#ifndef _VIDEOCOMMON_H
|
||||||
|
#define _VIDEOCOMMON_H
|
||||||
|
|
||||||
|
#include "Common.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "pluginspecs_video.h"
|
||||||
|
|
||||||
|
extern SVideoInitialize g_VideoInitialize;
|
||||||
|
|
||||||
|
void DebugLog(const char* _fmt, ...);
|
||||||
|
|
||||||
|
inline u8 *Memory_GetPtr(u32 _uAddress)
|
||||||
|
{
|
||||||
|
return g_VideoInitialize.pGetMemoryPointer(_uAddress);//&g_pMemory[_uAddress & RAM_MASK];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline u8 Memory_Read_U8(u32 _uAddress)
|
||||||
|
{
|
||||||
|
return *(u8*)g_VideoInitialize.pGetMemoryPointer(_uAddress);//g_pMemory[_uAddress & RAM_MASK];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline u16 Memory_Read_U16(u32 _uAddress)
|
||||||
|
{
|
||||||
|
return Common::swap16(*(u16*)g_VideoInitialize.pGetMemoryPointer(_uAddress));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline u32 Memory_Read_U32(u32 _uAddress)
|
||||||
|
{
|
||||||
|
return Common::swap32(*(u32*)g_VideoInitialize.pGetMemoryPointer(_uAddress));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float Memory_Read_Float(u32 _uAddress)
|
||||||
|
{
|
||||||
|
union {u32 i; float f;} temp;
|
||||||
|
temp.i = Memory_Read_U32(_uAddress);
|
||||||
|
return temp.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // _VIDEOCOMMON_H
|
@ -200,5 +200,7 @@ struct Viewport
|
|||||||
extern XFRegisters xfregs;
|
extern XFRegisters xfregs;
|
||||||
extern u32 xfmem[XFMEM_SIZE];
|
extern u32 xfmem[XFMEM_SIZE];
|
||||||
|
|
||||||
#endif
|
void LoadXFReg(u32 transferSize, u32 address, u32 *pData);
|
||||||
|
void LoadIndexedXF(u32 val, int array);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -515,6 +515,14 @@
|
|||||||
RelativePath=".\Src\TextureDecoder.h"
|
RelativePath=".\Src\TextureDecoder.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\VertexLoaderManager.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\VideoCommon.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Src\VideoState.cpp"
|
RelativePath=".\Src\VideoState.cpp"
|
||||||
>
|
>
|
||||||
|
@ -24,26 +24,25 @@
|
|||||||
// and hope that the vertex format doesn't change, though, if you do it just when they are
|
// and hope that the vertex format doesn't change, though, if you do it just when they are
|
||||||
// called. The reason is that the vertex format affects the sizes of the vertices.
|
// called. The reason is that the vertex format affects the sizes of the vertices.
|
||||||
|
|
||||||
#include "D3DBase.h"
|
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "Statistics.h"
|
#include "VideoCommon.h"
|
||||||
#include "Profiler.h"
|
#include "Profiler.h"
|
||||||
#include "VertexManager.h"
|
|
||||||
#include "TransformEngine.h"
|
|
||||||
#include "OpcodeDecoding.h"
|
#include "OpcodeDecoding.h"
|
||||||
#include "TextureCache.h"
|
|
||||||
#include "VertexShaderManager.h"
|
|
||||||
#include "PixelShaderManager.h"
|
|
||||||
|
|
||||||
#include "BPStructs.h"
|
#include "VertexLoader.h"
|
||||||
#include "XFStructs.h"
|
#include "VertexLoaderManager.h"
|
||||||
#include "Utils.h"
|
#include "VertexManager.h"
|
||||||
|
|
||||||
|
#include "Statistics.h"
|
||||||
|
|
||||||
|
#include "XFMemory.h"
|
||||||
|
#include "CPMemory.h"
|
||||||
|
#include "BPMemory.h"
|
||||||
|
|
||||||
#include "Fifo.h"
|
#include "Fifo.h"
|
||||||
#include "DataReader.h"
|
#include "DataReader.h"
|
||||||
|
|
||||||
DecodedVArray tempvarray;
|
u8* g_pVideoData = 0;
|
||||||
u8 *g_pVideoData = 0;
|
|
||||||
|
|
||||||
extern u8* FAKE_GetFifoStartPtr();
|
extern u8* FAKE_GetFifoStartPtr();
|
||||||
extern u8* FAKE_GetFifoEndPtr();
|
extern u8* FAKE_GetFifoEndPtr();
|
||||||
@ -53,7 +52,7 @@ static void Decode();
|
|||||||
static void ExecuteDisplayList(u32 address, u32 size)
|
static void ExecuteDisplayList(u32 address, u32 size)
|
||||||
{
|
{
|
||||||
u8* old_pVideoData = g_pVideoData;
|
u8* old_pVideoData = g_pVideoData;
|
||||||
|
|
||||||
u8* startAddress = Memory_GetPtr(address);
|
u8* startAddress = Memory_GetPtr(address);
|
||||||
|
|
||||||
//Avoid the crash if Memory_GetPtr failed ..
|
//Avoid the crash if Memory_GetPtr failed ..
|
||||||
@ -61,10 +60,10 @@ static void ExecuteDisplayList(u32 address, u32 size)
|
|||||||
{
|
{
|
||||||
g_pVideoData = startAddress;
|
g_pVideoData = startAddress;
|
||||||
|
|
||||||
// temporarily swap dl and non-dl(small "hack" for the stats)
|
// temporarily swap dl and non-dl (small "hack" for the stats)
|
||||||
Statistics::SwapDL();
|
Statistics::SwapDL();
|
||||||
|
|
||||||
while((u32)(g_pVideoData - startAddress) < size)
|
while ((u32)(g_pVideoData - startAddress) < size)
|
||||||
{
|
{
|
||||||
Decode();
|
Decode();
|
||||||
}
|
}
|
||||||
@ -73,22 +72,22 @@ static void ExecuteDisplayList(u32 address, u32 size)
|
|||||||
|
|
||||||
// un-swap
|
// un-swap
|
||||||
Statistics::SwapDL();
|
Statistics::SwapDL();
|
||||||
|
|
||||||
// reset to the old pointer
|
|
||||||
g_pVideoData = old_pVideoData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reset to the old pointer
|
||||||
|
g_pVideoData = old_pVideoData;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FifoCommandRunnable()
|
bool FifoCommandRunnable()
|
||||||
{
|
{
|
||||||
u32 iBufferSize = (u32)(FAKE_GetFifoEndPtr()-g_pVideoData);
|
u32 iBufferSize = (u32)(FAKE_GetFifoEndPtr() - g_pVideoData);
|
||||||
if (iBufferSize == 0)
|
if (iBufferSize == 0)
|
||||||
return false; // can't peek
|
return false; // can't peek
|
||||||
|
|
||||||
u8 Cmd = DataPeek8(0);
|
u8 Cmd = DataPeek8(0);
|
||||||
u32 iCommandSize = 0;
|
u32 iCommandSize = 0;
|
||||||
|
|
||||||
switch(Cmd)
|
switch (Cmd)
|
||||||
{
|
{
|
||||||
case GX_NOP:
|
case GX_NOP:
|
||||||
// Hm, this means that we scan over nop streams pretty slowly...
|
// Hm, this means that we scan over nop streams pretty slowly...
|
||||||
@ -131,7 +130,7 @@ bool FifoCommandRunnable()
|
|||||||
iCommandSize = 1 + 4;
|
iCommandSize = 1 + 4;
|
||||||
u32 Cmd2 = DataPeek32(1);
|
u32 Cmd2 = DataPeek32(1);
|
||||||
int dwTransferSize = ((Cmd2 >> 16) & 15) + 1;
|
int dwTransferSize = ((Cmd2 >> 16) & 15) + 1;
|
||||||
iCommandSize += dwTransferSize * 4;
|
iCommandSize += dwTransferSize * 4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -141,17 +140,14 @@ bool FifoCommandRunnable()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (Cmd&0x80)
|
if (Cmd & 0x80)
|
||||||
{
|
{
|
||||||
// check if we can read the header
|
// check if we can read the header
|
||||||
if (iBufferSize >= 3)
|
if (iBufferSize >= 3)
|
||||||
{
|
{
|
||||||
iCommandSize = 1 + 2;
|
iCommandSize = 1 + 2;
|
||||||
u16 numVertices = DataPeek16(1);
|
u16 numVertices = DataPeek16(1);
|
||||||
VertexLoader& vtxLoader = g_VertexLoaders[Cmd & GX_VAT_MASK];
|
iCommandSize += numVertices * VertexLoaderManager::GetVertexSize(Cmd & GX_VAT_MASK);
|
||||||
vtxLoader.Setup();
|
|
||||||
int vsize = vtxLoader.GetVertexSize();
|
|
||||||
iCommandSize += numVertices * vsize;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -160,17 +156,16 @@ bool FifoCommandRunnable()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char szTemp[1024];
|
char szTemp[1024];
|
||||||
sprintf(szTemp, "GFX: Unknown Opcode (0x%x).\n"
|
sprintf(szTemp, "GFX: Unknown Opcode (0x%x).\n"
|
||||||
"This means one of the following:\n"
|
"This means one of the following:\n"
|
||||||
"* The emulated GPU got desynced, disabling dual core can help\n"
|
"* The emulated GPU got desynced, disabling dual core can help\n"
|
||||||
"* Command stream corrupted by some spurious memory bug\n"
|
"* Command stream corrupted by some spurious memory bug\n"
|
||||||
"* This really is an unknown opcode (unlikely)\n\n"
|
"* This really is an unknown opcode (unlikely)\n"
|
||||||
"* Some other sort of bug\n\n"
|
"* Some other sort of bug\n\n"
|
||||||
"Dolphin will now likely crash or hang. Enjoy.", Cmd);
|
"Dolphin will now likely crash or hang. Enjoy." , Cmd);
|
||||||
MessageBox(NULL, szTemp, "Video-Plugin", MB_OK);
|
g_VideoInitialize.pSysMessage(szTemp);
|
||||||
g_VideoInitialize.pLog(szTemp, TRUE);
|
g_VideoInitialize.pLog(szTemp, TRUE);
|
||||||
|
|
||||||
{
|
{
|
||||||
SCPFifoStruct &fifo = *g_VideoInitialize.pCPFifo;
|
SCPFifoStruct &fifo = *g_VideoInitialize.pCPFifo;
|
||||||
|
|
||||||
@ -194,67 +189,65 @@ bool FifoCommandRunnable()
|
|||||||
,fifo.bFF_BPEnable ? "true" : "false" ,fifo.bFF_GPLinkEnable ? "true" : "false"
|
,fifo.bFF_BPEnable ? "true" : "false" ,fifo.bFF_GPLinkEnable ? "true" : "false"
|
||||||
,fifo.bFF_Breakpoint ? "true" : "false");
|
,fifo.bFF_Breakpoint ? "true" : "false");
|
||||||
|
|
||||||
|
g_VideoInitialize.pSysMessage(szTmp);
|
||||||
g_VideoInitialize.pLog(szTmp, TRUE);
|
g_VideoInitialize.pLog(szTmp, TRUE);
|
||||||
MessageBox(0,szTmp,"GFX ERROR",0);
|
|
||||||
// _assert_msg_(0,szTmp,"");
|
// _assert_msg_(0,szTmp,"");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iCommandSize > iBufferSize)
|
if (iCommandSize > iBufferSize)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
// INFO_LOG("OP detected: Cmd 0x%x size %i buffer %i",Cmd, iCommandSize, iBufferSize);
|
||||||
char temp[256];
|
|
||||||
sprintf(temp, "OP detected: Cmd 0x%x size %i buffer %i",Cmd, iCommandSize, iBufferSize);
|
|
||||||
g_VideoInitialize.pLog(temp, FALSE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Decode(void)
|
static void Decode()
|
||||||
{
|
{
|
||||||
int Cmd = DataReadU8();
|
int Cmd = DataReadU8();
|
||||||
switch (Cmd)
|
switch(Cmd)
|
||||||
{
|
{
|
||||||
case GX_NOP:
|
case GX_NOP:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GX_LOAD_CP_REG:
|
case GX_LOAD_CP_REG: //0x08
|
||||||
{
|
{
|
||||||
u32 SubCmd = DataReadU8();
|
u32 SubCmd = DataReadU8();
|
||||||
u32 Value = DataReadU32();
|
u32 Value = DataReadU32();
|
||||||
LoadCPReg(SubCmd,Value);
|
LoadCPReg(SubCmd, Value);
|
||||||
|
INCSTAT(stats.thisFrame.numCPLoads);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GX_LOAD_XF_REG:
|
case GX_LOAD_XF_REG:
|
||||||
{
|
{
|
||||||
u32 Cmd2 = DataReadU32();
|
u32 Cmd2 = DataReadU32();
|
||||||
|
int dwTransferSize = ((Cmd2 >> 16) & 15) + 1;
|
||||||
int dwTransferSize = ((Cmd2>>16)&15) + 1;
|
|
||||||
u32 dwAddress = Cmd2 & 0xFFFF;
|
u32 dwAddress = Cmd2 & 0xFFFF;
|
||||||
|
// TODO - speed this up. pshufb?
|
||||||
static u32 pData[16];
|
static u32 pData[16];
|
||||||
for (int i=0; i<dwTransferSize; i++)
|
for (int i = 0; i < dwTransferSize; i++)
|
||||||
pData[i] = DataReadU32();
|
pData[i] = DataReadU32();
|
||||||
LoadXFReg(dwTransferSize,dwAddress,pData);
|
LoadXFReg(dwTransferSize, dwAddress, pData);
|
||||||
|
INCSTAT(stats.thisFrame.numXFLoads);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GX_LOAD_INDX_A: //used for position matrices
|
case GX_LOAD_INDX_A: //used for position matrices
|
||||||
LoadIndexedXF(DataReadU32(),0xC);
|
LoadIndexedXF(DataReadU32(), 0xC);
|
||||||
break;
|
break;
|
||||||
case GX_LOAD_INDX_B: //used for normal matrices
|
case GX_LOAD_INDX_B: //used for normal matrices
|
||||||
LoadIndexedXF(DataReadU32(),0xD);
|
LoadIndexedXF(DataReadU32(), 0xD);
|
||||||
break;
|
break;
|
||||||
case GX_LOAD_INDX_C: //used for postmatrices
|
case GX_LOAD_INDX_C: //used for postmatrices
|
||||||
LoadIndexedXF(DataReadU32(),0xE);
|
LoadIndexedXF(DataReadU32(), 0xE);
|
||||||
break;
|
break;
|
||||||
case GX_LOAD_INDX_D: //used for lights
|
case GX_LOAD_INDX_D: //used for lights
|
||||||
LoadIndexedXF(DataReadU32(),0xF);
|
LoadIndexedXF(DataReadU32(), 0xF);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GX_CMD_CALL_DL:
|
case GX_CMD_CALL_DL:
|
||||||
@ -277,53 +270,27 @@ static void Decode(void)
|
|||||||
{
|
{
|
||||||
u32 cmd = DataReadU32();
|
u32 cmd = DataReadU32();
|
||||||
LoadBPReg(cmd);
|
LoadBPReg(cmd);
|
||||||
|
INCSTAT(stats.thisFrame.numBPLoads);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// draw primitives
|
// draw primitives
|
||||||
default:
|
default:
|
||||||
if (Cmd&0x80)
|
if (Cmd & 0x80)
|
||||||
{
|
{
|
||||||
// load vertices
|
// load vertices (use computed vertex size from FifoCommandRunnable above)
|
||||||
u16 numVertices = DataReadU16();
|
u16 numVertices = DataReadU16();
|
||||||
tempvarray.Reset();
|
VertexLoaderManager::RunVertices(
|
||||||
VertexLoader::SetVArray(&tempvarray);
|
Cmd & GX_VAT_MASK, // Vertex loader index (0 - 7)
|
||||||
VertexLoader& vtxLoader = g_VertexLoaders[Cmd & GX_VAT_MASK];
|
(Cmd & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT,
|
||||||
vtxLoader.Setup();
|
numVertices);
|
||||||
vtxLoader.PrepareRun();
|
|
||||||
int vsize = vtxLoader.GetVertexSize();
|
|
||||||
vtxLoader.RunVertices(numVertices);
|
|
||||||
|
|
||||||
// add vertices
|
|
||||||
int primitive = (Cmd & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT;
|
|
||||||
VertexManager::AddVertices(primitive, numVertices, &tempvarray);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SCPFifoStruct &fifo = *g_VideoInitialize.pCPFifo;
|
// char szTmp[256];
|
||||||
|
//sprintf(szTmp, "Illegal command %02x (at %08x)",Cmd,g_pDataReader->GetPtr());
|
||||||
char szTmp[256];
|
//g_VideoInitialize.pLog(szTmp);
|
||||||
// sprintf(szTmp, "Illegal command %02x (at %08x)",Cmd,g_pDataReader->GetPtr());
|
//MessageBox(0,szTmp,"GFX ERROR",0);
|
||||||
sprintf(szTmp, "Illegal command %02x\n"
|
|
||||||
"CPBase: 0x%08x\n"
|
|
||||||
"CPEnd: 0x%08x\n"
|
|
||||||
"CPHiWatermark: 0x%08x\n"
|
|
||||||
"CPLoWatermark: 0x%08x\n"
|
|
||||||
"CPReadWriteDistance: 0x%08x\n"
|
|
||||||
"CPWritePointer: 0x%08x\n"
|
|
||||||
"CPReadPointer: 0x%08x\n"
|
|
||||||
"CPBreakpoint: 0x%08x\n"
|
|
||||||
"bFF_GPReadEnable: %s\n"
|
|
||||||
"bFF_BPEnable: %s\n"
|
|
||||||
"bFF_GPLinkEnable: %s\n"
|
|
||||||
"bFF_Breakpoint: %s\n"
|
|
||||||
,Cmd, fifo.CPBase, fifo.CPEnd, fifo.CPHiWatermark, fifo.CPLoWatermark, fifo.CPReadWriteDistance
|
|
||||||
,fifo.CPWritePointer, fifo.CPReadPointer, fifo.CPBreakpoint, fifo.bFF_GPReadEnable ? "true" : "false"
|
|
||||||
,fifo.bFF_BPEnable ? "true" : "false" ,fifo.bFF_GPLinkEnable ? "true" : "false"
|
|
||||||
,fifo.bFF_Breakpoint ? "true" : "false");
|
|
||||||
|
|
||||||
g_VideoInitialize.pLog(szTmp, TRUE);
|
|
||||||
MessageBox(0,szTmp,"GFX ERROR",0);
|
|
||||||
// _assert_msg_(0,szTmp,"");
|
// _assert_msg_(0,szTmp,"");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -334,22 +301,20 @@ static void Decode(void)
|
|||||||
void OpcodeDecoder_Init()
|
void OpcodeDecoder_Init()
|
||||||
{
|
{
|
||||||
g_pVideoData = FAKE_GetFifoStartPtr();
|
g_pVideoData = FAKE_GetFifoStartPtr();
|
||||||
tempvarray.Create(65536*3, 1, 8, 3, 2, 8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OpcodeDecoder_Shutdown()
|
void OpcodeDecoder_Shutdown()
|
||||||
{
|
{
|
||||||
//VirtualFree((LPVOID)buffer,0,MEM_RELEASE);
|
|
||||||
tempvarray.Destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpcodeDecoder_Run()
|
void OpcodeDecoder_Run()
|
||||||
{
|
{
|
||||||
DVSTARTPROFILE();
|
DVSTARTPROFILE();
|
||||||
|
|
||||||
while (FifoCommandRunnable())
|
while (FifoCommandRunnable())
|
||||||
{
|
{
|
||||||
|
//TODO?: if really needed, do something like this: "InterlockedExchange((LONG*)&_fifo.CPCmdIdle, 0);"
|
||||||
Decode();
|
Decode();
|
||||||
}
|
}
|
||||||
}
|
//TODO?: if really needed, do something like this: "InterlockedExchange((LONG*)&_fifo.CPCmdIdle, 1);"
|
||||||
|
}
|
||||||
|
@ -21,43 +21,11 @@
|
|||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "LookUpTables.h"
|
#include "LookUpTables.h"
|
||||||
|
#include "VideoCommon.h"
|
||||||
|
|
||||||
extern int frameCount;
|
extern int frameCount;
|
||||||
|
|
||||||
LRESULT CALLBACK AboutProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
LRESULT CALLBACK AboutProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
//#define RAM_MASK 0x1FFFFFF
|
|
||||||
|
|
||||||
inline u8 *Memory_GetPtr(u32 _uAddress)
|
|
||||||
{
|
|
||||||
return g_VideoInitialize.pGetMemoryPointer(_uAddress);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline u8 Memory_Read_U8(u32 _uAddress)
|
|
||||||
{
|
|
||||||
return *g_VideoInitialize.pGetMemoryPointer(_uAddress);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline u16 Memory_Read_U16(u32 _uAddress)
|
|
||||||
{
|
|
||||||
return _byteswap_ushort(*(u16*)g_VideoInitialize.pGetMemoryPointer(_uAddress));
|
|
||||||
// return _byteswap_ushort(*(u16*)&g_pMemory[_uAddress & RAM_MASK]);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline u32 Memory_Read_U32(u32 _uAddress)
|
|
||||||
{
|
|
||||||
if (_uAddress == 0x020143a8)
|
|
||||||
{
|
|
||||||
int i =0;
|
|
||||||
}
|
|
||||||
return _byteswap_ulong(*(u32*)g_VideoInitialize.pGetMemoryPointer(_uAddress));
|
|
||||||
// return _byteswap_ulong(*(u32*)&g_pMemory[_uAddress & RAM_MASK]);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline float Memory_Read_Float(u32 _uAddress)
|
|
||||||
{
|
|
||||||
u32 uTemp = Memory_Read_U32(_uAddress);
|
|
||||||
return *(float*)&uTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -360,4 +360,40 @@ void VertexLoader::RunVertices(int count)
|
|||||||
this->m_counter = count;
|
this->m_counter = count;
|
||||||
((void (*)())((void*)&m_compiledCode[0]))();
|
((void (*)())((void*)&m_compiledCode[0]))();
|
||||||
}*/
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
DecodedVArray tempvarray;
|
||||||
|
|
||||||
|
namespace VertexLoaderManager
|
||||||
|
{
|
||||||
|
|
||||||
|
void Init()
|
||||||
|
{
|
||||||
|
tempvarray.Create(65536*3, 1, 8, 3, 2, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Shutdown()
|
||||||
|
{
|
||||||
|
tempvarray.Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetVertexSize(int vat)
|
||||||
|
{
|
||||||
|
VertexLoader& vtxLoader = g_VertexLoaders[vat];
|
||||||
|
vtxLoader.Setup();
|
||||||
|
return vtxLoader.GetVertexSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunVertices(int vat, int primitive, int num_vertices)
|
||||||
|
{
|
||||||
|
tempvarray.Reset();
|
||||||
|
VertexLoader::SetVArray(&tempvarray);
|
||||||
|
VertexLoader& vtxLoader = g_VertexLoaders[vat];
|
||||||
|
vtxLoader.Setup();
|
||||||
|
vtxLoader.PrepareRun();
|
||||||
|
int vsize = vtxLoader.GetVertexSize();
|
||||||
|
vtxLoader.RunVertices(num_vertices);
|
||||||
|
VertexManager::AddVertices(primitive, num_vertices, &tempvarray);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -191,5 +191,4 @@ public:
|
|||||||
extern VertexLoader g_VertexLoaders[8];
|
extern VertexLoader g_VertexLoaders[8];
|
||||||
extern DecodedVArray* varray;
|
extern DecodedVArray* varray;
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -30,6 +30,7 @@
|
|||||||
#include "TextureCache.h"
|
#include "TextureCache.h"
|
||||||
#include "BPStructs.h"
|
#include "BPStructs.h"
|
||||||
#include "VertexManager.h"
|
#include "VertexManager.h"
|
||||||
|
#include "VertexLoaderManager.h"
|
||||||
#include "TransformEngine.h"
|
#include "TransformEngine.h"
|
||||||
#include "DlgSettings.h"
|
#include "DlgSettings.h"
|
||||||
#include "D3DPostprocess.h"
|
#include "D3DPostprocess.h"
|
||||||
@ -90,7 +91,7 @@ void UpdateFPSDisplay(const char *text)
|
|||||||
{
|
{
|
||||||
char temp[512];
|
char temp[512];
|
||||||
sprintf_s(temp, 512, "SVN R%i: DX9: %s", SVN_REV, text);
|
sprintf_s(temp, 512, "SVN R%i: DX9: %s", SVN_REV, text);
|
||||||
SetWindowText( EmuWindow::GetWnd(), temp);
|
SetWindowText(EmuWindow::GetWnd(), temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -101,7 +102,7 @@ bool Init()
|
|||||||
if (initCount == 0)
|
if (initCount == 0)
|
||||||
{
|
{
|
||||||
// create the window
|
// create the window
|
||||||
if ( !g_Config.renderToMainframe || g_VideoInitialize.pWindowHandle == NULL ) // ignore parent for this plugin
|
if (!g_Config.renderToMainframe || g_VideoInitialize.pWindowHandle == NULL) // ignore parent for this plugin
|
||||||
{
|
{
|
||||||
g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create(NULL, g_hInstance, "Loading - Please wait.");
|
g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create(NULL, g_hInstance, "Loading - Please wait.");
|
||||||
}
|
}
|
||||||
@ -110,7 +111,7 @@ bool Init()
|
|||||||
g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create((HWND)g_VideoInitialize.pWindowHandle, g_hInstance, "Loading - Please wait.");
|
g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create((HWND)g_VideoInitialize.pWindowHandle, g_hInstance, "Loading - Please wait.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( g_VideoInitialize.pWindowHandle == NULL )
|
if (g_VideoInitialize.pWindowHandle == NULL)
|
||||||
{
|
{
|
||||||
MessageBox(GetActiveWindow(), "An error has occurred while trying to create the window.", "Fatal Error", MB_OK);
|
MessageBox(GetActiveWindow(), "An error has occurred while trying to create the window.", "Fatal Error", MB_OK);
|
||||||
return false;
|
return false;
|
||||||
@ -133,30 +134,27 @@ bool Init()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DeInit()
|
void DeInit()
|
||||||
{
|
{
|
||||||
initCount--;
|
initCount--;
|
||||||
if (initCount==0)
|
if (initCount == 0)
|
||||||
{
|
{
|
||||||
D3D::Shutdown();
|
D3D::Shutdown();
|
||||||
EmuWindow::Close();
|
EmuWindow::Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====================================================================================
|
|
||||||
|
|
||||||
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
|
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
|
||||||
{
|
{
|
||||||
_PluginInfo->Version = 0x0100;
|
_PluginInfo->Version = 0x0100;
|
||||||
_PluginInfo->Type = PLUGIN_TYPE_VIDEO;
|
_PluginInfo->Type = PLUGIN_TYPE_VIDEO;
|
||||||
#ifdef DEBUGFAST
|
#ifdef DEBUGFAST
|
||||||
sprintf_s(_PluginInfo->Name, 100, "Dolphin Direct3D9 Plugin (DebugFast)");
|
sprintf_s(_PluginInfo->Name, 100, "Dolphin Direct3D9 (DebugFast)");
|
||||||
#else
|
#else
|
||||||
#ifndef _DEBUG
|
#ifndef _DEBUG
|
||||||
sprintf_s(_PluginInfo->Name, 100, "Dolphin Direct3D9 Plugin");
|
sprintf_s(_PluginInfo->Name, 100, "Dolphin Direct3D9");
|
||||||
#else
|
#else
|
||||||
sprintf_s(_PluginInfo->Name, 100, "Dolphin Direct3D9 Plugin (Debug)");
|
sprintf_s(_PluginInfo->Name, 100, "Dolphin Direct3D9 (Debug)");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -215,16 +213,18 @@ void Video_Prepare(void)
|
|||||||
BPInit();
|
BPInit();
|
||||||
VertexManager::Init();
|
VertexManager::Init();
|
||||||
Fifo_Init();
|
Fifo_Init();
|
||||||
|
VertexLoaderManager::Init();
|
||||||
OpcodeDecoder_Init();
|
OpcodeDecoder_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Video_Shutdown(void)
|
void Video_Shutdown(void)
|
||||||
{
|
{
|
||||||
Fifo_Shutdown();
|
Fifo_Shutdown();
|
||||||
|
OpcodeDecoder_Shutdown();
|
||||||
VertexManager::Shutdown();
|
VertexManager::Shutdown();
|
||||||
TextureCache::Shutdown();
|
TextureCache::Shutdown();
|
||||||
Renderer::Shutdown();
|
Renderer::Shutdown();
|
||||||
OpcodeDecoder_Shutdown();
|
VertexLoaderManager::Shutdown();
|
||||||
DeInit();
|
DeInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,9 +256,9 @@ void DebugLog(const char* _fmt, ...)
|
|||||||
char Msg[512];
|
char Msg[512];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start( ap, _fmt );
|
va_start(ap, _fmt);
|
||||||
vsprintf( Msg, _fmt, ap );
|
vsprintf(Msg, _fmt, ap);
|
||||||
va_end( ap );
|
va_end(ap);
|
||||||
|
|
||||||
g_VideoInitialize.pLog(Msg, FALSE);
|
g_VideoInitialize.pLog(Msg, FALSE);
|
||||||
#endif
|
#endif
|
||||||
|
@ -788,10 +788,6 @@
|
|||||||
RelativePath=".\Src\VertexLoaderManager.cpp"
|
RelativePath=".\Src\VertexLoaderManager.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\Src\VertexLoaderManager.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Src\VertexManager.cpp"
|
RelativePath=".\Src\VertexManager.cpp"
|
||||||
>
|
>
|
||||||
|
@ -64,35 +64,6 @@ unsigned char memcmp_mmx(const void* src1, const void* src2, int cmpsize);
|
|||||||
#define memcmp_gc memcmp
|
#define memcmp_gc memcmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "main.h"
|
#include "VideoCommon.h"
|
||||||
|
|
||||||
inline u8 *Memory_GetPtr(u32 _uAddress)
|
|
||||||
{
|
|
||||||
return g_VideoInitialize.pGetMemoryPointer(_uAddress);//&g_pMemory[_uAddress & RAM_MASK];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline u8 Memory_Read_U8(u32 _uAddress)
|
|
||||||
{
|
|
||||||
return *(u8*)g_VideoInitialize.pGetMemoryPointer(_uAddress);//g_pMemory[_uAddress & RAM_MASK];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline u16 Memory_Read_U16(u32 _uAddress)
|
|
||||||
{
|
|
||||||
return Common::swap16(*(u16*)g_VideoInitialize.pGetMemoryPointer(_uAddress));
|
|
||||||
//return _byteswap_ushort(*(u16*)&g_pMemory[_uAddress & RAM_MASK]);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline u32 Memory_Read_U32(u32 _uAddress)
|
|
||||||
{
|
|
||||||
return Common::swap32(*(u32*)g_VideoInitialize.pGetMemoryPointer(_uAddress));
|
|
||||||
//return _byteswap_ulong(*(u32*)&g_pMemory[_uAddress & RAM_MASK]);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline float Memory_Read_Float(u32 _uAddress)
|
|
||||||
{
|
|
||||||
union {u32 i; float f;} temp;
|
|
||||||
temp.i = Memory_Read_U32(_uAddress);
|
|
||||||
return temp.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,18 +24,21 @@
|
|||||||
// and hope that the vertex format doesn't change, though, if you do it just when they are
|
// and hope that the vertex format doesn't change, though, if you do it just when they are
|
||||||
// called. The reason is that the vertex format affects the sizes of the vertices.
|
// called. The reason is that the vertex format affects the sizes of the vertices.
|
||||||
|
|
||||||
#include "Globals.h"
|
#include "Common.h"
|
||||||
|
#include "VideoCommon.h"
|
||||||
#include "Profiler.h"
|
#include "Profiler.h"
|
||||||
#include "OpcodeDecoding.h"
|
#include "OpcodeDecoding.h"
|
||||||
|
|
||||||
#include "VertexLoader.h"
|
#include "VertexLoader.h"
|
||||||
#include "VertexLoaderManager.h"
|
#include "VertexLoaderManager.h"
|
||||||
#include "VertexManager.h"
|
#include "VertexManager.h"
|
||||||
#include "VertexShaderManager.h"
|
|
||||||
|
|
||||||
#include "Statistics.h"
|
#include "Statistics.h"
|
||||||
|
|
||||||
#include "BPStructs.h"
|
#include "XFMemory.h"
|
||||||
|
#include "CPMemory.h"
|
||||||
|
#include "BPMemory.h"
|
||||||
|
|
||||||
#include "Fifo.h"
|
#include "Fifo.h"
|
||||||
#include "DataReader.h"
|
#include "DataReader.h"
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ static int nZBufferRender = 0; // if > 0, then use zbuffer render, and count dow
|
|||||||
// A framebuffer is a set of render targets: a color and a z buffer. They can be either RenderBuffers or Textures.
|
// A framebuffer is a set of render targets: a color and a z buffer. They can be either RenderBuffers or Textures.
|
||||||
static GLuint s_uFramebuffer = 0;
|
static GLuint s_uFramebuffer = 0;
|
||||||
|
|
||||||
// The size of these should be a (not necessarily even) multiple of the EFB size, 640x528, but isn't.
|
// The size of these should be a (not necessarily even) multiple of the EFB size, 640x528, but isn'.t
|
||||||
static GLuint s_RenderTarget = 0;
|
static GLuint s_RenderTarget = 0;
|
||||||
static GLuint s_DepthTarget = 0;
|
static GLuint s_DepthTarget = 0;
|
||||||
static GLuint s_ZBufferTarget = 0;
|
static GLuint s_ZBufferTarget = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user