Add Dolphin version and current video backend to shader compilation logs
This commit is contained in:
parent
04e9279f3d
commit
e5f6d9320f
|
@ -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,
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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());
|
||||
};
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue