Skip to content
Snippets Groups Projects
Commit 543e1739 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Add shader cache checkbox to develop graphics menu

parent 16ef36f1
No related branches found
No related tags found
2 merge requests!3Update to main branch,!2Rebase onto current main branch
...@@ -1094,11 +1094,11 @@ void LLShaderMgr::initShaderCache(bool enabled, const LLUUID& old_cache_version, ...@@ -1094,11 +1094,11 @@ void LLShaderMgr::initShaderCache(bool enabled, const LLUUID& old_cache_version,
mShaderCacheInitialized = true; mShaderCacheInitialized = true;
std::string shader_cache_dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "shader_cache"); mShaderCacheDir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "shader_cache");
LLFile::mkdir(shader_cache_dir); LLFile::mkdir(mShaderCacheDir);
{ {
std::string meta_out_path = gDirUtilp->add(shader_cache_dir, "shaderdata.llsd"); std::string meta_out_path = gDirUtilp->add(mShaderCacheDir, "shaderdata.llsd");
if (gDirUtilp->fileExists(meta_out_path)) if (gDirUtilp->fileExists(meta_out_path))
{ {
LL_INFOS() << "Loading shader metadata" << LL_ENDL; LL_INFOS() << "Loading shader metadata" << LL_ENDL;
...@@ -1167,7 +1167,7 @@ bool LLShaderMgr::loadCachedProgramBinary(LLGLSLShader* shader) ...@@ -1167,7 +1167,7 @@ bool LLShaderMgr::loadCachedProgramBinary(LLGLSLShader* shader)
std::vector<U8> in_data; std::vector<U8> in_data;
in_data.resize(shader_info.mBinaryLength); in_data.resize(shader_info.mBinaryLength);
std::string in_path = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "shader_cache", shader->mShaderHash.asString() + ".shaderbin"); std::string in_path = gDirUtilp->add(mShaderCacheDir, shader->mShaderHash.asString() + ".shaderbin");
LLUniqueFile filep = LLFile::fopen(in_path, "rb"); LLUniqueFile filep = LLFile::fopen(in_path, "rb");
if (filep) if (filep)
{ {
...@@ -1203,7 +1203,7 @@ bool LLShaderMgr::saveCachedProgramBinary(LLGLSLShader* shader) ...@@ -1203,7 +1203,7 @@ bool LLShaderMgr::saveCachedProgramBinary(LLGLSLShader* shader)
glGetProgramBinary(shader->mProgramObject, program_binary.size() * sizeof(U8), nullptr, &binary_info.mBinaryFormat, program_binary.data()); glGetProgramBinary(shader->mProgramObject, program_binary.size() * sizeof(U8), nullptr, &binary_info.mBinaryFormat, program_binary.data());
std::string out_path = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "shader_cache", shader->mShaderHash.asString() + ".shaderbin"); std::string out_path = gDirUtilp->add(mShaderCacheDir, shader->mShaderHash.asString() + ".shaderbin");
LLUniqueFile outfile = LLFile::fopen(out_path, "wb"); LLUniqueFile outfile = LLFile::fopen(out_path, "wb");
if (outfile) if (outfile)
{ {
......
...@@ -338,6 +338,7 @@ class LLShaderMgr ...@@ -338,6 +338,7 @@ class LLShaderMgr
boost::unordered_map<LLUUID, ProgramBinaryData> mShaderBinaryCache; boost::unordered_map<LLUUID, ProgramBinaryData> mShaderBinaryCache;
bool mShaderCacheInitialized = false; bool mShaderCacheInitialized = false;
bool mShaderCacheEnabled = false; bool mShaderCacheEnabled = false;
std::string mShaderCacheDir;
protected: protected:
......
...@@ -3689,23 +3689,31 @@ function="World.EnvPreset" ...@@ -3689,23 +3689,31 @@ function="World.EnvPreset"
parameter="RenderAttachedParticles" /> parameter="RenderAttachedParticles" />
</menu_item_check> </menu_item_check>
<menu_item_separator /> <menu_item_separator />
<menu_item_check
label="Enable Shader Cache"
name="Enable Shader Cache">
<menu_item_check.on_check
function="CheckControl"
parameter="RenderShaderCacheEnabled" />
<menu_item_check.on_click
function="ToggleShaderControl"
parameter="RenderShaderCacheEnabled" />
</menu_item_check>
<menu_item_call <menu_item_call
enabled="true" enabled="true"
label="Clear Cache Immediately" label="Clear Shader Cache"
name="Cache Clear"> name="Shader Cache Clear">
<menu_item_call.on_click <menu_item_call.on_click
function="Develop.ClearCache" /> function="Advanced.ClearShaderCache" />
</menu_item_call> </menu_item_call>
<menu_item_separator />
<menu_item_call <menu_item_call
enabled="true" enabled="true"
label="Clear Shader Cache" label="Clear Cache Immediately"
name="Shader Cache Clear"> name="Cache Clear">
<menu_item_call.on_click <menu_item_call.on_click
function="Advanced.ClearShaderCache" /> function="Develop.ClearCache" />
</menu_item_call> </menu_item_call>
</menu> </menu>
<menu <menu
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment