Move out Cg shader generators to VideoCommon (hope to use this in the DX plugin in the future). Also move out stats code. Comment a lot and cleanup. Kill DX9 Globals.cpp.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@938 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2008-10-22 20:54:40 +00:00
parent 32820d2036
commit 39df6c5624
41 changed files with 416 additions and 416 deletions
@@ -115,7 +115,7 @@ void CBreakPointView::DeleteCurrentSelection()
int Item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (Item >= 0)
{
u32 Address = GetItemData(Item);
u32 Address = (u32)GetItemData(Item);
CBreakPoints::DeleteElementByAddress(Address);
}
}
@@ -15,8 +15,6 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Globals.h"
#include <stdio.h>
#include <cmath>
#include <assert.h>
@@ -429,14 +427,16 @@ char *GeneratePixelShader(u32 texture_mask, bool has_zbuffer_target, bool bRende
}
else {
if (!bRenderZToCol0) {
/* NEEDS FIX - dstalpha does not change how fragments are blended with the EFB
/* donkopunchstania: NEEDS FIX - dstalpha does not change how fragments are blended with the EFB
once the blending is done, the dstalpha is written to the EFB in place of the
fragment alpha if dstalpha is enabled. this only matters if the EFB supports alpha.
Commenting this out fixed Metroids but causes glitches in Super Mario Sunshine.
if (bpmem.dstalpha.enable)
WRITE(p, " ocol0 = float4(prev.rgb,"I_ALPHA"[0].w);\n");
else*/
WRITE(p, " ocol0 = prev;\n");
else
*/
WRITE(p, " ocol0 = prev;\n");
}
}
+3
View File
@@ -9,6 +9,9 @@ files = [
"TextureDecoder.cpp",
"XFMemory.cpp",
"XFBConvert.cpp",
"PixelShader.cpp",
"VertexShader.cpp",
"Statistics.cpp",
"Fifo.cpp",
"VideoState.cpp",
"Profiler.cpp",
@@ -0,0 +1,43 @@
// 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/
#include <string.h>
#include "Statistics.h"
Statistics stats;
template <class T>
void Xchg(T& a, T&b)
{
T c = a;
a = b;
b = c;
}
void Statistics::ResetFrame()
{
memset(&thisFrame, 0, sizeof(ThisFrame));
}
void Statistics::SwapDL()
{
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);
}
@@ -15,56 +15,8 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _GLOBALS_H
#define _GLOBALS_H
#include <string>
struct Config
{
Config();
void Load();
void Save();
int iAdapter;
int iFSResolution;
int iMultisampleMode;
int iPostprocessEffect;
int iCompileDLsLevel;
bool renderToMainframe;
bool bFullscreen;
bool bVsync;
bool bWireFrame;
bool bOverlayStats;
bool bDumpTextures;
bool bOldCard;
bool bShowShaderErrors;
//enhancements
bool bForceFiltering;
bool bForceMaxAniso;
bool bPreUpscale;
int iPreUpscaleFilter;
bool bTruform;
int iTruformLevel;
int iWindowedRes;
char psProfile[16];
char vsProfile[16];
bool bTexFmtOverlayEnable;
bool bTexFmtOverlayCenter;
std::string texDumpPath;
};
extern Config g_Config;
#ifndef _STATISTICS_H
#define _STATISTICS_H
struct Statistics
{
@@ -101,12 +53,12 @@ struct Statistics
int numDLPrims;
int numPrims;
int numShaderChanges;
int numBadCommands; //hope this always is zero ;)
int numDListsCalled;
};
ThisFrame thisFrame;
void ResetFrame() {memset(&thisFrame,0,sizeof(ThisFrame));}
void ResetFrame();
static void SwapDL();
};
extern Statistics stats;
@@ -116,11 +68,11 @@ extern Statistics stats;
#ifdef STATISTICS
#define INCSTAT(a) (a)++;
#define ADDSTAT(a,b) (a)+=(b);
#define SETSTAT(a,x) (a)=(x);
#define SETSTAT(a,x) (a)=(int)(x);
#else
#define INCSTAT(a) ;
#define ADDSTAT(a,b) ;
#define SETSTAT(a,x) ;
#endif
#endif
#endif // _STATISTICS_H
@@ -15,16 +15,12 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Globals.h"
#include "Profiler.h"
#include <math.h>
#include "BPStructs.h"
#include "BPMemory.h"
#include "VertexShader.h"
// This is the tricky one to get rid off.
// #include "VertexLoader.h"
static char text[16384];
#define WRITE p+=sprintf
@@ -36,7 +36,8 @@ enum {
VB_HAS_TEXMTXIDX6=(1<<8),
VB_HAS_TEXMTXIDX7=(1<<9),
VB_HAS_TEXMTXIDXALL=(0xff<<2),
//VB_HAS_POS=0, // Implied, it always has pos! don't bother testing
//VB_HAS_POS=0, // Implied, it always has pos! don't bother testing
VB_HAS_NRM0=(1<<10),
VB_HAS_NRM1=(1<<11),
VB_HAS_NRM2=(1<<12),
+2 -1
View File
@@ -22,9 +22,10 @@
void InitXFBConvTables();
// Converts 4:2:2 YUV (YUYV) data to 32-bit RGBA data.
void ConvertFromXFB(u32 *dst, const u8* _pXFB, int width, int height);
// converts 32-bit RGBA data to 16-bit 4:2:2 YUV data
// Converts 32-bit RGBA data to 4:2:2 YUV (YUYV) data.
void ConvertToXFB(u32 *dst, const u8* _pEFB, int width, int height);
#endif
+54 -22
View File
@@ -411,22 +411,54 @@
<References>
</References>
<Files>
<File
RelativePath=".\Src\BPMemory.cpp"
<Filter
Name="ShaderGenerators"
>
</File>
<File
RelativePath=".\Src\BPMemory.h"
<File
RelativePath=".\Src\PixelShader.cpp"
>
</File>
<File
RelativePath=".\Src\PixelShader.h"
>
</File>
<File
RelativePath=".\Src\VertexShader.cpp"
>
</File>
<File
RelativePath=".\Src\VertexShader.h"
>
</File>
</Filter>
<Filter
Name="Sections"
>
</File>
<File
RelativePath=".\Src\CPMemory.cpp"
>
</File>
<File
RelativePath=".\Src\CPMemory.h"
>
</File>
<File
RelativePath=".\Src\BPMemory.cpp"
>
</File>
<File
RelativePath=".\Src\BPMemory.h"
>
</File>
<File
RelativePath=".\Src\CPMemory.cpp"
>
</File>
<File
RelativePath=".\Src\CPMemory.h"
>
</File>
<File
RelativePath=".\Src\XFMemory.cpp"
>
</File>
<File
RelativePath=".\Src\XFMemory.h"
>
</File>
</Filter>
<File
RelativePath=".\Src\DataReader.h"
>
@@ -463,6 +495,14 @@
RelativePath=".\Src\SConscript"
>
</File>
<File
RelativePath=".\Src\Statistics.cpp"
>
</File>
<File
RelativePath=".\Src\Statistics.h"
>
</File>
<File
RelativePath=".\Src\TextureDecoder.cpp"
>
@@ -503,14 +543,6 @@
RelativePath=".\Src\XFBConvert.h"
>
</File>
<File
RelativePath=".\Src\XFMemory.cpp"
>
</File>
<File
RelativePath=".\Src\XFMemory.h"
>
</File>
</Files>
<Globals>
</Globals>
@@ -1375,11 +1375,11 @@
</File>
</Filter>
<File
RelativePath=".\Src\Globals.cpp"
RelativePath=".\Src\Config.cpp"
>
</File>
<File
RelativePath=".\Src\Globals.h"
RelativePath=".\Src\Config.h"
>
</File>
<File
@@ -17,7 +17,7 @@
#include "D3DBase.h"
#include "Globals.h"
#include "Config.h"
#include "Common.h"
#include "Profiler.h"
#include "BPStructs.h"
@@ -15,7 +15,7 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Globals.h"
#include "Config.h"
#include "IniFile.h"
Config g_Config;
@@ -80,5 +80,3 @@ void Config::Save()
iniFile.Set("Enhancements", "ForceMaxAniso", bForceMaxAniso);
iniFile.Save("gfx_dx9.ini");
}
Statistics stats;
@@ -0,0 +1,67 @@
// 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 _GLOBALS_H
#define _GLOBALS_H
#include <string>
struct Config
{
Config();
void Load();
void Save();
int iAdapter;
int iFSResolution;
int iMultisampleMode;
int iPostprocessEffect;
int iCompileDLsLevel;
bool renderToMainframe;
bool bFullscreen;
bool bVsync;
bool bWireFrame;
bool bOverlayStats;
bool bDumpTextures;
bool bOldCard;
bool bShowShaderErrors;
//enhancements
bool bForceFiltering;
bool bForceMaxAniso;
bool bPreUpscale;
int iPreUpscaleFilter;
bool bTruform;
int iTruformLevel;
int iWindowedRes;
char psProfile[16];
char vsProfile[16];
bool bTexFmtOverlayEnable;
bool bTexFmtOverlayCenter;
std::string texDumpPath;
};
extern Config g_Config;
#endif
@@ -21,7 +21,7 @@
#include "D3DTexture.h"
#include "D3DUtil.h"
#include "Globals.h"
#include "Config.h"
#include "Render.h"
@@ -18,7 +18,7 @@
#include <d3dx9.h>
#include <string>
#include "Globals.h"
#include "Config.h"
#include "D3DShader.h"
@@ -24,7 +24,7 @@
#include "D3DBase.h"
#include "D3DPostprocess.h"
#include "Globals.h"
#include "Config.h"
#include "TextureCache.h"
@@ -2,7 +2,7 @@
#include <windows.h>
#include "../../Core/Src/Core.h"
#include "Globals.h"
#include "Config.h"
#include "main.h"
#include "EmuWindow.h"
@@ -28,8 +28,8 @@
#include "D3DBase.h"
#include "Common.h"
#include "Statistics.h"
#include "Profiler.h"
#include "Globals.h"
#include "VertexHandler.h"
#include "TransformEngine.h"
#include "OpcodeDecoding.h"
@@ -72,10 +72,7 @@ void ExecuteDisplayList(u32 address, u32 size)
g_pVideoData = startAddress;
// 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);
Statistics::SwapDL();
while((u32)(g_pVideoData - startAddress) < size)
{
@@ -85,10 +82,7 @@ void ExecuteDisplayList(u32 address, u32 size)
INCSTAT(stats.thisFrame.numDListsCalled);
// un-swap
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);
Statistics::SwapDL();
// reset to the old pointer
g_pVideoData = old_pVideoData;
@@ -15,7 +15,6 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Globals.h"
#include "PixelShader.h"
#include "BPStructs.h"
#include "XFStructs.h"

Some files were not shown because too many files have changed in this diff Show More