From 5d8d4024038ff6924159b74cbd1819d992bfe6b9 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Wed, 23 Nov 2011 21:29:42 -0600 Subject: [PATCH 1/2] Fix shader error dumping. (the error file was not being written to.) Also catch exceptions if shader log dir is inaccessable or otherwise unable to be cleared. --- indra/llrender/llshadermgr.cpp | 4 ++-- indra/newview/llviewershadermgr.cpp | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 68a7b22ae..bdb0299b1 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -768,8 +768,8 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade file.write(ostr.str().c_str(),ostr.str().length()); if(!error_str.empty()) { - LLAPRFile file2(maindir + shader_name + "_ERROR" + ".txt", LL_APR_W); - file.write(error_str.c_str(),error_str.length()); + LLAPRFile file2(maindir + shader_name + "_ERROR.txt", LL_APR_W); + file2.write(error_str.c_str(),error_str.length()); } } stop_glerror(); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 47e2f4bf7..ac77a4b0c 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -354,7 +354,14 @@ void LLViewerShaderMgr::setShaders() { const std::string dumpdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"shader_dump")+gDirUtilp->getDirDelimiter(); - boost::filesystem::remove_all(dumpdir); + try + { + boost::filesystem::remove_all(dumpdir); + } + catch(const boost::filesystem::filesystem_error& e) + { + llinfos << "boost::filesystem::remove_all(\""+dumpdir+"\") failed: '" + e.code().message() + "'" << llendl; + } } LLGLSLShader::sIndexedTextureChannels = llmax(llmin(gGLManager.mNumTextureImageUnits, (S32) gSavedSettings.getU32("RenderMaxTextureIndex")), 1); From bf6e1d6c75e71d100942b83cadc7fc63e3d2ab5d Mon Sep 17 00:00:00 2001 From: Shyotl Date: Wed, 23 Nov 2011 21:30:32 -0600 Subject: [PATCH 2/2] Unbork shadows. Apparently texture/texturProj do not return a vector for shadow samplers. --- indra/newview/llviewershadermgr.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index ac77a4b0c..b782e0091 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -386,9 +386,9 @@ void LLViewerShaderMgr::setShaders() LLShaderMgr::instance()->mDefinitions["textureCube"] = "texture"; LLShaderMgr::instance()->mDefinitions["texture2DLod"] = "textureLod"; LLShaderMgr::instance()->mDefinitions["texture2DRect"] = "texture"; - LLShaderMgr::instance()->mDefinitions["shadow2D"] = "texture"; - LLShaderMgr::instance()->mDefinitions["shadow2DRect"] = "texture"; - LLShaderMgr::instance()->mDefinitions["shadow2DProj"] = "textureProj"; + LLShaderMgr::instance()->mDefinitions["shadow2D(a,b)"] = "vec2(texture(a,b))"; //Shadow lookups only return a single float. + LLShaderMgr::instance()->mDefinitions["shadow2DRect(a,b)"] = "vec2(texture(a,b))"; + LLShaderMgr::instance()->mDefinitions["shadow2DProj(a,b)"] = "vec2(textureProj(a,b))"; LLShaderMgr::instance()->mDefinitions["ftransform()"] = "gl_ModelViewProjectionMatrix * gl_Vertex"; }