diff --git a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp index c9f6605796..45e239a835 100644 --- a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp @@ -557,7 +557,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con { wxGridSizer* const szr_misc = new wxGridSizer(2, 5, 5); - szr_misc->Add(CreateCheckBox(page_advanced, _("Hide Shader Errors"), wxGetTranslation(shader_errors_desc), vconfig.bShowShaderErrors, true)); szr_misc->Add(CreateCheckBox(page_advanced, _("Show Input Display"), wxGetTranslation(show_input_display_desc), vconfig.bShowInputDisplay)); szr_misc->Add(CreateCheckBox(page_advanced, _("Crop"), wxGetTranslation(crop_desc), vconfig.bCrop)); szr_misc->Add(CreateCheckBox(page_advanced, _("Enable Hotkeys"), wxGetTranslation(hotkeys_desc), vconfig.bOSDHotKey)); diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index c04e57beae..8bad7b005a 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -81,7 +81,6 @@ void VideoConfig::Load(const char *ini_file) iniFile.Get("Settings", "EnablePixelLighting", &bEnablePixelLighting, 0); iniFile.Get("Settings", "EnablePerPixelDepth", &bEnablePerPixelDepth, 0); - iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 1); iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0); iniFile.Get("Settings", "EFBScale", &iEFBScale, 2); // native @@ -219,7 +218,6 @@ void VideoConfig::Save(const char *ini_file) iniFile.Set("Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions); - iniFile.Set("Settings", "ShowShaderErrors", bShowShaderErrors); iniFile.Set("Settings", "MSAA", iMultisampleMode); iniFile.Set("Settings", "EFBScale", iEFBScale); iniFile.Set("Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable); diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index b90d6c4b60..92a8b67741 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -143,7 +143,6 @@ struct VideoConfig //currently unused: int iCompileDLsLevel; - bool bShowShaderErrors; // D3D only config, mostly to be merged into the above int iAdapter; diff --git a/Source/Plugins/Plugin_VideoDX11/Src/D3DShader.cpp b/Source/Plugins/Plugin_VideoDX11/Src/D3DShader.cpp index 8e02a6db59..41e5423990 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/D3DShader.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/D3DShader.cpp @@ -34,10 +34,8 @@ ID3D11VertexShader* CreateVertexShaderFromByteCode(const void* bytecode, unsigne ID3D11VertexShader* v_shader; HRESULT hr = D3D::device->CreateVertexShader(bytecode, len, NULL, &v_shader); if (FAILED(hr)) - { - PanicAlert("CreateVertexShaderFromByteCode failed from %p (size %d) at %s %d\n", bytecode, len, __FILE__, __LINE__); - v_shader = NULL; - } + return NULL; + return v_shader; } @@ -63,15 +61,17 @@ bool CompileVertexShader(const char* code, unsigned int len, D3DBlob** blob) if (FAILED(hr)) { - if (g_ActiveConfig.bShowShaderErrors) - { - std::string msg = (char*)errorBuffer->GetBufferPointer(); - msg += "\n\n"; - msg += D3D::VertexShaderVersionString(); - msg += "\n\n"; - msg += code; - MessageBoxA(0, msg.c_str(), "Error compiling vertex shader", MB_ICONERROR); - } + static int num_failures = 0; + char szTemp[MAX_PATH]; + sprintf(szTemp, "%sbad_vs_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), num_failures++); + std::ofstream file(szTemp); + file << code; + file.close(); + + PanicAlert("Failed to compile vertex shader!\nThis usually happens when trying to use Dolphin with an outdated GPU or integrated GPU like the Intel GMA series.\n\nIf you're sure this is Dolphin's error anyway, post the contents of %s along with this error message at the forums.\n\nDebug info (%s):\n%s", + szTemp, + D3D::VertexShaderVersionString(), + (char*)errorBuffer->GetBufferPointer()); *blob = NULL; errorBuffer->Release(); @@ -90,10 +90,8 @@ ID3D11GeometryShader* CreateGeometryShaderFromByteCode(const void* bytecode, uns ID3D11GeometryShader* g_shader; HRESULT hr = D3D::device->CreateGeometryShader(bytecode, len, NULL, &g_shader); if (FAILED(hr)) - { - PanicAlert("CreateGeometryShaderFromByteCode failed from %p (size %d) at %s %d\n", bytecode, len, __FILE__, __LINE__); - g_shader = NULL; - } + return NULL; + return g_shader; } @@ -120,15 +118,17 @@ bool CompileGeometryShader(const char* code, unsigned int len, D3DBlob** blob, if (FAILED(hr)) { - if (g_ActiveConfig.bShowShaderErrors) - { - std::string msg = (char*)errorBuffer->GetBufferPointer(); - msg += "\n\n"; - msg += D3D::GeometryShaderVersionString(); - msg += "\n\n"; - msg += code; - MessageBoxA(0, msg.c_str(), "Error compiling geometry shader", MB_ICONERROR); - } + static int num_failures = 0; + char szTemp[MAX_PATH]; + sprintf(szTemp, "%sbad_gs_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), num_failures++); + std::ofstream file(szTemp); + file << code; + file.close(); + + PanicAlert("Failed to compile geometry shader!\nThis usually happens when trying to use Dolphin with an outdated GPU or integrated GPU like the Intel GMA series.\n\nIf you're sure this is Dolphin's error anyway, post the contents of %s along with this error message at the forums.\n\nDebug info (%s):\n%s", + szTemp, + D3D::GeometryShaderVersionString(), + (char*)errorBuffer->GetBufferPointer()); *blob = NULL; errorBuffer->Release(); @@ -177,15 +177,17 @@ bool CompilePixelShader(const char* code, unsigned int len, D3DBlob** blob, if (FAILED(hr)) { - if (g_ActiveConfig.bShowShaderErrors) - { - std::string msg = (char*)errorBuffer->GetBufferPointer(); - msg += "\n\n"; - msg += D3D::PixelShaderVersionString(); - msg += "\n\n"; - msg += code; - MessageBoxA(0, msg.c_str(), "Error compiling pixel shader", MB_ICONERROR); - } + static int num_failures = 0; + char szTemp[MAX_PATH]; + sprintf(szTemp, "%sbad_ps_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), num_failures++); + std::ofstream file(szTemp); + file << code; + file.close(); + + PanicAlert("Failed to compile pixel shader!\nThis usually happens when trying to use Dolphin with an outdated GPU or integrated GPU like the Intel GMA series.\n\nIf you're sure this is Dolphin's error anyway, post the contents of %s along with this error message at the forums.\n\nDebug info (%s):\n%s", + szTemp, + D3D::PixelShaderVersionString(), + (char*)errorBuffer->GetBufferPointer()); *blob = NULL; errorBuffer->Release(); @@ -209,7 +211,6 @@ ID3D11VertexShader* CompileAndCreateVertexShader(const char* code, blob->Release(); return v_shader; } - PanicAlert("Failed to compile and create vertex shader from %p (size %d) at %s %d\n", code, len, __FILE__, __LINE__); return NULL; } @@ -223,7 +224,6 @@ ID3D11GeometryShader* CompileAndCreateGeometryShader(const char* code, blob->Release(); return g_shader; } - PanicAlert("Failed to compile and create geometry shader from %p (size %d) at %s %d\n", code, len, __FILE__, __LINE__); return NULL; } @@ -238,7 +238,6 @@ ID3D11PixelShader* CompileAndCreatePixelShader(const char* code, blob->Release(); return p_shader; } - PanicAlert("Failed to compile and create pixel shader, %s %d\n", __FILE__, __LINE__); return NULL; } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DShader.cpp b/Source/Plugins/Plugin_VideoDX9/Src/D3DShader.cpp index b2bb44a920..9c17c3df8c 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/D3DShader.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DShader.cpp @@ -33,10 +33,8 @@ LPDIRECT3DVERTEXSHADER9 CreateVertexShaderFromByteCode(const u8 *bytecode, int l LPDIRECT3DVERTEXSHADER9 v_shader; HRESULT hr = D3D::dev->CreateVertexShader((DWORD *)bytecode, &v_shader); if (FAILED(hr)) - { - PanicAlert("CreateVertexShaderFromByteCode failed from %p (size %d) at %s %d\n", bytecode, len, __FILE__, __LINE__); - v_shader = NULL; - } + return NULL; + return v_shader; } @@ -49,17 +47,22 @@ bool CompileVertexShader(const char *code, int len, u8 **bytecode, int *bytecode 0, &shaderBuffer, &errorBuffer, 0); if (FAILED(hr)) { - //compilation error - if (g_ActiveConfig.bShowShaderErrors) { - std::string hello = (char*)errorBuffer->GetBufferPointer(); - hello += "\n\n"; - hello += code; - MessageBoxA(0, hello.c_str(), "Error compiling vertex shader", MB_ICONERROR); - } - *bytecode = 0; + static int num_failures = 0; + char szTemp[MAX_PATH]; + sprintf(szTemp, "%sbad_vs_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), num_failures++); + std::ofstream file(szTemp); + file << code; + file.close(); + + PanicAlert("Failed to compile vertex shader!\nThis usually happens when trying to use Dolphin with an outdated GPU or integrated GPU like the Intel GMA series.\n\nIf you're sure this is Dolphin's error anyway, post the contents of %s along with this error message at the forums.\n\nDebug info (%s):\n%s", + szTemp, + D3D::VertexShaderVersionString(), + (char*)errorBuffer->GetBufferPointer()); + + *bytecode = NULL; *bytecodelen = 0; } - else if (SUCCEEDED(hr)) + else { *bytecodelen = shaderBuffer->GetBufferSize(); *bytecode = new u8[*bytecodelen]; @@ -80,10 +83,8 @@ LPDIRECT3DPIXELSHADER9 CreatePixelShaderFromByteCode(const u8 *bytecode, int len LPDIRECT3DPIXELSHADER9 p_shader; HRESULT hr = D3D::dev->CreatePixelShader((DWORD *)bytecode, &p_shader); if (FAILED(hr)) - { - PanicAlert("CreatePixelShaderFromByteCode failed at %s %d\n", __FILE__, __LINE__); - p_shader = NULL; - } + return NULL; + return p_shader; } @@ -101,16 +102,22 @@ bool CompilePixelShader(const char *code, int len, u8 **bytecode, int *bytecodel if (FAILED(hr)) { - if (g_ActiveConfig.bShowShaderErrors) { - std::string hello = (char*)errorBuffer->GetBufferPointer(); - hello += "\n\n"; - hello += code; - MessageBoxA(0, hello.c_str(), "Error compiling pixel shader", MB_ICONERROR); - } - *bytecode = 0; + static int num_failures = 0; + char szTemp[MAX_PATH]; + sprintf(szTemp, "%sbad_ps_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), num_failures++); + std::ofstream file(szTemp); + file << code; + file.close(); + + PanicAlert("Failed to compile pixel shader!\nThis usually happens when trying to use Dolphin with an outdated GPU or integrated GPU like the Intel GMA series.\n\nIf you're sure this is Dolphin's error anyway, post the contents of %s along with this error message at the forums.\n\nDebug info (%s):\n%s", + szTemp, + D3D::PixelShaderVersionString(), + (char*)errorBuffer->GetBufferPointer()); + + *bytecode = NULL; *bytecodelen = 0; } - else if (SUCCEEDED(hr)) + else { *bytecodelen = shaderBuffer->GetBufferSize(); *bytecode = new u8[*bytecodelen]; @@ -135,7 +142,6 @@ LPDIRECT3DVERTEXSHADER9 CompileAndCreateVertexShader(const char *code, int len) delete [] bytecode; return v_shader; } - PanicAlert("Failed to compile and create vertex shader from %p (size %d) at %s %d\n", code, len, __FILE__, __LINE__); return NULL; } @@ -149,7 +155,6 @@ LPDIRECT3DPIXELSHADER9 CompileAndCreatePixelShader(const char* code, unsigned in delete [] bytecode; return p_shader; } - PanicAlert("Failed to compile and create pixel shader, %s %d\n", __FILE__, __LINE__); return NULL; } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp index c168ffc69b..f76837837d 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/PixelShaderCache.cpp @@ -375,14 +375,6 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components) u8 *bytecode = 0; int bytecodelen = 0; if (!D3D::CompilePixelShader(code, (int)strlen(code), &bytecode, &bytecodelen)) { - if (g_ActiveConfig.bShowShaderErrors) - { - PanicAlert("Failed to compile Pixel Shader:\n\n%s", code); - static int counter = 0; - char szTemp[MAX_PATH]; - sprintf(szTemp, "%sBADps_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), counter++); - SaveData(szTemp, code); - } GFX_DEBUGGER_PAUSE_AT(NEXT_ERROR, true); return false; } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexShaderCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexShaderCache.cpp index e5c889b54b..5fc2b6dee2 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexShaderCache.cpp @@ -209,10 +209,6 @@ bool VertexShaderCache::SetShader(u32 components) int bytecodelen; if (!D3D::CompileVertexShader(code, (int)strlen(code), &bytecode, &bytecodelen)) { - if (g_ActiveConfig.bShowShaderErrors) - { - PanicAlert("Failed to compile Vertex Shader:\n\n%s", code); - } GFX_DEBUGGER_PAUSE_AT(NEXT_ERROR, true); return false; } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp index abde68f1db..bee12e0186 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp @@ -223,13 +223,7 @@ FRAGMENTSHADER* PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 comp } #endif - // printf("Compiling pixel shader. size = %i\n", strlen(code)); if (!code || !CompilePixelShader(newentry.shader, code)) { - ERROR_LOG(VIDEO, "failed to create pixel shader"); - static int counter = 0; - char szTemp[MAX_PATH]; - sprintf(szTemp, "%sBADps_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), counter++); - SaveData(szTemp, code); GFX_DEBUGGER_PAUSE_AT(NEXT_ERROR, true); return NULL; } @@ -258,13 +252,19 @@ bool PixelShaderCache::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrpr if (!cgIsProgram(tempprog)) { cgDestroyProgram(tempprog); - if (g_ActiveConfig.bShowShaderErrors) - { - std::string message = cgGetLastListing(g_cgcontext); - message += "\n\n"; - message += pstrprogram; - CriticalAlertT("Failed to compile ps %s", message.c_str()); - } + + static int num_failures = 0; + char szTemp[MAX_PATH]; + sprintf(szTemp, "%sbad_ps_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), num_failures++); + std::ofstream file(szTemp); + file << pstrprogram; + file.close(); + + PanicAlert("Failed to compile pixel shader!\nThis usually happens when trying to use Dolphin with an outdated GPU or integrated GPU like the Intel GMA series.\n\nIf you're sure this is Dolphin's error anyway, post the contents of %s along with this error message at the forums.\n\nDebug info (%d):\n%s", + szTemp, + g_cgfProf, + cgGetLastListing(g_cgcontext)); + return false; } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp index 68e430be50..96f2d5a2ae 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp @@ -38,7 +38,6 @@ namespace OGL { VertexShaderCache::VSCache VertexShaderCache::vshaders; -bool VertexShaderCache::s_displayCompileAlert; GLuint VertexShaderCache::CurrentShader; bool VertexShaderCache::ShaderEnabled; @@ -53,8 +52,6 @@ void VertexShaderCache::Init() CurrentShader = 0; memset(&last_vertex_shader_uid, 0xFF, sizeof(last_vertex_shader_uid)); - s_displayCompileAlert = true; - glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, (GLint *)&s_nMaxVertexInstructions); if (strstr((const char*)glGetString(GL_VENDOR), "Humper") != NULL) s_nMaxVertexInstructions = 4096; #if CG_VERSION_NUM == 2100 @@ -114,7 +111,6 @@ VERTEXSHADER* VertexShaderCache::SetShader(u32 components) #endif if (!code || !VertexShaderCache::CompileVertexShader(entry.shader, code)) { - ERROR_LOG(VIDEO, "failed to create vertex shader"); GFX_DEBUGGER_PAUSE_AT(NEXT_ERROR, true); return NULL; } @@ -140,10 +136,18 @@ bool VertexShaderCache::CompileVertexShader(VERTEXSHADER& vs, const char* pstrpr const char *opts[] = {"-profileopts", stropt, "-O2", "-q", NULL}; CGprogram tempprog = cgCreateProgram(g_cgcontext, CG_SOURCE, pstrprogram, g_cgvProf, "main", opts); if (!cgIsProgram(tempprog)) { - if (s_displayCompileAlert) { - PanicAlert("Failed to create vertex shader"); - s_displayCompileAlert = false; - } + static int num_failures = 0; + char szTemp[MAX_PATH]; + sprintf(szTemp, "%sbad_vs_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), num_failures++); + std::ofstream file(szTemp); + file << pstrprogram; + file.close(); + + PanicAlert("Failed to compile vertex shader!\nThis usually happens when trying to use Dolphin with an outdated GPU or integrated GPU like the Intel GMA series.\n\nIf you're sure this is Dolphin's error anyway, post the contents of %s along with this error message at the forums.\n\nDebug info (%d):\n%s", + szTemp, + g_cgfProf, + cgGetLastListing(g_cgcontext)); + cgDestroyProgram(tempprog); ERROR_LOG(VIDEO, "Failed to load vs %s:", cgGetLastListing(g_cgcontext)); ERROR_LOG(VIDEO, "%s", pstrprogram); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.h b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.h index 9ada76fd3b..e311fde77b 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.h @@ -55,8 +55,6 @@ class VertexShaderCache static VSCache vshaders; - static bool s_displayCompileAlert; - static GLuint CurrentShader; static bool ShaderEnabled;