summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-09-10 20:39:48 +0100
committerGraham Linden <graham@lindenlab.com>2018-09-10 20:39:48 +0100
commit642a4ddd60745db292c543a5cea3b1e5fe606795 (patch)
treec6e54329fff754cb502a3086aaf2e81a33740d9c /indra/newview
parente5c0022a7c102e96d3e93d91eda08af81defeef1 (diff)
Fixes for switching between atmospherics implementations on the fly.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/skyF.glsl2
-rw-r--r--indra/newview/lldrawpoolwlsky.cpp28
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp53
-rw-r--r--indra/newview/llfloaterfixedenvironment.cpp2
-rw-r--r--indra/newview/llviewercontrol.cpp12
-rw-r--r--indra/newview/llviewershadermgr.cpp10
-rw-r--r--indra/newview/pipeline.cpp2
-rw-r--r--indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml2
8 files changed, 90 insertions, 21 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
index ef94190d45..cd0efe8cbb 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
@@ -24,7 +24,7 @@
*/
#ifdef DEFINE_GL_FRAGCOLOR
-out vec4 frag_data[4];
+out vec4 frag_data[3];
#else
#define frag_data gl_FragData
#endif
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index 0d49c5a339..205b6441e7 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -163,7 +163,7 @@ void LLDrawPoolWLSky::renderDome(const LLVector3& camPosLocal, F32 camHeightLoca
void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 camHeightLocal) const
{
- if (gPipeline.useAdvancedAtmospherics() && gPipeline.canUseWindLightShaders() && gAtmosphere)
+ if (gPipeline.useAdvancedAtmospherics() && gPipeline.canUseWindLightShaders())
{
sky_shader->bind();
@@ -192,7 +192,7 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca
sky_shader->uniform3f(sCamPosLocal, camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]);
renderFsSky(camPosLocal, camHeightLocal, sky_shader);
-
+
sky_shader->unbind();
}
}
@@ -497,18 +497,22 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass)
if (gPipeline.canUseWindLightShaders())
{
- if (gPipeline.useAdvancedAtmospherics())
{
- renderSkyHazeDeferred(origin, camHeightLocal);
- renderHeavenlyBodies();
- }
- else
- {
- // Disable depth-test for sky, but re-enable depth writes for the cloud
- // rendering below so the cloud shader can write out depth for the stars to test against
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
- renderSkyHaze(origin, camHeightLocal);
- renderHeavenlyBodies();
+
+ if (gPipeline.useAdvancedAtmospherics())
+ {
+ //LLGLSquashToFarClip far_clip(get_current_projection());
+ renderSkyHazeDeferred(origin, camHeightLocal);
+ }
+ else
+ {
+ // Disable depth-test for sky, but re-enable depth writes for the cloud
+ // rendering below so the cloud shader can write out depth for the stars to test against
+ renderSkyHaze(origin, camHeightLocal);
+
+ }
+ renderHeavenlyBodies();
}
renderSkyClouds(origin, camHeightLocal);
}
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index 18a7c1d242..8e29e4cf32 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -62,6 +62,8 @@
#include "llenvironment.h"
#include "lltrans.h"
+#pragma optimize("", off)
+
extern LLControlGroup gSavedSettings;
//=========================================================================
@@ -198,9 +200,33 @@ BOOL LLFloaterEditExtDayCycle::postBuild()
LLTabContainer* tab_container = mSkyTabLayoutContainer->getChild<LLTabContainer>("sky_tabs");
S32 tab_count = tab_container->getTabCount();
+ LLSettingsEditPanel *panel = nullptr;
+
+ // Add or remove density tab as necessary
+ // Must be before operation on all tabs below
+ if (gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics"))
+ {
+ panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("panel_settings_sky_density"));
+ if (!panel)
+ {
+ panel = new LLPanelSettingsSkyDensityTab;
+ panel->buildFromFile("panel_settings_sky_density.xml");
+ tab_container->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(false));
+ }
+ }
+ else
+ {
+ panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("panel_settings_sky_density"));
+ if (panel)
+ {
+ tab_container->removeTabPanel(panel);
+ }
+ delete panel;
+ }
+
for (S32 idx = 0; idx < tab_count; ++idx)
{
- LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(tab_container->getPanelByIndex(idx));
+ panel = static_cast<LLSettingsEditPanel *>(tab_container->getPanelByIndex(idx));
if (panel)
panel->setOnDirtyFlagChanged([this](LLPanel *, bool val) { onPanelDirtyFlagChanged(val); });
}
@@ -813,7 +839,7 @@ void LLFloaterEditExtDayCycle::updateWaterTabs(const LLSettingsWaterPtr_t &p_wat
void LLFloaterEditExtDayCycle::updateSkyTabs(const LLSettingsSkyPtr_t &p_sky)
{
- LLView* tab_container = mSkyTabLayoutContainer->getChild<LLView>(TABS_SKYS); //can't extract panels directly, since they are in 'tuple'
+ LLTabContainer* tab_container = mSkyTabLayoutContainer->getChild<LLTabContainer>(TABS_SKYS); //can't extract panels directly, since they are in 'tuple'
LLPanelSettingsSky* panel;
panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("atmosphere_panel"));
@@ -831,6 +857,29 @@ void LLFloaterEditExtDayCycle::updateSkyTabs(const LLSettingsSkyPtr_t &p_sky)
{
panel->setSky(p_sky);
}
+
+ if (gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics"))
+ {
+ panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("panel_settings_sky_density"));
+ if (!panel)
+ {
+ panel = new LLPanelSettingsSkyDensityTab;
+ panel->buildFromFile("panel_settings_sky_density.xml");
+ panel->setOnDirtyFlagChanged([this](LLPanel *, bool value) { onPanelDirtyFlagChanged(value); });
+ tab_container->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(false));
+ }
+ panel->setSky(std::static_pointer_cast<LLSettingsSky>(p_sky));
+ }
+ else
+ {
+ panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("panel_settings_sky_density"));
+ if (panel)
+ {
+ tab_container->removeTabPanel(panel);
+ }
+ delete panel;
+ }
+
}
void LLFloaterEditExtDayCycle::updateButtons()
diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp
index 09a05eb7e2..e5d6412218 100644
--- a/indra/newview/llfloaterfixedenvironment.cpp
+++ b/indra/newview/llfloaterfixedenvironment.cpp
@@ -55,6 +55,8 @@
#include "llsettingsvo.h"
#include "llinventorymodel.h"
+#pragma optimize("", off)
+
extern LLControlGroup gSavedSettings;
namespace
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 88984d518a..ebc55fa0dd 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -410,6 +410,17 @@ static bool handleRenderDeferredChanged(const LLSD& newvalue)
return true;
}
+static bool handleRenderUseAdvancedAtmosphericsChanged(const LLSD& newvalue)
+{
+ if (gPipeline.isInit())
+ {
+ LLPipeline::refreshCachedSettings();
+ // Need to reload shaders when changing atmospherics implementations...
+ LLViewerShaderMgr::instance()->setShaders();
+ }
+ return true;
+}
+
// This looks a great deal like handleRenderDeferredChanged because
// Advanced Lighting (Materials) implies bumps and shiny so disabling
// bumps should further disable that feature.
@@ -644,6 +655,7 @@ void settings_setup_listeners()
gSavedSettings.getControl("RenderDebugPipeline")->getSignal()->connect(boost::bind(&handleRenderDebugPipelineChanged, _2));
gSavedSettings.getControl("RenderResolutionDivisor")->getSignal()->connect(boost::bind(&handleRenderResolutionDivisorChanged, _2));
gSavedSettings.getControl("RenderDeferred")->getSignal()->connect(boost::bind(&handleRenderDeferredChanged, _2));
+ gSavedSettings.getControl("RenderUseAdvancedAtmospherics")->getSignal()->connect(boost::bind(&handleRenderUseAdvancedAtmosphericsChanged, _2));
gSavedSettings.getControl("RenderShadowDetail")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
gSavedSettings.getControl("RenderDeferredSSAO")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
gSavedSettings.getControl("RenderPerformanceTest")->getSignal()->connect(boost::bind(&handleRenderPerfTestChanged, _2));
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index cd378c0a56..5e7e87c163 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -2139,7 +2139,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT];
gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY;
- if (mVertexShaderLevel[SHADER_WINDLIGHT] >= 3)
+ if (mVertexShaderLevel[SHADER_WINDLIGHT] > 1)
{
gDeferredWLSkyProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink();
}
@@ -3537,13 +3537,13 @@ BOOL LLViewerShaderMgr::loadShadersWindLight()
return TRUE;
}
- if (mVertexShaderLevel[SHADER_WINDLIGHT] >= 3)
+ if (mVertexShaderLevel[SHADER_WINDLIGHT] > 1)
{
// Prepare precomputed atmospherics textures using libatmosphere
LLAtmosphere::initClass();
}
- if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] < 3))
+ if (success)
{
gWLSkyProgram.mName = "Windlight Sky Shader";
//gWLSkyProgram.mFeatures.hasGamma = true;
@@ -3567,7 +3567,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight()
success = gWLCloudProgram.createShader(NULL, NULL);
}
- if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] < 3))
+ if (success)
{
gWLSunProgram.mName = "Windlight Sun Program";
gWLSunProgram.mShaderFiles.clear();
@@ -3585,7 +3585,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight()
success = gWLSunProgram.createShader(NULL, NULL);
}
- if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] < 3))
+ if (success)
{
gWLMoonProgram.mName = "Windlight Moon Program";
gWLMoonProgram.mShaderFiles.clear();
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index d265ba9fb8..1522403990 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -1048,7 +1048,7 @@ void LLPipeline::refreshCachedSettings()
RenderAvatarVP = gSavedSettings.getBOOL("RenderAvatarVP");
WindLightUseAtmosShaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders");
RenderDeferred = gSavedSettings.getBOOL("RenderDeferred");
- sUseAdvancedAtmospherics = gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics");
+ sUseAdvancedAtmospherics = WindLightUseAtmosShaders && gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics");
RenderDeferredSunWash = gSavedSettings.getF32("RenderDeferredSunWash");
RenderFSAASamples = gSavedSettings.getU32("RenderFSAASamples");
RenderResolutionDivisor = gSavedSettings.getU32("RenderResolutionDivisor");
diff --git a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml
index 7a5c9cb63f..aec71fda07 100644
--- a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml
+++ b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml
@@ -520,6 +520,7 @@ Select a key frame from the timeline above to edit settings.
left_delta="0"
top_pad="5"
name="moon_panel" />
+ <!-- added programatically so it doesn't show up whether we want it or not
<panel
border="true"
class="panel_settings_density"
@@ -529,6 +530,7 @@ Select a key frame from the timeline above to edit settings.
left_delta="0"
top_pad="5"
name="density_panel" />
+ -->
</tab_container>
</layout_panel>
</layout_stack>