summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authornat-goodspeed <nat@lindenlab.com>2024-09-18 13:58:20 -0400
committerGitHub <noreply@github.com>2024-09-18 13:58:20 -0400
commit4af7cd51e9cc22d9dc2fe42e378051c55515ac8e (patch)
tree14dc47b0eaa34a58fd771667c1b2609d4a2f2b39 /indra/llrender
parentecd5aa227653d9b690a14c1d9c1dd90ea644fec5 (diff)
parentf4b65638879c10c832b3bb8448f82001106ffd11 (diff)
Merge pull request #2573 from secondlife/lua-profile-cmp
Add script to compare a Frame Profile JSON stats file vs. a baseline file.
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llglslshader.cpp21
-rw-r--r--indra/llrender/llglslshader.h10
2 files changed, 9 insertions, 22 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;
- }
}
}
diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h
index a9b9bfafa8..2d669c70a9 100644
--- a/indra/llrender/llglslshader.h
+++ b/indra/llrender/llglslshader.h
@@ -170,7 +170,7 @@ public:
static U32 sMaxGLTFNodes;
static void initProfile();
- static void finishProfile(const std::string& report_name=sDefaultReportName);
+ static void finishProfile(boost::json::value& stats=sDefaultStats);
static void startProfile();
static void stopProfile();
@@ -365,10 +365,10 @@ public:
private:
void unloadInternal();
// This must be static because finishProfile() is called at least once
- // within a __try block. If we default its report_name parameter to a
- // temporary std::string, that temporary must be destroyed when the stack
- // is unwound, which __try forbids.
- static std::string sDefaultReportName;
+ // within a __try block. If we default its stats parameter to a temporary
+ // json::value, that temporary must be destroyed when the stack is
+ // unwound, which __try forbids.
+ static boost::json::value sDefaultStats;
};
//UI shader (declared here so llui_libtest will link properly)