when dumping shaders from VertexManager.cpp, don't overwrite old ones.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4493 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-11-01 02:03:26 +00:00
parent 6c0c97cffe
commit b3553eb53c
1 changed files with 46 additions and 46 deletions

View File

@ -153,68 +153,68 @@ void AddVertices(int _primitive, int _numVertices)
AddIndices(_primitive, _numVertices); AddIndices(_primitive, _numVertices);
} }
inline void DumpBadShaders()
{
#if defined(_DEBUG) || defined(DEBUGFAST)
std::string error_shaders;
error_shaders.append(VertexShaderCache::GetCurrentShaderCode());
error_shaders.append(PixelShaderCache::GetCurrentShaderCode());
char filename[512] = "bad_shader_combo_0.txt";
int which = 0;
while (File::Exists(filename))
{
which++;
sprintf(filename, "bad_shader_combo_%i.txt", which);
}
File::WriteStringToFile(true, error_shaders, filename);
PanicAlert("DrawIndexedPrimitiveUP failed. Shaders written to %s", filename);
#endif
}
inline void Draw(int stride) inline void Draw(int stride)
{ {
if(IndexGenerator::GetNumTriangles() > 0) if(IndexGenerator::GetNumTriangles() > 0)
{ {
if (FAILED(D3D::dev->DrawIndexedPrimitiveUP( if (FAILED(D3D::dev->DrawIndexedPrimitiveUP(
D3DPT_TRIANGLELIST, D3DPT_TRIANGLELIST,
0, IndexGenerator::GetNumVerts(), IndexGenerator::GetNumTriangles(), 0, IndexGenerator::GetNumVerts(), IndexGenerator::GetNumTriangles(),
TIBuffer, TIBuffer,
D3DFMT_INDEX16, D3DFMT_INDEX16,
LocalVBuffer, LocalVBuffer,
stride))) stride)))
{ {
#if defined(_DEBUG) || defined(DEBUGFAST) DumpBadShaders();
std::string error_shaders; }
error_shaders.append(VertexShaderCache::GetCurrentShaderCode());
error_shaders.append(PixelShaderCache::GetCurrentShaderCode());
File::WriteStringToFile(true, error_shaders, "bad_shader_combo.txt");
PanicAlert("DrawIndexedPrimitiveUP failed. Shaders written to bad_shader_combo.txt.");
#endif
}
INCSTAT(stats.thisFrame.numIndexedDrawCalls); INCSTAT(stats.thisFrame.numIndexedDrawCalls);
} }
if(IndexGenerator::GetNumLines() > 0) if(IndexGenerator::GetNumLines() > 0)
{ {
if (FAILED(D3D::dev->DrawIndexedPrimitiveUP( if (FAILED(D3D::dev->DrawIndexedPrimitiveUP(
D3DPT_LINELIST, D3DPT_LINELIST,
0, IndexGenerator::GetNumVerts(), IndexGenerator::GetNumLines(), 0, IndexGenerator::GetNumVerts(), IndexGenerator::GetNumLines(),
LIBuffer, LIBuffer,
D3DFMT_INDEX16, D3DFMT_INDEX16,
LocalVBuffer, LocalVBuffer,
stride))) stride)))
{ {
#if defined(_DEBUG) || defined(DEBUGFAST) DumpBadShaders();
std::string error_shaders; }
error_shaders.append(VertexShaderCache::GetCurrentShaderCode());
error_shaders.append(PixelShaderCache::GetCurrentShaderCode());
File::WriteStringToFile(true, error_shaders, "bad_shader_combo.txt");
PanicAlert("DrawIndexedPrimitiveUP failed. Shaders written to bad_shader_combo.txt.");
#endif
}
INCSTAT(stats.thisFrame.numIndexedDrawCalls); INCSTAT(stats.thisFrame.numIndexedDrawCalls);
} }
if(IndexGenerator::GetNumPoints() > 0) if(IndexGenerator::GetNumPoints() > 0)
{ {
if (FAILED(D3D::dev->DrawIndexedPrimitiveUP( if (FAILED(D3D::dev->DrawIndexedPrimitiveUP(
D3DPT_POINTLIST, D3DPT_POINTLIST,
0, IndexGenerator::GetNumVerts(), IndexGenerator::GetNumPoints(), 0, IndexGenerator::GetNumVerts(), IndexGenerator::GetNumPoints(),
PIBuffer, PIBuffer,
D3DFMT_INDEX16, D3DFMT_INDEX16,
LocalVBuffer, LocalVBuffer,
stride))) stride)))
{ {
#if defined(_DEBUG) || defined(DEBUGFAST) DumpBadShaders();
std::string error_shaders; }
error_shaders.append(VertexShaderCache::GetCurrentShaderCode());
error_shaders.append(PixelShaderCache::GetCurrentShaderCode());
File::WriteStringToFile(true, error_shaders, "bad_shader_combo.txt");
PanicAlert("DrawIndexedPrimitiveUP failed. Shaders written to bad_shader_combo.txt.");
#endif
}
INCSTAT(stats.thisFrame.numIndexedDrawCalls); INCSTAT(stats.thisFrame.numIndexedDrawCalls);
} }
} }
void Flush() void Flush()