mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Some shader manager changes, to avoid a shader be re-generated / re-compiled again, and again, if it is failed at the first time. There used to be cases that a vertex shader was failed, and Dolphin tried to generate/compile it forever, and caused the entire game slow down. It maybe not the case anymore after recent changes.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4175 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -70,34 +70,39 @@ bool VertexShaderCache::SetShader(u32 components)
|
||||
{
|
||||
iter->second.frameCount = frameCount;
|
||||
const VSCacheEntry &entry = iter->second;
|
||||
D3D::dev->SetVertexShader(entry.shader);
|
||||
last_entry = &entry;
|
||||
|
||||
DEBUGGER_PAUSE_COUNT_N(NEXT_VERTEX_SHADER_CHANGE);
|
||||
return true;
|
||||
if (entry.shader)
|
||||
{
|
||||
D3D::dev->SetVertexShader(entry.shader);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *code = GenerateVertexShader(components, true);
|
||||
LPDIRECT3DVERTEXSHADER9 shader = D3D::CompileVertexShader(code, (int)strlen(code));
|
||||
|
||||
// Make an entry in the table
|
||||
VSCacheEntry entry;
|
||||
entry.shader = shader;
|
||||
entry.frameCount = frameCount;
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
entry.code = code;
|
||||
#endif
|
||||
vshaders[uid] = entry;
|
||||
last_entry = &vshaders[uid];
|
||||
INCSTAT(stats.numVertexShadersCreated);
|
||||
SETSTAT(stats.numVertexShadersAlive, (int)vshaders.size());
|
||||
if (shader)
|
||||
{
|
||||
// Make an entry in the table
|
||||
VSCacheEntry entry;
|
||||
entry.shader = shader;
|
||||
entry.frameCount = frameCount;
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
entry.code = code;
|
||||
#endif
|
||||
vshaders[uid] = entry;
|
||||
last_entry = &vshaders[uid];
|
||||
|
||||
D3D::dev->SetVertexShader(shader);
|
||||
|
||||
INCSTAT(stats.numVertexShadersCreated);
|
||||
SETSTAT(stats.numVertexShadersAlive, (int)vshaders.size());
|
||||
return true;
|
||||
}
|
||||
else if (g_Config.bShowShaderErrors)
|
||||
|
||||
if (g_Config.bShowShaderErrors)
|
||||
{
|
||||
PanicAlert("Failed to compile Vertex Shader:\n\n%s", code);
|
||||
}
|
||||
|
Reference in New Issue
Block a user