summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-04-01 17:36:26 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-04-01 19:44:56 +0300
commitd357bf7ae5c5e0b6e66e7d82ce1677360b4cb990 (patch)
treef2a63bd541a05732273f66668936f16ab69f1629
parent022ff9819336a9beab744f2d25baa51a249e998e (diff)
SL-14990 Turn on shader init logging after crash
-rw-r--r--indra/llrender/llglslshader.cpp10
-rw-r--r--indra/llrender/llshadermgr.cpp60
2 files changed, 33 insertions, 37 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index 74cfa60b27..4351f6e2c8 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -396,10 +396,18 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,
mLightHash = 0xFFFFFFFF;
llassert_always(!mShaderFiles.empty());
- BOOL success = TRUE;
// Create program
mProgramObject = glCreateProgramObjectARB();
+ if (mProgramObject == 0)
+ {
+ // Shouldn't happen if shader related extensions, like ARB_vertex_shader, exist.
+ LL_SHADER_LOADING_WARNS() << "Failed to create handle for shader: " << mName << LL_ENDL;
+ unloadInternal();
+ return FALSE;
+ }
+
+ BOOL success = TRUE;
#if LL_DARWIN
// work-around missing mix(vec3,vec3,bvec3)
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 236ebbd78f..e8c6295930 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -611,13 +611,11 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
#endif
GLenum error = GL_NO_ERROR;
- if (gDebugGL)
+
+ error = glGetError();
+ if (error != GL_NO_ERROR)
{
- error = glGetError();
- if (error != GL_NO_ERROR)
- {
- LL_SHADER_LOADING_WARNS() << "GL ERROR entering loadShaderFile(): " << error << LL_ENDL;
- }
+ LL_SHADER_LOADING_WARNS() << "GL ERROR entering loadShaderFile(): " << error << " for file: " << filename << LL_ENDL;
}
if (filename.empty())
@@ -966,55 +964,45 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
//create shader object
GLhandleARB ret = glCreateShaderObjectARB(type);
- if (gDebugGL)
+
+ error = glGetError();
+ if (error != GL_NO_ERROR)
{
- error = glGetError();
- if (error != GL_NO_ERROR)
- {
- LL_WARNS("ShaderLoading") << "GL ERROR in glCreateShaderObjectARB: " << error << LL_ENDL;
- }
+ LL_WARNS("ShaderLoading") << "GL ERROR in glCreateShaderObjectARB: " << error << " for file: " << open_file_name << LL_ENDL;
}
-
+
//load source
glShaderSourceARB(ret, shader_code_count, (const GLcharARB**) shader_code_text, NULL);
- if (gDebugGL)
+ error = glGetError();
+ if (error != GL_NO_ERROR)
{
- error = glGetError();
- if (error != GL_NO_ERROR)
- {
- LL_WARNS("ShaderLoading") << "GL ERROR in glShaderSourceARB: " << error << LL_ENDL;
- }
+ LL_WARNS("ShaderLoading") << "GL ERROR in glShaderSourceARB: " << error << " for file: " << open_file_name << LL_ENDL;
}
//compile source
glCompileShaderARB(ret);
- if (gDebugGL)
+ error = glGetError();
+ if (error != GL_NO_ERROR)
{
- error = glGetError();
- if (error != GL_NO_ERROR)
- {
- LL_WARNS("ShaderLoading") << "GL ERROR in glCompileShaderARB: " << error << LL_ENDL;
- }
+ LL_WARNS("ShaderLoading") << "GL ERROR in glCompileShaderARB: " << error << " for file: " << open_file_name << LL_ENDL;
}
-
+
if (error == GL_NO_ERROR)
{
//check for errors
GLint success = GL_TRUE;
glGetObjectParameterivARB(ret, GL_OBJECT_COMPILE_STATUS_ARB, &success);
- if (gDebugGL || success == GL_FALSE)
+
+ error = glGetError();
+ if (error != GL_NO_ERROR || success == GL_FALSE)
{
- error = glGetError();
- if (error != GL_NO_ERROR || success == GL_FALSE)
- {
- //an error occured, print log
- LL_WARNS("ShaderLoading") << "GLSL Compilation Error:" << LL_ENDL;
- dumpObjectLog(ret, TRUE, open_file_name);
- dumpShaderSource(shader_code_count, shader_code_text);
- ret = 0;
- }
+ //an error occured, print log
+ LL_WARNS("ShaderLoading") << "GLSL Compilation Error:" << LL_ENDL;
+ dumpObjectLog(ret, TRUE, open_file_name);
+ dumpShaderSource(shader_code_count, shader_code_text);
+ ret = 0;
}
}
else