- D3D9: pass the correct API type to ValidatePixelShaderIDs
- don't load shader cache from disk in d3d9/11 if shader debugging is enabled (we won't have any info about the source shader code otherwise, etc) - dump shader source codes on safe UIDs mismatch Thanks to LordMark and [SS] for reporting those to me ;)
This commit is contained in:
parent
a021dd7b79
commit
5d075ce507
|
@ -271,6 +271,8 @@ void ValidatePixelShaderIDs(API_TYPE api, PIXELSHADERUIDSAFE old_id, const std::
|
|||
sprintf(szTemp, "%spsuid_mismatch_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), num_failures++);
|
||||
std::ofstream file(szTemp);
|
||||
file << msg;
|
||||
file << "\n\nOld shader code:\n" << old_code;
|
||||
file << "\n\nNew shader code:\n" << new_code;
|
||||
file.close();
|
||||
|
||||
PanicAlert("Unique pixel shader ID mismatch!\n\nReport this to the devs, along with the contents of %s.", szTemp);
|
||||
|
|
|
@ -121,6 +121,8 @@ void ValidateVertexShaderIDs(API_TYPE api, VERTEXSHADERUIDSAFE old_id, const std
|
|||
sprintf(szTemp, "%svsuid_mismatch_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), num_failures++);
|
||||
std::ofstream file(szTemp);
|
||||
file << msg;
|
||||
file << "\n\nOld shader code:\n" << old_code;
|
||||
file << "\n\nNew shader code:\n" << new_code;
|
||||
file.close();
|
||||
|
||||
PanicAlert("Unique pixel shader ID mismatch!\n\nReport this to the devs, along with the contents of %s.", szTemp);
|
||||
|
|
|
@ -412,6 +412,9 @@ void PixelShaderCache::Init()
|
|||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str());
|
||||
PixelShaderCacheInserter inserter;
|
||||
g_ps_disk_cache.OpenAndRead(cache_filename, inserter);
|
||||
|
||||
if (g_Config.bEnableShaderDebugging) // TODO: Hacks..
|
||||
Clear();
|
||||
}
|
||||
|
||||
// ONLY to be used during shutdown.
|
||||
|
|
|
@ -174,6 +174,9 @@ void VertexShaderCache::Init()
|
|||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str());
|
||||
VertexShaderCacheInserter inserter;
|
||||
g_vs_disk_cache.OpenAndRead(cache_filename, inserter);
|
||||
|
||||
if (g_Config.bEnableShaderDebugging) // TODO: Hacks..
|
||||
Clear();
|
||||
}
|
||||
|
||||
void VertexShaderCache::Clear()
|
||||
|
|
|
@ -283,6 +283,9 @@ void PixelShaderCache::Init()
|
|||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str());
|
||||
PixelShaderCacheInserter inserter;
|
||||
g_ps_disk_cache.OpenAndRead(cache_filename, inserter);
|
||||
|
||||
if (g_Config.bEnableShaderDebugging) // TODO: Hacks..
|
||||
Clear();
|
||||
}
|
||||
|
||||
// ONLY to be used during shutdown.
|
||||
|
@ -326,6 +329,7 @@ void PixelShaderCache::Shutdown()
|
|||
|
||||
bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
|
||||
{
|
||||
const API_TYPE api = ((D3D::GetCaps().PixelShaderVersion >> 8) & 0xFF) < 3 ? API_D3D9_SM20 : API_D3D9_SM30;
|
||||
PIXELSHADERUID uid;
|
||||
GetPixelShaderId(&uid, dstAlphaMode);
|
||||
|
||||
|
@ -334,7 +338,7 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
|
|||
{
|
||||
PSCache::const_iterator iter = PixelShaders.find(uid);
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE, true);
|
||||
ValidatePixelShaderIDs(API_D3D9, PixelShaders[uid].safe_uid, PixelShaders[uid].code, dstAlphaMode, components);
|
||||
ValidatePixelShaderIDs(api, PixelShaders[uid].safe_uid, PixelShaders[uid].code, dstAlphaMode, components);
|
||||
return (iter != PixelShaders.end() && iter->second.shader);
|
||||
}
|
||||
|
||||
|
@ -351,13 +355,13 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
|
|||
|
||||
if (entry.shader) D3D::SetPixelShader(entry.shader);
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE, true);
|
||||
ValidatePixelShaderIDs(API_D3D9, entry.safe_uid, entry.code, dstAlphaMode, components);
|
||||
ValidatePixelShaderIDs(api, entry.safe_uid, entry.code, dstAlphaMode, components);
|
||||
return (entry.shader != NULL);
|
||||
}
|
||||
|
||||
|
||||
// Need to compile a new shader
|
||||
const char *code = GeneratePixelShaderCode(dstAlphaMode, ((D3D::GetCaps().PixelShaderVersion >> 8) & 0xFF) < 3 ? API_D3D9_SM20 : API_D3D9_SM30, components);
|
||||
const char *code = GeneratePixelShaderCode(dstAlphaMode, api, components);
|
||||
|
||||
if (g_ActiveConfig.bEnableShaderDebugging)
|
||||
{
|
||||
|
|
|
@ -151,6 +151,9 @@ void VertexShaderCache::Init()
|
|||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str());
|
||||
VertexShaderCacheInserter inserter;
|
||||
g_vs_disk_cache.OpenAndRead(cache_filename, inserter);
|
||||
|
||||
if (g_Config.bEnableShaderDebugging) // TODO: Hacks..
|
||||
Clear();
|
||||
}
|
||||
|
||||
void VertexShaderCache::Clear()
|
||||
|
|
Loading…
Reference in New Issue