Fix debug mode build, fix some profile stuff to not get compiled when profiling is off, cleaned a bit.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@941 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2008-10-22 22:35:29 +00:00
parent 4b2c7310b7
commit 4d169987c2
9 changed files with 30 additions and 40 deletions

View File

@ -48,6 +48,7 @@ void DVProfClear(); // clears all the profilers
#endif #endif
#define DVSTARTPROFILE() DVProfileFunc _pf(__PRETTY_FUNCTION__); #define DVSTARTPROFILE() DVProfileFunc _pf(__PRETTY_FUNCTION__);
#define DVSTARTSUBPROFILE(name) DVProfileFunc _pf(name);
class DVProfileFunc class DVProfileFunc
{ {
@ -61,6 +62,7 @@ public:
#else #else
#define DVSTARTPROFILE() #define DVSTARTPROFILE()
#define DVSTARTSUBPROFILE(name)
class DVProfileFunc class DVProfileFunc
{ {

View File

@ -24,7 +24,6 @@
// 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 "D3DBase.h"
#include "Common.h" #include "Common.h"
@ -35,39 +34,25 @@
#include "OpcodeDecoding.h" #include "OpcodeDecoding.h"
#include "TextureCache.h" #include "TextureCache.h"
#include "ShaderManager.h" #include "ShaderManager.h"
#include "DecodedVArray.h"
#include "BPStructs.h" #include "BPStructs.h"
#include "XFStructs.h" #include "XFStructs.h"
#include "Utils.h" #include "Utils.h"
#include "main.h"
#include "Fifo.h" #include "Fifo.h"
#include "DataReader.h" #include "DataReader.h"
#include "DLCompiler.h"
#define CMDBUFFER_SIZE 1024*1024
DecodedVArray tempvarray; 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();
void Decode(); static void Decode();
template <class T> static void ExecuteDisplayList(u32 address, u32 size)
void Xchg(T& a, T&b)
{
T c = a;
a = b;
b = c;
}
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);
g_pVideoData = startAddress; g_pVideoData = startAddress;
@ -88,7 +73,7 @@ void ExecuteDisplayList(u32 address, u32 size)
g_pVideoData = old_pVideoData; g_pVideoData = old_pVideoData;
} }
bool FifoCommandRunnable(void) bool FifoCommandRunnable()
{ {
u32 iBufferSize = (u32)(FAKE_GetFifoEndPtr()-g_pVideoData); u32 iBufferSize = (u32)(FAKE_GetFifoEndPtr()-g_pVideoData);
if (iBufferSize == 0) if (iBufferSize == 0)
@ -224,15 +209,15 @@ bool FifoCommandRunnable(void)
return true; return true;
} }
void Decode(void) static void Decode(void)
{ {
int Cmd = DataReadU8(); int Cmd = DataReadU8();
switch(Cmd) switch (Cmd)
{ {
case GX_NOP: case GX_NOP:
break; break;
case GX_LOAD_CP_REG: //0x08 case GX_LOAD_CP_REG:
{ {
u32 SubCmd = DataReadU8(); u32 SubCmd = DataReadU8();
u32 Value = DataReadU32(); u32 Value = DataReadU32();

View File

@ -419,7 +419,7 @@ void BPWritten(int addr, int changes, int newval)
case 0x52: case 0x52:
{ {
DVProfileFunc _pf("LoadBPReg:swap"); DVSTARTSUBPROFILE("LoadBPReg:swap");
VertexManager::Flush(); VertexManager::Flush();
((u32*)&bpmem)[addr] = newval; ((u32*)&bpmem)[addr] = newval;
@ -524,7 +524,7 @@ void BPWritten(int addr, int changes, int newval)
case 0x65: //GXLoadTlut case 0x65: //GXLoadTlut
{ {
DVProfileFunc _pf("LoadBPReg:GXLoadTlut"); DVSTARTSUBPROFILE("LoadBPReg:GXLoadTlut");
VertexManager::Flush(); VertexManager::Flush();
((u32*)&bpmem)[addr] = newval; ((u32*)&bpmem)[addr] = newval;

View File

@ -27,25 +27,25 @@
#include "Globals.h" #include "Globals.h"
#include "Profiler.h" #include "Profiler.h"
#include "OpcodeDecoding.h" #include "OpcodeDecoding.h"
#include "VertexLoader.h" #include "VertexLoader.h"
#include "VertexManager.h" #include "VertexManager.h"
#include "VertexShaderManager.h" #include "VertexShaderManager.h"
#include "Statistics.h" #include "Statistics.h"
#include "BPStructs.h" #include "BPStructs.h"
#include "Fifo.h" #include "Fifo.h"
#include "DataReader.h" #include "DataReader.h"
#define CMDBUFFER_SIZE 1024*1024
u8* g_pVideoData = 0; u8* g_pVideoData = 0;
extern u8* FAKE_GetFifoStartPtr(); extern u8* FAKE_GetFifoStartPtr();
extern u8* FAKE_GetFifoEndPtr(); extern u8* FAKE_GetFifoEndPtr();
void Decode(); static void Decode();
void ExecuteDisplayList(u32 address, u32 size) static void ExecuteDisplayList(u32 address, u32 size)
{ {
u8* old_pVideoData = g_pVideoData; u8* old_pVideoData = g_pVideoData;
@ -69,7 +69,7 @@ void ExecuteDisplayList(u32 address, u32 size)
g_pVideoData = old_pVideoData; g_pVideoData = old_pVideoData;
} }
bool FifoCommandRunnable(void) bool FifoCommandRunnable()
{ {
u32 iBufferSize = (u32)(FAKE_GetFifoEndPtr() - g_pVideoData); u32 iBufferSize = (u32)(FAKE_GetFifoEndPtr() - g_pVideoData);
if (iBufferSize == 0) if (iBufferSize == 0)
@ -198,7 +198,7 @@ bool FifoCommandRunnable(void)
return true; return true;
} }
void Decode(void) static void Decode()
{ {
int Cmd = DataReadU8(); int Cmd = DataReadU8();
switch(Cmd) switch(Cmd)
@ -230,16 +230,16 @@ void Decode(void)
break; break;
case GX_LOAD_INDX_A: //used for position matrices case GX_LOAD_INDX_A: //used for position matrices
VertexShaderMngr::LoadIndexedXF(DataReadU32(),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(DataReadU32(),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(DataReadU32(),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(DataReadU32(),0xF); VertexShaderMngr::LoadIndexedXF(DataReadU32(), 0xF);
break; break;
case GX_CMD_CALL_DL: case GX_CMD_CALL_DL:
@ -268,7 +268,7 @@ void Decode(void)
// draw primitives // draw primitives
default: default:
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 = DataReadU16(); u16 numVertices = DataReadU16();

View File

@ -26,6 +26,7 @@
#include <cmath> #include <cmath>
#include "Statistics.h" #include "Statistics.h"
#include "Config.h"
#include "ImageWrite.h" #include "ImageWrite.h"
#include "Common.h" #include "Common.h"
#include "Render.h" #include "Render.h"

View File

@ -688,7 +688,7 @@ void Renderer::Swap(const TRectangle& rc)
{ {
OpenGL_Update(); // just updates the render window position and the backbuffer size OpenGL_Update(); // just updates the render window position and the backbuffer size
DVProfileFunc _pf("Renderer::Swap"); DVSTARTPROFILE();
Renderer::SetRenderMode(Renderer::RM_Normal); Renderer::SetRenderMode(Renderer::RM_Normal);

View File

@ -21,6 +21,7 @@
#include <assert.h> #include <assert.h>
#include "Common.h" #include "Common.h"
#include "Config.h"
#include "ImageWrite.h" #include "ImageWrite.h"
#include "x64Emitter.h" #include "x64Emitter.h"
#include "ABI.h" #include "ABI.h"

View File

@ -16,6 +16,7 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Globals.h" #include "Globals.h"
#include "Config.h"
#include "VertexLoader.h" #include "VertexLoader.h"
#include "VertexManager.h" #include "VertexManager.h"
#include "VertexLoader_Normal.h" #include "VertexLoader_Normal.h"

View File

@ -125,8 +125,8 @@ void VertexManager::Flush()
_assert_(s_pCurBufferPointer != s_pBaseBufferPointer); _assert_(s_pCurBufferPointer != s_pBaseBufferPointer);
#ifdef _DEBUG #ifdef _DEBUG
PRIM_LOG("frame%d:\ncomps=0x%x, texgen=%d, numchan=%d, dualtex=%d, ztex=%d, proj=%d, cole=%d, alpe=%d, ze=%d\n", g_Config.iSaveTargetId, s_prevcomponents, xfregs.numTexGens, PRIM_LOG("frame%d:\ncomps=0x%x, texgen=%d, numchan=%d, dualtex=%d, ztex=%d, cole=%d, alpe=%d, ze=%d\n", g_Config.iSaveTargetId, s_prevcomponents, xfregs.numTexGens,
xfregs.nNumChans, (int)xfregs.bEnableDualTexTransform, bpmem.ztex2.op, VertexShaderMngr::rawProjection[6]==0, xfregs.nNumChans, (int)xfregs.bEnableDualTexTransform, bpmem.ztex2.op,
bpmem.blendmode.colorupdate, bpmem.blendmode.alphaupdate, bpmem.zmode.updateenable); bpmem.blendmode.colorupdate, bpmem.blendmode.alphaupdate, bpmem.zmode.updateenable);
for (int i = 0; i < xfregs.nNumChans; ++i) { for (int i = 0; i < xfregs.nNumChans; ++i) {
LitChannel* ch = &xfregs.colChans[i].color; LitChannel* ch = &xfregs.colChans[i].color;
@ -163,7 +163,7 @@ void VertexManager::Flush()
// set the textures // set the textures
{ {
DVProfileFunc _pf("VertexManager::Flush:textures"); DVSTARTPROFILE("VertexManager::Flush:textures");
u32 usedtextures = 0; u32 usedtextures = 0;
for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages + 1; ++i) { for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages + 1; ++i) {
@ -275,7 +275,7 @@ void VertexManager::Flush()
std::ofstream fps(strfile); std::ofstream fps(strfile);
fps << ps->strprog.c_str(); fps << ps->strprog.c_str();
sprintf(strfile, "frames/vs%.3d.txt", g_Config.iSaveTargetId); sprintf(strfile, "frames/vs%.3d.txt", g_Config.iSaveTargetId);
ofstream fvs(strfile); std::ofstream fvs(strfile);
fvs << vs->strprog.c_str(); fvs << vs->strprog.c_str();
} }