From 4d169987c2f67652ffc30989407d1bc28a88cbdc Mon Sep 17 00:00:00 2001 From: hrydgard Date: Wed, 22 Oct 2008 22:35:29 +0000 Subject: [PATCH] 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 --- Source/Core/VideoCommon/Src/Profiler.h | 2 ++ .../Plugin_VideoDX9/Src/OpcodeDecoding.cpp | 29 +++++-------------- .../Plugins/Plugin_VideoOGL/Src/BPStructs.cpp | 4 +-- .../Plugin_VideoOGL/Src/OpcodeDecoding.cpp | 22 +++++++------- .../Src/PixelShaderManager.cpp | 1 + Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 2 +- .../Plugin_VideoOGL/Src/VertexLoader.cpp | 1 + .../Src/VertexLoader_Normal.cpp | 1 + .../Plugin_VideoOGL/Src/VertexManager.cpp | 8 ++--- 9 files changed, 30 insertions(+), 40 deletions(-) diff --git a/Source/Core/VideoCommon/Src/Profiler.h b/Source/Core/VideoCommon/Src/Profiler.h index 5cc8d55cd1..db7524bca6 100644 --- a/Source/Core/VideoCommon/Src/Profiler.h +++ b/Source/Core/VideoCommon/Src/Profiler.h @@ -48,6 +48,7 @@ void DVProfClear(); // clears all the profilers #endif #define DVSTARTPROFILE() DVProfileFunc _pf(__PRETTY_FUNCTION__); +#define DVSTARTSUBPROFILE(name) DVProfileFunc _pf(name); class DVProfileFunc { @@ -61,6 +62,7 @@ public: #else #define DVSTARTPROFILE() +#define DVSTARTSUBPROFILE(name) class DVProfileFunc { diff --git a/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.cpp b/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.cpp index d2beb01396..009893fa9d 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.cpp @@ -24,7 +24,6 @@ // 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. - #include "D3DBase.h" #include "Common.h" @@ -35,39 +34,25 @@ #include "OpcodeDecoding.h" #include "TextureCache.h" #include "ShaderManager.h" -#include "DecodedVArray.h" #include "BPStructs.h" #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; u8 *g_pVideoData = 0; extern u8* FAKE_GetFifoStartPtr(); extern u8* FAKE_GetFifoEndPtr(); -void Decode(); +static void Decode(); -template -void Xchg(T& a, T&b) -{ - T c = a; - a = b; - b = c; -} - -void ExecuteDisplayList(u32 address, u32 size) +static void ExecuteDisplayList(u32 address, u32 size) { u8* old_pVideoData = g_pVideoData; - + u8* startAddress = Memory_GetPtr(address); g_pVideoData = startAddress; @@ -88,7 +73,7 @@ void ExecuteDisplayList(u32 address, u32 size) g_pVideoData = old_pVideoData; } -bool FifoCommandRunnable(void) +bool FifoCommandRunnable() { u32 iBufferSize = (u32)(FAKE_GetFifoEndPtr()-g_pVideoData); if (iBufferSize == 0) @@ -224,15 +209,15 @@ bool FifoCommandRunnable(void) return true; } -void Decode(void) +static void Decode(void) { int Cmd = DataReadU8(); - switch(Cmd) + switch (Cmd) { case GX_NOP: break; - case GX_LOAD_CP_REG: //0x08 + case GX_LOAD_CP_REG: { u32 SubCmd = DataReadU8(); u32 Value = DataReadU32(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp b/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp index ea1a7e7f2f..a3eb7e569b 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp @@ -419,7 +419,7 @@ void BPWritten(int addr, int changes, int newval) case 0x52: { - DVProfileFunc _pf("LoadBPReg:swap"); + DVSTARTSUBPROFILE("LoadBPReg:swap"); VertexManager::Flush(); ((u32*)&bpmem)[addr] = newval; @@ -524,7 +524,7 @@ void BPWritten(int addr, int changes, int newval) case 0x65: //GXLoadTlut { - DVProfileFunc _pf("LoadBPReg:GXLoadTlut"); + DVSTARTSUBPROFILE("LoadBPReg:GXLoadTlut"); VertexManager::Flush(); ((u32*)&bpmem)[addr] = newval; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp b/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp index 694f207ff7..0891a8701f 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp @@ -27,25 +27,25 @@ #include "Globals.h" #include "Profiler.h" #include "OpcodeDecoding.h" + #include "VertexLoader.h" #include "VertexManager.h" #include "VertexShaderManager.h" + #include "Statistics.h" #include "BPStructs.h" #include "Fifo.h" #include "DataReader.h" -#define CMDBUFFER_SIZE 1024*1024 - u8* g_pVideoData = 0; extern u8* FAKE_GetFifoStartPtr(); 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; @@ -69,7 +69,7 @@ void ExecuteDisplayList(u32 address, u32 size) g_pVideoData = old_pVideoData; } -bool FifoCommandRunnable(void) +bool FifoCommandRunnable() { u32 iBufferSize = (u32)(FAKE_GetFifoEndPtr() - g_pVideoData); if (iBufferSize == 0) @@ -198,7 +198,7 @@ bool FifoCommandRunnable(void) return true; } -void Decode(void) +static void Decode() { int Cmd = DataReadU8(); switch(Cmd) @@ -230,16 +230,16 @@ void Decode(void) break; case GX_LOAD_INDX_A: //used for position matrices - VertexShaderMngr::LoadIndexedXF(DataReadU32(),0xC); + VertexShaderMngr::LoadIndexedXF(DataReadU32(), 0xC); break; case GX_LOAD_INDX_B: //used for normal matrices - VertexShaderMngr::LoadIndexedXF(DataReadU32(),0xD); + VertexShaderMngr::LoadIndexedXF(DataReadU32(), 0xD); break; case GX_LOAD_INDX_C: //used for postmatrices - VertexShaderMngr::LoadIndexedXF(DataReadU32(),0xE); + VertexShaderMngr::LoadIndexedXF(DataReadU32(), 0xE); break; case GX_LOAD_INDX_D: //used for lights - VertexShaderMngr::LoadIndexedXF(DataReadU32(),0xF); + VertexShaderMngr::LoadIndexedXF(DataReadU32(), 0xF); break; case GX_CMD_CALL_DL: @@ -268,7 +268,7 @@ void Decode(void) // draw primitives default: - if (Cmd&0x80) + if (Cmd & 0x80) { // load vertices (use computed vertex size from FifoCommandRunnable above) u16 numVertices = DataReadU16(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderManager.cpp index ad136da5f2..578df7cd86 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderManager.cpp @@ -26,6 +26,7 @@ #include #include "Statistics.h" +#include "Config.h" #include "ImageWrite.h" #include "Common.h" #include "Render.h" diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index d908cddd21..f386b67e15 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -688,7 +688,7 @@ void Renderer::Swap(const TRectangle& rc) { OpenGL_Update(); // just updates the render window position and the backbuffer size - DVProfileFunc _pf("Renderer::Swap"); + DVSTARTPROFILE(); Renderer::SetRenderMode(Renderer::RM_Normal); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp index 6d5b9c719d..380e31d926 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp @@ -21,6 +21,7 @@ #include #include "Common.h" +#include "Config.h" #include "ImageWrite.h" #include "x64Emitter.h" #include "ABI.h" diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Normal.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Normal.cpp index c792c59478..feef75af68 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Normal.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Normal.cpp @@ -16,6 +16,7 @@ // http://code.google.com/p/dolphin-emu/ #include "Globals.h" +#include "Config.h" #include "VertexLoader.h" #include "VertexManager.h" #include "VertexLoader_Normal.h" diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp index 245190eab8..fcb1a3c776 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp @@ -125,8 +125,8 @@ void VertexManager::Flush() _assert_(s_pCurBufferPointer != s_pBaseBufferPointer); #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, - xfregs.nNumChans, (int)xfregs.bEnableDualTexTransform, bpmem.ztex2.op, VertexShaderMngr::rawProjection[6]==0, + 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, bpmem.blendmode.colorupdate, bpmem.blendmode.alphaupdate, bpmem.zmode.updateenable); for (int i = 0; i < xfregs.nNumChans; ++i) { LitChannel* ch = &xfregs.colChans[i].color; @@ -163,7 +163,7 @@ void VertexManager::Flush() // set the textures { - DVProfileFunc _pf("VertexManager::Flush:textures"); + DVSTARTPROFILE("VertexManager::Flush:textures"); u32 usedtextures = 0; for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages + 1; ++i) { @@ -275,7 +275,7 @@ void VertexManager::Flush() std::ofstream fps(strfile); fps << ps->strprog.c_str(); sprintf(strfile, "frames/vs%.3d.txt", g_Config.iSaveTargetId); - ofstream fvs(strfile); + std::ofstream fvs(strfile); fvs << vs->strprog.c_str(); }