Removing some shader warnings under gl 3.x context.

This commit is contained in:
Shyotl
2011-11-07 04:15:04 -06:00
parent 2126654979
commit ee5a9c97be
2 changed files with 40 additions and 20 deletions

View File

@@ -675,32 +675,41 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
{
LL_WARNS("ShaderLoading") << "GL ERROR in glCreateShaderObjectARB: " << error << LL_ENDL;
glDeleteObjectARB(ret); //no longer need handle
ret=0;
}
}
//load source
glShaderSourceARB(ret, count, (const GLcharARB**) text, NULL);
if (gDebugGL)
if(ret)
{
error = glGetError();
if (error != GL_NO_ERROR)
glShaderSourceARB(ret, count, (const GLcharARB**) text, NULL);
if (gDebugGL)
{
LL_WARNS("ShaderLoading") << "GL ERROR in glShaderSourceARB: " << error << LL_ENDL;
glDeleteObjectARB(ret); //no longer need handle
error = glGetError();
if (error != GL_NO_ERROR)
{
LL_WARNS("ShaderLoading") << "GL ERROR in glShaderSourceARB: " << error << LL_ENDL;
glDeleteObjectARB(ret); //no longer need handle
ret=0;
}
}
}
//compile source
glCompileShaderARB(ret);
if (gDebugGL)
if(ret)
{
error = glGetError();
if (error != GL_NO_ERROR)
glCompileShaderARB(ret);
if (gDebugGL)
{
LL_WARNS("ShaderLoading") << "GL ERROR in glCompileShaderARB: " << error << LL_ENDL;
glDeleteObjectARB(ret); //no longer need handle
error = glGetError();
if (error != GL_NO_ERROR)
{
LL_WARNS("ShaderLoading") << "GL ERROR in glCompileShaderARB: " << error << LL_ENDL;
glDeleteObjectARB(ret); //no longer need handle
ret=0;
}
}
}
@@ -733,13 +742,12 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
ret = 0;
}
}
if(ret)
dumpObjectLog(ret,false);
}
else
{
ret = 0;
}
static const LLCachedControl<bool> dump_raw_shaders("ShyotlDumpRawShaders",false);
if(dump_raw_shaders || ret)
if(dump_raw_shaders || !ret)
{
std::stringstream ostr;
for (GLuint i = 0; i < count; i++)

View File

@@ -370,9 +370,21 @@ void LLViewerShaderMgr::setShaders()
}
//setup preprocessor definitions
LLShaderMgr::instance()->mDefinitions.clear();
LLShaderMgr::instance()->mDefinitions["samples"] = llformat("%d", gSavedSettings.getU32("RenderFSAASamples")/*gGLManager.getNumFBOFSAASamples(gSavedSettings.getU32("RenderFSAASamples"))*/);
LLShaderMgr::instance()->mDefinitions["NUM_TEX_UNITS"] = llformat("%d", gGLManager.mNumTextureImageUnits);
if(gGLManager.mGLVersion >= 3.f)
{
LLShaderMgr::instance()->mDefinitions["texture2D"] = "texture";
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["ftransform()"] = "gl_ModelViewProjectionMatrix * gl_Vertex";
}
initAttribsAndUniforms();
gPipeline.releaseGLBuffers();