summaryrefslogtreecommitdiff
path: root/indra/llrender/llshadermgr.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2025-12-11 01:43:58 +0200
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-01-07 02:15:43 +0200
commit9440f969033b73e2e2a037c291bcb45619b1dfd1 (patch)
tree086e8f5a66e0adaeeef68400f73ff78ae456b1d2 /indra/llrender/llshadermgr.cpp
parentb9727dd84124756adacfbce73b5a916a2c0dd891 (diff)
Reapply "Add more functionality to LLFile and cleanup LLAPRFile""
# Conflicts: # indra/llcrashlogger/llcrashlock.cpp # indra/llrender/llshadermgr.cpp # indra/test/CMakeLists.txt
Diffstat (limited to 'indra/llrender/llshadermgr.cpp')
-rw-r--r--indra/llrender/llshadermgr.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 1da71e6bf4..7e8d31232b 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -1014,7 +1014,6 @@ void LLShaderMgr::initShaderCache(bool enabled, const LLUUID& old_cache_version,
mShaderCacheDir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "shader_cache");
LLFile::mkdir(mShaderCacheDir);
-
{
std::string meta_out_path = gDirUtilp->add(mShaderCacheDir, "shaderdata.llsd");
if (gDirUtilp->fileExists(meta_out_path))
@@ -1077,7 +1076,7 @@ void LLShaderMgr::persistShaderCacheMetadata()
// Settings and shader cache get saved at different time, thus making
// RenderShaderCacheVersion unreliable when running multiple viewer
// instances, or for cases where viewer crashes before saving settings.
- // Dupplicate version to the cache itself.
+ // Duplicate version to the cache itself.
out["version"] = mShaderCacheVersion;
out["shaders"] = LLSD::emptyMap();
LLSD &shaders = out["shaders"];
@@ -1130,11 +1129,11 @@ bool LLShaderMgr::loadCachedProgramBinary(LLGLSLShader* shader)
{
std::vector<U8> in_data;
in_data.resize(shader_info.mBinaryLength);
-
- LLUniqueFile filep = LLFile::fopen(in_path, "rb");
- if (filep)
+ std::error_code ec;
+ LLFile filep = LLFile(in_path, LLFile::in | LLFile::binary, ec);
+ if (!ec && (bool)filep)
{
- size_t result = fread(in_data.data(), sizeof(U8), in_data.size(), filep);
+ size_t result = filep.read(in_data.data(), in_data.size(), ec);
filep.close();
if (result == in_data.size())
@@ -1179,11 +1178,12 @@ bool LLShaderMgr::saveCachedProgramBinary(LLGLSLShader* shader)
if (error == GL_NO_ERROR)
{
std::string out_path = gDirUtilp->add(mShaderCacheDir, shader->mShaderHash.asString() + ".shaderbin");
- LLUniqueFile outfile = LLFile::fopen(out_path, "wb");
- if (outfile)
+ std::error_code ec;
+ LLFile filep = LLFile(out_path, LLFile::out | LLFile::binary, ec);
+ if (filep)
{
- fwrite(program_binary.data(), sizeof(U8), program_binary.size(), outfile);
- outfile.close();
+ filep.write(program_binary.data(), program_binary.size(), ec);
+ filep.close();
binary_info.mLastUsedTime = (F32)LLTimer::getTotalSeconds();