D3D9: Delete some long dead code. Also add one more statistic: number of compiled shaders that actually have unique code (not accurate unless you delete the shader cache before running). This stat clearly shows that in f-zero we create 5x as many pixel shaders as we should, so there's clearly a problem with the shader ID generation.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5754 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2010-06-20 22:23:34 +00:00
parent 783390539d
commit 6a88241e64
28 changed files with 27 additions and 1647 deletions

View File

@ -15,7 +15,11 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <map>
#include <set>
#include "Common.h"
#include "Hash.h"
#include "FileUtil.h"
#include "LinearDiskCache.h"
@ -23,7 +27,6 @@
#include "D3DBase.h"
#include "D3DShader.h"
#include "Statistics.h"
#include "Utils.h"
#include "VideoConfig.h"
#include "PixelShaderGen.h"
#include "PixelShaderManager.h"
@ -38,7 +41,8 @@
PixelShaderCache::PSCache PixelShaderCache::PixelShaders;
const PixelShaderCache::PSCacheEntry *PixelShaderCache::last_entry;
LinearDiskCache g_ps_disk_cache;
static LinearDiskCache g_ps_disk_cache;
static std::set<u32> unique_shaders;
static float lastPSconstants[C_COLORMATRIX+16][4];
@ -47,7 +51,6 @@ static LPDIRECT3DPIXELSHADER9 s_ColorCopyProgram[3];
static LPDIRECT3DPIXELSHADER9 s_DepthMatrixProgram[3];
static LPDIRECT3DPIXELSHADER9 s_ClearProgram = 0;
LPDIRECT3DPIXELSHADER9 PixelShaderCache::GetColorMatrixProgram(int SSAAMode)
{
return s_ColorMatrixProgram[SSAAMode % 3];
@ -297,6 +300,8 @@ void PixelShaderCache::Shutdown()
Clear();
g_ps_disk_cache.Sync();
g_ps_disk_cache.Close();
unique_shaders.clear();
}
bool PixelShaderCache::SetShader(bool dstAlpha)
@ -338,6 +343,11 @@ bool PixelShaderCache::SetShader(bool dstAlpha)
// OK, need to generate and compile it.
const char *code = GeneratePixelShaderCode(PixelShaderManager::GetTextureMask(), dstAlpha, API_D3D9);
u32 code_hash = HashAdler32((const u8 *)code, strlen(code));
unique_shaders.insert(code_hash);
SETSTAT(stats.numUniquePixelShaders, unique_shaders.size());
#if defined(_DEBUG) || defined(DEBUGFAST)
if (g_ActiveConfig.iLog & CONF_SAVESHADERS && code) {
static int counter = 0;