summaryrefslogtreecommitdiff
path: root/indra/newview/pipeline.cpp
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2023-10-04 15:41:44 -0500
committerRunitaiLinden <davep@lindenlab.com>2023-10-04 15:41:44 -0500
commita1a32edf52365415f35cea26b26c011fc4d35984 (patch)
tree1a8d4f428c7654b1ec50341ffa3f33312113e2f4 /indra/newview/pipeline.cpp
parent5d7b1b09ff195611548bababf36d412ef76ed924 (diff)
SL-20141 Remove "Local Lights" checkbox and instead make the number of lights rendered scale with the "Quality & speed" slider
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r--indra/newview/pipeline.cpp107
1 files changed, 28 insertions, 79 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 78d4e65d42..9266c84540 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -130,7 +130,6 @@ S32 LLPipeline::RenderShadowDetail;
S32 LLPipeline::RenderShadowSplits;
bool LLPipeline::RenderDeferredSSAO;
F32 LLPipeline::RenderShadowResolutionScale;
-bool LLPipeline::RenderLocalLights;
bool LLPipeline::RenderDelayCreation;
bool LLPipeline::RenderAnimateRes;
bool LLPipeline::FreezeTime;
@@ -349,8 +348,7 @@ LLPipeline::LLPipeline() :
mResetVertexBuffers(false),
mLastRebuildPool(NULL),
mLightMask(0),
- mLightMovingMask(0),
- mLightingDetail(0)
+ mLightMovingMask(0)
{
mNoiseMap = 0;
mTrueNoiseMap = 0;
@@ -471,8 +469,6 @@ void LLPipeline::init()
mScreenTriangleVB->unmapBuffer();
}
- setLightingDetail(-1);
-
//
// Update all settings to trigger a cached settings refresh
//
@@ -491,7 +487,6 @@ void LLPipeline::init()
connectRefreshCachedSettingsSafe("RenderShadowSplits");
connectRefreshCachedSettingsSafe("RenderDeferredSSAO");
connectRefreshCachedSettingsSafe("RenderShadowResolutionScale");
- connectRefreshCachedSettingsSafe("RenderLocalLights");
connectRefreshCachedSettingsSafe("RenderDelayCreation");
connectRefreshCachedSettingsSafe("RenderAnimateRes");
connectRefreshCachedSettingsSafe("FreezeTime");
@@ -982,7 +977,6 @@ void LLPipeline::refreshCachedSettings()
RenderShadowSplits = gSavedSettings.getS32("RenderShadowSplits");
RenderDeferredSSAO = gSavedSettings.getBOOL("RenderDeferredSSAO");
RenderShadowResolutionScale = gSavedSettings.getF32("RenderShadowResolutionScale");
- RenderLocalLights = gSavedSettings.getBOOL("RenderLocalLights");
RenderDelayCreation = gSavedSettings.getBOOL("RenderDelayCreation");
RenderAnimateRes = gSavedSettings.getBOOL("RenderAnimateRes");
FreezeTime = gSavedSettings.getBOOL("FreezeTime");
@@ -1356,39 +1350,6 @@ void LLPipeline::enableShadows(const bool enable_shadows)
//should probably do something here to wrangle shadows....
}
-S32 LLPipeline::getMaxLightingDetail() const
-{
- /*if (mShaderLevel[SHADER_OBJECT] >= LLDrawPoolSimple::SHADER_LEVEL_LOCAL_LIGHTS)
- {
- return 3;
- }
- else*/
- {
- return 1;
- }
-}
-
-S32 LLPipeline::setLightingDetail(S32 level)
-{
- refreshCachedSettings();
-
- if (level < 0)
- {
- if (RenderLocalLights)
- {
- level = 1;
- }
- else
- {
- level = 0;
- }
- }
- level = llclamp(level, 0, getMaxLightingDetail());
- mLightingDetail = level;
-
- return mLightingDetail;
-}
-
class LLOctreeDirtyTexture : public OctreeTraveler
{
public:
@@ -5251,7 +5212,9 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)
return;
}
- if (mLightingDetail >= 1)
+ static LLCachedControl<S32> local_light_count(gSavedSettings, "RenderLocalLightCount", 256);
+
+ if (local_light_count >= 1)
{
// mNearbyLight (and all light_set_t's) are sorted such that
// begin() == the closest light and rbegin() == the farthest light
@@ -5518,7 +5481,9 @@ void LLPipeline::setupHWLights()
mLightMovingMask = 0;
- if (mLightingDetail >= 1)
+ static LLCachedControl<S32> local_light_count(gSavedSettings, "RenderLocalLightCount", 256);
+
+ if (local_light_count >= 1)
{
for (light_set_t::iterator iter = mNearbyLights.begin();
iter != mNearbyLights.end(); ++iter)
@@ -5661,10 +5626,6 @@ void LLPipeline::enableLights(U32 mask)
{
assertInitialized();
- if (mLightingDetail == 0)
- {
- mask &= 0xf003; // sun and backlight only (and fullbright bit)
- }
if (mLightMask != mask)
{
stop_glerror();
@@ -5692,28 +5653,13 @@ void LLPipeline::enableLights(U32 mask)
}
}
-void LLPipeline::enableLightsStatic()
-{
- assertInitialized();
- U32 mask = 0x01; // Sun
- if (mLightingDetail >= 2)
- {
- mask |= mLightMovingMask; // Hardware moving lights
- }
- else
- {
- mask |= 0xff & (~2); // Hardware local lights
- }
- enableLights(mask);
-}
-
void LLPipeline::enableLightsDynamic()
{
assertInitialized();
U32 mask = 0xff & (~2); // Local lights
enableLights(mask);
- if (isAgentAvatarValid() && getLightingDetail() <= 0)
+ if (isAgentAvatarValid())
{
if (gAgentAvatarp->mSpecialRenderMode == 0) // normal
{
@@ -7961,9 +7907,9 @@ void LLPipeline::renderDeferredLighting()
unbindDeferredShader(LLPipeline::sUnderWaterRender ? gDeferredSoftenWaterProgram : gDeferredSoftenProgram);
}
- bool render_local = RenderLocalLights; // && !gCubeSnapshot;
+ static LLCachedControl<S32> local_light_count(gSavedSettings, "RenderLocalLightCount", 256);
- if (render_local)
+ if (local_light_count > 0)
{
gGL.setSceneBlendType(LLRender::BT_ADD);
std::list<LLVector4> fullscreen_lights;
@@ -7998,8 +7944,15 @@ void LLPipeline::renderDeferredLighting()
// mNearbyLights already includes distance calculation and excludes muted avatars.
// It is calculated from mLights
// mNearbyLights also provides fade value to gracefully fade-out out of range lights
+ S32 count = 0;
for (light_set_t::iterator iter = mNearbyLights.begin(); iter != mNearbyLights.end(); ++iter)
{
+ count++;
+ if (count > local_light_count)
+ { //stop collecting lights once we hit the limit
+ break;
+ }
+
LLDrawable * drawablep = iter->drawable;
LLVOVolume * volume = drawablep->getVOVolume();
if (!volume)
@@ -8046,24 +7999,20 @@ void LLPipeline::renderDeferredLighting()
camera->getOrigin().mV[1] > c[1] + s + 0.2f || camera->getOrigin().mV[1] < c[1] - s - 0.2f ||
camera->getOrigin().mV[2] > c[2] + s + 0.2f || camera->getOrigin().mV[2] < c[2] - s - 0.2f)
{ // draw box if camera is outside box
- if (render_local)
+ if (volume->isLightSpotlight())
{
- if (volume->isLightSpotlight())
- {
- drawablep->getVOVolume()->updateSpotLightPriority();
- spot_lights.push_back(drawablep);
- continue;
- }
+ drawablep->getVOVolume()->updateSpotLightPriority();
+ spot_lights.push_back(drawablep);
+ continue;
+ }
- gDeferredLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c);
- gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s);
- gDeferredLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
- gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff(DEFERRED_LIGHT_FALLOFF));
- gGL.syncMatrices();
+ gDeferredLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c);
+ gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s);
+ gDeferredLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
+ gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff(DEFERRED_LIGHT_FALLOFF));
+ gGL.syncMatrices();
- mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, center));
- stop_glerror();
- }
+ mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, center));
}
else
{