summaryrefslogtreecommitdiff
path: root/indra/llrender/llshadermgr.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-06-24 15:30:48 -0500
committerDave Parks <davep@lindenlab.com>2011-06-24 15:30:48 -0500
commitad4b559f9fb7c39a090898207c46d4c77d3560bf (patch)
tree486f1067b15d6bbd4422804c3c470aca196093c2 /indra/llrender/llshadermgr.cpp
parent253642ccff9b08da5e62449ff62b23e986dcb77d (diff)
SH-1903 Fix for silly shader compiler error.
Diffstat (limited to 'indra/llrender/llshadermgr.cpp')
-rw-r--r--indra/llrender/llshadermgr.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 3910cd779c..b4e7aaa9b4 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -542,6 +542,8 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
}
text[count++] = strdup("\t}\n");
+ text[count++] = strdup("\treturn vec4(0,0,0,0);\n");
+ text[count++] = strdup("}\n");
}
else
{
@@ -562,10 +564,10 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
std::string if_str = llformat("if (ti == %d) return texture2D(tex%d, texcoord);\n", i, i);
text[count++] = strdup(if_str.c_str());
}
- }
- text[count++] = strdup("\treturn vec4(0,0,0,0);\n");
- text[count++] = strdup("}\n");
+ text[count++] = strdup("\treturn vec4(0,0,0,0);\n");
+ text[count++] = strdup("}\n");
+ }
}
//copy file into memory
@@ -610,11 +612,6 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
}
}
- //free memory
- for (GLuint i = 0; i < count; i++)
- {
- free(text[i]);
- }
if (error == GL_NO_ERROR)
{
//check for errors
@@ -628,6 +625,16 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
//an error occured, print log
LL_WARNS("ShaderLoading") << "GLSL Compilation Error: (" << error << ") in " << filename << LL_ENDL;
dumpObjectLog(ret);
+
+ std::stringstream ostr;
+ //dump shader source for debugging
+ for (GLuint i = 0; i < count; i++)
+ {
+ ostr << i << ": " << text[i];
+ }
+
+ LL_WARNS("ShaderLoading") << "\n" << ostr.str() << llendl;
+
ret = 0;
}
}
@@ -638,6 +645,12 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
}
stop_glerror();
+ //free memory
+ for (GLuint i = 0; i < count; i++)
+ {
+ free(text[i]);
+ }
+
//successfully loaded, save results
if (ret)
{