summaryrefslogtreecommitdiff
path: root/indra/newview/llviewershadermgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewershadermgr.cpp')
-rw-r--r--indra/newview/llviewershadermgr.cpp55
1 files changed, 43 insertions, 12 deletions
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 86b1a8c910..0e29851778 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -317,10 +317,16 @@ S32 LLViewerShaderMgr::getVertexShaderLevel(S32 type)
void LLViewerShaderMgr::setShaders()
{
- if (!gPipeline.mInitialized || !sInitialized)
+ //setShaders might be called redundantly by gSavedSettings, so return on reentrance
+ static bool reentrance = false;
+
+ if (!gPipeline.mInitialized || !sInitialized || reentrance)
{
return;
}
+
+ reentrance = true;
+
// Make sure the compiled shader map is cleared before we recompile shaders.
mShaderObjects.clear();
@@ -368,17 +374,11 @@ void LLViewerShaderMgr::setShaders()
S32 wl_class = 2;
S32 water_class = 2;
S32 deferred_class = 0;
- if (!(LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")
- && gSavedSettings.getBOOL("WindLightUseAtmosShaders")))
- {
- // user has disabled WindLight in their settings, downgrade
- // windlight shaders to stub versions.
- wl_class = 1;
- }
-
- if (LLPipeline::sRenderDeferred)
+
+ if (LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") &&
+ gSavedSettings.getBOOL("RenderDeferred"))
{
- if (gSavedSettings.getBOOL("RenderDeferredShadow"))
+ if (gSavedSettings.getS32("RenderShadowDetail") > 0)
{
if (gSavedSettings.getBOOL("RenderDeferredGI"))
{ //shadows + gi
@@ -393,6 +393,24 @@ void LLViewerShaderMgr::setShaders()
{ //no shadows
deferred_class = 1;
}
+
+ //make sure framebuffer objects are enabled
+ gSavedSettings.setBOOL("RenderUseFBO", TRUE);
+
+ //make sure hardware skinning is enabled
+ gSavedSettings.setBOOL("RenderAvatarVP", TRUE);
+
+ //make sure atmospheric shaders are enabled
+ gSavedSettings.setBOOL("WindLightUseAtmosShaders", TRUE);
+ }
+
+
+ if (!(LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders")
+ && gSavedSettings.getBOOL("WindLightUseAtmosShaders")))
+ {
+ // user has disabled WindLight in their settings, downgrade
+ // windlight shaders to stub versions.
+ wl_class = 1;
}
if(!gSavedSettings.getBOOL("EnableRippleWater"))
@@ -517,6 +535,8 @@ void LLViewerShaderMgr::setShaders()
gViewerWindow->setCursor(UI_CURSOR_ARROW);
}
gPipeline.createGLBuffers();
+
+ reentrance = false;
}
void LLViewerShaderMgr::unloadShaders()
@@ -973,10 +993,21 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
if (success)
{
+ std::string fragment;
+
+ if (gSavedSettings.getBOOL("RenderDeferredSSAO"))
+ {
+ fragment = "deferred/sunLightSSAOF.glsl";
+ }
+ else
+ {
+ fragment = "deferred/sunLightF.glsl";
+ }
+
gDeferredSunProgram.mName = "Deferred Sun Shader";
gDeferredSunProgram.mShaderFiles.clear();
gDeferredSunProgram.mShaderFiles.push_back(make_pair("deferred/sunLightV.glsl", GL_VERTEX_SHADER_ARB));
- gDeferredSunProgram.mShaderFiles.push_back(make_pair("deferred/sunLightF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDeferredSunProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
gDeferredSunProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredSunProgram.createShader(NULL, NULL);
}