mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
D3D9: Fix issue where the shader caches were lost whenever the render window was resized. Add some error logging to LinearDiskCache. + some minor cleanup.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5747 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -333,12 +333,10 @@ void GFXDebuggerDX9::OnClearTextureCacheButton(wxCommandEvent& event)
|
||||
|
||||
void GFXDebuggerDX9::OnClearVertexShaderCacheButton(wxCommandEvent& event)
|
||||
{
|
||||
VertexShaderCache::Clear();
|
||||
}
|
||||
|
||||
void GFXDebuggerDX9::OnClearPixelShaderCacheButton(wxCommandEvent& event)
|
||||
{
|
||||
PixelShaderCache::Clear();
|
||||
}
|
||||
|
||||
void UpdateFPSDisplay(const char *text);
|
||||
|
@ -297,8 +297,8 @@ void GFXConfigDialogDX::CreateGUIControls()
|
||||
m_OverlayFPS = new wxCheckBox( m_PageAdvanced, ID_OVERLAYFPS, wxT("Overlay FPS Counter"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_CopyEFB = new wxCheckBox( m_PageAdvanced, ID_ENABLEEFBCOPY, wxT("Enable EFB Copy"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_EnableHotkeys = new wxCheckBox( m_PageAdvanced, ID_ENABLEHOTKEY, wxT("Enable Hotkey"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_Radio_CopyEFBToRAM = new wxRadioButton( m_PageAdvanced, ID_EFBTORAM, wxT("To Ram"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_Radio_CopyEFBToGL = new wxRadioButton( m_PageAdvanced, ID_EFBTOTEX, wxT("To Texture"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_Radio_CopyEFBToRAM = new wxRadioButton( m_PageAdvanced, ID_EFBTORAM, wxT("To RAM (accuracy)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_Radio_CopyEFBToGL = new wxRadioButton( m_PageAdvanced, ID_EFBTOTEX, wxT("To Texture (performance, resolution)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_WireFrame = new wxCheckBox( m_PageAdvanced, ID_WIREFRAME, wxT("Enable Wireframe"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_EnableRealXFB = new wxCheckBox( m_PageAdvanced, ID_ENABLEREALXFB, wxT("Enable Real XFB"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_EnableXFB = new wxCheckBox( m_PageAdvanced, ID_ENABLEXFB, wxT("Enable XFB"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
@ -258,6 +258,9 @@ void PixelShaderCache::Init()
|
||||
if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX)))
|
||||
File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX));
|
||||
|
||||
SETSTAT(stats.numPixelShadersCreated, 0);
|
||||
SETSTAT(stats.numPixelShadersAlive, 0);
|
||||
|
||||
char cache_filename[MAX_PATH];
|
||||
sprintf(cache_filename, "%sdx9-%s-ps.cache", File::GetUserPath(D_SHADERCACHE_IDX), globals->unique_id);
|
||||
PixelShaderCacheInserter inserter;
|
||||
|
@ -54,11 +54,10 @@ private:
|
||||
|
||||
static PSCache PixelShaders;
|
||||
static const PSCacheEntry *last_entry;
|
||||
|
||||
static void Clear();
|
||||
|
||||
public:
|
||||
static void Init();
|
||||
static void Clear();
|
||||
static void Shutdown();
|
||||
static bool SetShader(bool dstAlpha);
|
||||
static bool InsertByteCode(const PIXELSHADERUID &uid, const u8 *bytecode, int bytecodelen, bool activate);
|
||||
|
@ -225,8 +225,12 @@ void SetupDeviceObjects()
|
||||
VertexShaderManager::Dirty();
|
||||
PixelShaderManager::Dirty();
|
||||
TextureConverter::Init();
|
||||
// Tex and shader caches will recreate themselves over time.
|
||||
|
||||
// To avoid shader compilation stutters, read back all shaders from cache.
|
||||
VertexShaderCache::Init();
|
||||
PixelShaderCache::Init();
|
||||
|
||||
// Texture cache will recreate themselves over time.
|
||||
}
|
||||
|
||||
// Kill off all POOL_DEFAULT device objects.
|
||||
@ -241,8 +245,8 @@ void TeardownDeviceObjects()
|
||||
D3D::font.Shutdown();
|
||||
TextureCache::Invalidate(false);
|
||||
VertexLoaderManager::Shutdown();
|
||||
VertexShaderCache::Clear();
|
||||
PixelShaderCache::Clear();
|
||||
VertexShaderCache::Shutdown();
|
||||
PixelShaderCache::Shutdown();
|
||||
TextureConverter::Shutdown();
|
||||
}
|
||||
|
||||
@ -499,7 +503,6 @@ void CheckForResize()
|
||||
{
|
||||
Sleep(10);
|
||||
}
|
||||
|
||||
|
||||
if (EmuWindow::GetParentWnd())
|
||||
{
|
||||
|
@ -214,6 +214,9 @@ void VertexShaderCache::Init()
|
||||
if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX)))
|
||||
File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX));
|
||||
|
||||
SETSTAT(stats.numVertexShadersCreated, 0);
|
||||
SETSTAT(stats.numVertexShadersAlive, 0);
|
||||
|
||||
char cache_filename[MAX_PATH];
|
||||
sprintf(cache_filename, "%sdx9-%s-vs.cache", File::GetUserPath(D_SHADERCACHE_IDX), globals->unique_id);
|
||||
VertexShaderCacheInserter inserter;
|
||||
@ -234,7 +237,7 @@ void VertexShaderCache::Clear()
|
||||
|
||||
void VertexShaderCache::Shutdown()
|
||||
{
|
||||
for (int i = 0; i<3;i++)
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (SimpleVertexShader[i])
|
||||
SimpleVertexShader[i]->Release();
|
||||
@ -245,7 +248,6 @@ void VertexShaderCache::Shutdown()
|
||||
ClearVertexShader->Release();
|
||||
ClearVertexShader = NULL;
|
||||
|
||||
|
||||
Clear();
|
||||
g_vs_disk_cache.Sync();
|
||||
g_vs_disk_cache.Close();
|
||||
|
@ -49,10 +49,10 @@ private:
|
||||
|
||||
static VSCache vshaders;
|
||||
static const VSCacheEntry *last_entry;
|
||||
static void Clear();
|
||||
|
||||
public:
|
||||
static void Init();
|
||||
static void Clear();
|
||||
static void Shutdown();
|
||||
static bool SetShader(u32 components);
|
||||
static LPDIRECT3DVERTEXSHADER9 GetSimpleVertexShader(int level);
|
||||
|
@ -287,9 +287,7 @@ void Video_Prepare()
|
||||
Fifo_Init();
|
||||
VertexLoaderManager::Init();
|
||||
OpcodeDecoder_Init();
|
||||
VertexShaderCache::Init();
|
||||
VertexShaderManager::Init();
|
||||
PixelShaderCache::Init();
|
||||
PixelShaderManager::Init();
|
||||
CommandProcessor::Init();
|
||||
PixelEngine::Init();
|
||||
@ -307,9 +305,7 @@ void Shutdown()
|
||||
CommandProcessor::Shutdown();
|
||||
VertexManager::Shutdown();
|
||||
VertexLoaderManager::Shutdown();
|
||||
VertexShaderCache::Shutdown();
|
||||
VertexShaderManager::Shutdown();
|
||||
PixelShaderCache::Shutdown();
|
||||
PixelShaderManager::Shutdown();
|
||||
TextureCache::Shutdown();
|
||||
OpcodeDecoder_Shutdown();
|
||||
|
Reference in New Issue
Block a user