diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-09-13 16:01:05 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-09-13 16:01:05 -0400 |
commit | 6c226ac96c8ba01e62ea1085177b2859b74b85d8 (patch) | |
tree | c52e5996142c37d22d923fc453a6d65081028314 /indra/llrender/llglslshader.cpp | |
parent | 7ced89435d702b8a6bc02908769bed47e20d6ec0 (diff) |
Add context info to Develop->Render Tests->Frame Profile stats file.
Specifically, add the viewer version, the machine ID, the grid, the region
name and ID, the parcel name and ID and the timestamp. This is both richer and
less fragile than trying to extract that information from the generated
filename: e.g. we now have region and parcel names.
Instead of making `LLGLSLShader::finishProfile()` mess with file I/O, pass it
a reference to a `boost::json::value` to be filled in with statistics, if it's
a `boost::json::object`. Otherwise it's `boost::json::null`, meaning no report.
Make llviewerdisplay.cpp's `display()` function instantiate a `boost::json::value`
to pass to `finishProfile()`. That lets llviewerdisplay.cpp also set the
`"context"` entry, with a new `getProfileStatsContext()` function quite
similar to `getProfileStatsFilename()`.
Diffstat (limited to 'indra/llrender/llglslshader.cpp')
-rw-r--r-- | indra/llrender/llglslshader.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 56f1533708..6ba5463acd 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -41,8 +41,6 @@ #include "OpenGL/OpenGL.h" #endif -#include <fstream> - // Print-print list of shader included source files that are linked together via glAttachShader() // i.e. On macOS / OSX the AMD GLSL linker will display an error if a varying is left in an undefined state. #define DEBUG_SHADER_INCLUDES 0 @@ -65,7 +63,7 @@ U64 LLGLSLShader::sTotalTimeElapsed = 0; U32 LLGLSLShader::sTotalTrianglesDrawn = 0; U64 LLGLSLShader::sTotalSamplesDrawn = 0; U32 LLGLSLShader::sTotalBinds = 0; -std::string LLGLSLShader::sDefaultReportName; +boost::json::value LLGLSLShader::sDefaultStats; //UI shader -- declared here so llui_libtest will link properly LLGLSLShader gUIProgram; @@ -120,16 +118,16 @@ struct LLGLSLShaderCompareTimeElapsed }; //static -void LLGLSLShader::finishProfile(const std::string& report_name) +void LLGLSLShader::finishProfile(boost::json::value& statsv) { sProfileEnabled = false; - if (! report_name.empty()) + if (! statsv.is_null()) { std::vector<LLGLSLShader*> sorted(sInstances.begin(), sInstances.end()); std::sort(sorted.begin(), sorted.end(), LLGLSLShaderCompareTimeElapsed()); - boost::json::object stats; + auto& stats = statsv.as_object(); auto shadersit = stats.emplace("shaders", boost::json::array_kind).first; auto& shaders = shadersit->value().as_array(); bool unbound = false; @@ -174,17 +172,6 @@ void LLGLSLShader::finishProfile(const std::string& report_name) } } } - - std::ofstream outf(report_name); - if (! outf) - { - LL_WARNS() << "Couldn't write to " << std::quoted(report_name) << LL_ENDL; - } - else - { - outf << stats; - LL_INFOS() << "(also dumped to " << std::quoted(report_name) << ")" << LL_ENDL; - } } } |