diff options
author | Dave Parks <davep@lindenlab.com> | 2023-02-07 11:40:56 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2023-02-07 11:40:56 -0600 |
commit | b52699091da791a1349daf66d405f27ca2568ea9 (patch) | |
tree | c8c140c4691f3f4d53274bbaf7d8a734dec2d330 /indra/llrender | |
parent | c8fb3ad4de0575a0538b9532e819319f655613d1 (diff) |
SL-19147 Water quality pass. Remove gl_FragDepth writes from sky rendering (optimization). Incidental decruft.
Diffstat (limited to 'indra/llrender')
-rw-r--r-- | indra/llrender/llshadermgr.cpp | 74 |
1 files changed, 48 insertions, 26 deletions
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 16f2769411..54dbb0d025 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -28,6 +28,7 @@ #include "llshadermgr.h" #include "llrender.h" #include "llfile.h" +#include "lldir.h" #if LL_DARWIN #include "OpenGL/OpenGL.h" @@ -593,36 +594,57 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev S32 gpu_class; std::string open_file_name; - //find the most relevant file - for (gpu_class = try_gpu_class; gpu_class > 0; gpu_class--) - { //search from the current gpu class down to class 1 to find the most relevant shader - std::stringstream fname; - fname << getShaderDirPrefix(); - fname << gpu_class << "/" << filename; - - open_file_name = fname.str(); - - /* - Would be awesome, if we didn't have shaders that re-use files - with different environments to say, add skinning, etc - can't depend on cached version to have evaluate ifdefs identically... - if we can define a deterministic hash for the shader based on - all the inputs, maybe we can save some time here. - if (mShaderObjects.count(filename) > 0) + +#if 0 // WIP -- try to come up with a way to fallback to an error shader without needing debug stubs all over the place in the shader tree + if (shader_level == -1) + { + // use "error" fallback + if (type == GL_VERTEX_SHADER) + { + open_file_name = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "shaders/errorV.glsl"); + } + else { - return mShaderObjects[filename]; + llassert(type == GL_FRAGMENT_SHADER); // type must be vertex or fragment shader + open_file_name = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "shaders/errorF.glsl"); } - */ + file = LLFile::fopen(open_file_name, "r"); + } + else +#endif + { + //find the most relevant file + for (gpu_class = try_gpu_class; gpu_class > 0; gpu_class--) + { //search from the current gpu class down to class 1 to find the most relevant shader + std::stringstream fname; + fname << getShaderDirPrefix(); + fname << gpu_class << "/" << filename; + + open_file_name = fname.str(); + + /* + Would be awesome, if we didn't have shaders that re-use files + with different environments to say, add skinning, etc + can't depend on cached version to have evaluate ifdefs identically... + if we can define a deterministic hash for the shader based on + all the inputs, maybe we can save some time here. + if (mShaderObjects.count(filename) > 0) + { + return mShaderObjects[filename]; + } + + */ - LL_DEBUGS("ShaderLoading") << "Looking in " << open_file_name << LL_ENDL; - file = LLFile::fopen(open_file_name, "r"); /* Flawfinder: ignore */ - if (file) - { - LL_DEBUGS("ShaderLoading") << "Loading file: " << open_file_name << " (Want class " << gpu_class << ")" << LL_ENDL; - break; // done - } - } + LL_DEBUGS("ShaderLoading") << "Looking in " << open_file_name << LL_ENDL; + file = LLFile::fopen(open_file_name, "r"); /* Flawfinder: ignore */ + if (file) + { + LL_DEBUGS("ShaderLoading") << "Loading file: " << open_file_name << " (Want class " << gpu_class << ")" << LL_ENDL; + break; // done + } + } + } if (file == NULL) { |