Merge pull request #8336 from Ebola16/PS

Add Dolphin version and current video backend to shader compilation logs
This commit is contained in:
Connor McLaughlin 2020-01-25 11:52:14 +10:00 committed by GitHub
commit e3a7922e12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 9 deletions

View File

@ -10,8 +10,11 @@
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"
#include "Common/Version.h"
#include "VideoBackends/D3DCommon/Shader.h"
#include "VideoCommon/VideoBackendBase.h"
#include "VideoCommon/VideoConfig.h"
namespace D3DCommon
@ -105,13 +108,15 @@ std::optional<Shader::BinaryData> Shader::CompileShader(D3D_FEATURE_LEVEL featur
if (FAILED(hr))
{
static int num_failures = 0;
std::string filename = StringFromFormat(
"%sbad_%s_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), target, num_failures++);
std::string filename = VideoBackendBase::BadShaderFilename(target, num_failures++);
std::ofstream file;
File::OpenFStream(file, filename, std::ios_base::out);
file.write(source.data(), source.size());
file << "\n";
file.write(static_cast<const char*>(errors->GetBufferPointer()), errors->GetBufferSize());
file << "\n";
file << "Dolphin Version: " + Common::scm_rev_str + "\n";
file << "Video Backend: " + g_video_backend->GetDisplayName();
file.close();
PanicAlert("Failed to compile %s:\nDebug info (%s):\n%s", filename.c_str(), target,

View File

@ -17,6 +17,7 @@
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"
#include "Common/Version.h"
#include "Core/ConfigManager.h"
@ -31,6 +32,7 @@
#include "VideoCommon/Statistics.h"
#include "VideoCommon/VertexLoaderManager.h"
#include "VideoCommon/VertexShaderManager.h"
#include "VideoCommon/VideoBackendBase.h"
namespace OGL
{
@ -356,11 +358,13 @@ bool ProgramShaderCache::CheckShaderCompileResult(GLuint id, GLenum type, std::s
{
ERROR_LOG(VIDEO, "%s failed compilation:\n%s", prefix, info_log.c_str());
std::string filename = StringFromFormat(
"%sbad_%s_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), prefix, num_failures++);
std::string filename = VideoBackendBase::BadShaderFilename(prefix, num_failures++);
std::ofstream file;
File::OpenFStream(file, filename, std::ios_base::out);
file << s_glsl_header << code << info_log;
file << "\n";
file << "Dolphin Version: " + Common::scm_rev_str + "\n";
file << "Video Backend: " + g_video_backend->GetDisplayName();
file.close();
PanicAlert("Failed to compile %s shader: %s\n"
@ -392,8 +396,7 @@ bool ProgramShaderCache::CheckProgramLinkResult(GLuint id, std::string_view vcod
if (linkStatus != GL_TRUE)
{
ERROR_LOG(VIDEO, "Program failed linking:\n%s", info_log.c_str());
std::string filename =
StringFromFormat("%sbad_p_%d.txt", File::GetUserPath(D_DUMP_IDX).c_str(), num_failures++);
std::string filename = VideoBackendBase::BadShaderFilename("p", num_failures++);
std::ofstream file;
File::OpenFStream(file, filename, std::ios_base::out);
if (!vcode.empty())
@ -404,6 +407,9 @@ bool ProgramShaderCache::CheckProgramLinkResult(GLuint id, std::string_view vcod
file << s_glsl_header << pcode << '\n';
file << info_log;
file << "\n";
file << "Dolphin Version: " + Common::scm_rev_str + "\n";
file << "Video Backend: " + g_video_backend->GetDisplayName();
file.close();
PanicAlert("Failed to link shaders: %s\n"

View File

@ -21,7 +21,9 @@
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"
#include "Common/Version.h"
#include "VideoCommon/VideoBackendBase.h"
#include "VideoCommon/VideoConfig.h"
namespace Vulkan::ShaderCompiler
@ -142,9 +144,7 @@ std::optional<SPIRVCodeVector> CompileShaderToSPV(EShLanguage stage, const char*
auto DumpBadShader = [&](const char* msg) {
static int counter = 0;
std::string filename = StringFromFormat(
"%sbad_%s_%04i.txt", File::GetUserPath(D_DUMP_IDX).c_str(), stage_filename, counter++);
std::string filename = VideoBackendBase::BadShaderFilename(stage_filename, counter++);
std::ofstream stream;
File::OpenFStream(stream, filename, std::ios_base::out);
if (stream.good())
@ -162,6 +162,10 @@ std::optional<SPIRVCodeVector> CompileShaderToSPV(EShLanguage stage, const char*
}
}
stream << "\n";
stream << "Dolphin Version: " + Common::scm_rev_str + "\n";
stream << "Video Backend: " + g_video_backend->GetDisplayName();
PanicAlert("%s (written to %s)", msg, filename.c_str());
};

View File

@ -10,10 +10,13 @@
#include <string>
#include <vector>
#include "fmt/format.h"
#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
#include "Common/Event.h"
#include "Common/Logging/Log.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
@ -68,6 +71,12 @@ __declspec(dllexport) DWORD NvOptimusEnablement = 1;
}
#endif
std::string VideoBackendBase::BadShaderFilename(const char* shader_stage, int counter)
{
return fmt::format("{}bad_{}_{}_{}.txt", File::GetUserPath(D_DUMP_IDX), shader_stage,
g_video_backend->GetName(), counter);
}
void VideoBackendBase::Video_ExitLoop()
{
Fifo::ExitGpuLoop();

View File

@ -49,6 +49,8 @@ public:
// thread which owns the window.
virtual void PrepareWindow(const WindowSystemInfo& wsi) {}
static std::string BadShaderFilename(const char* shader_stage, int counter);
void Video_ExitLoop();
void Video_BeginField(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u64 ticks);