diff --git a/Source/Core/VideoCommon/ShaderCache.cpp b/Source/Core/VideoCommon/ShaderCache.cpp index 38ac252832..3c9e4e6ae8 100644 --- a/Source/Core/VideoCommon/ShaderCache.cpp +++ b/Source/Core/VideoCommon/ShaderCache.cpp @@ -430,7 +430,8 @@ ShaderCache::CompileVertexUberShader(const UberShader::VertexShaderUid& uid) con { const ShaderCode source_code = UberShader::GenVertexShader(m_api_type, m_host_config, uid.GetUidData()); - return g_renderer->CreateShaderFromSource(ShaderStage::Vertex, source_code.GetBuffer()); + return g_renderer->CreateShaderFromSource(ShaderStage::Vertex, source_code.GetBuffer(), + fmt::to_string(*uid.GetUidData())); } std::unique_ptr ShaderCache::CompilePixelShader(const PixelShaderUid& uid) const @@ -445,7 +446,8 @@ ShaderCache::CompilePixelUberShader(const UberShader::PixelShaderUid& uid) const { const ShaderCode source_code = UberShader::GenPixelShader(m_api_type, m_host_config, uid.GetUidData()); - return g_renderer->CreateShaderFromSource(ShaderStage::Pixel, source_code.GetBuffer()); + return g_renderer->CreateShaderFromSource(ShaderStage::Pixel, source_code.GetBuffer(), + fmt::to_string(*uid.GetUidData())); } const AbstractShader* ShaderCache::InsertVertexShader(const VertexShaderUid& uid, diff --git a/Source/Core/VideoCommon/UberShaderPixel.cpp b/Source/Core/VideoCommon/UberShaderPixel.cpp index 161f40146a..a96b15c83d 100644 --- a/Source/Core/VideoCommon/UberShaderPixel.cpp +++ b/Source/Core/VideoCommon/UberShaderPixel.cpp @@ -66,8 +66,7 @@ ShaderCode GenPixelShader(APIType api_type, const ShaderHostConfig& host_config, const u32 numTexgen = uid_data->num_texgens; ShaderCode out; - out.Write("// Pixel UberShader for {} texgens{}{}\n", numTexgen, - early_depth ? ", early-depth" : "", per_pixel_depth ? ", per-pixel depth" : ""); + out.Write("// {}\n", *uid_data); WriteBitfieldExtractHeader(out, api_type, host_config); WritePixelShaderCommonHeader(out, api_type, host_config, bounding_box); if (per_pixel_lighting) diff --git a/Source/Core/VideoCommon/UberShaderPixel.h b/Source/Core/VideoCommon/UberShaderPixel.h index 2ae7811050..9b2be898a2 100644 --- a/Source/Core/VideoCommon/UberShaderPixel.h +++ b/Source/Core/VideoCommon/UberShaderPixel.h @@ -34,3 +34,17 @@ void EnumeratePixelShaderUids(const std::function& void ClearUnusedPixelShaderUidBits(APIType api_type, const ShaderHostConfig& host_config, PixelShaderUid* uid); } // namespace UberShader + +template <> +struct fmt::formatter +{ + constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); } + template + auto format(const UberShader::pixel_ubershader_uid_data& uid, FormatContext& ctx) const + { + return fmt::format_to(ctx.out(), "Pixel UberShader for {} texgens{}{}{}", uid.num_texgens, + uid.early_depth ? ", early-depth" : "", + uid.per_pixel_depth ? ", per-pixel depth" : "", + uid.uint_output ? ", uint output" : ""); + } +}; diff --git a/Source/Core/VideoCommon/UberShaderVertex.cpp b/Source/Core/VideoCommon/UberShaderVertex.cpp index 40b4cd65e5..3f05400a46 100644 --- a/Source/Core/VideoCommon/UberShaderVertex.cpp +++ b/Source/Core/VideoCommon/UberShaderVertex.cpp @@ -34,7 +34,7 @@ ShaderCode GenVertexShader(APIType api_type, const ShaderHostConfig& host_config const u32 num_texgen = uid_data->num_texgens; ShaderCode out; - out.Write("// Vertex UberShader\n\n"); + out.Write("// {}\n\n", *uid_data); out.Write("{}", s_lighting_struct); // uniforms diff --git a/Source/Core/VideoCommon/UberShaderVertex.h b/Source/Core/VideoCommon/UberShaderVertex.h index e20760e491..d9db7004be 100644 --- a/Source/Core/VideoCommon/UberShaderVertex.h +++ b/Source/Core/VideoCommon/UberShaderVertex.h @@ -25,3 +25,14 @@ ShaderCode GenVertexShader(APIType api_type, const ShaderHostConfig& host_config const vertex_ubershader_uid_data* uid_data); void EnumerateVertexShaderUids(const std::function& callback); } // namespace UberShader + +template <> +struct fmt::formatter +{ + constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); } + template + auto format(const UberShader::vertex_ubershader_uid_data& uid, FormatContext& ctx) const + { + return fmt::format_to(ctx.out(), "Vertex UberShader for {} texgens", uid.num_texgens); + } +};