summaryrefslogtreecommitdiff
path: root/indra/newview/pipeline.cpp
diff options
context:
space:
mode:
authorJonathan "Geenz" Goodman <geenz@geenzo.com>2023-10-16 08:48:50 -0700
committerJonathan "Geenz" Goodman <geenz@geenzo.com>2023-10-16 08:48:50 -0700
commitbd9c0a2e658e183bb8a321cdce546f10b6d76afe (patch)
tree349b40b0120af086837a44cf7046990568f59a97 /indra/newview/pipeline.cpp
parent0bfeb74172b172fc3202d67fab04df25e23591b0 (diff)
parent71d0603773a0d406560fc6add8a61f7e8d3cdb27 (diff)
Merge branch 'DRTVWR-559' into DRTVWR-583
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 ffa20aec2d..c18f503c61 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");
@@ -984,7 +979,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");
@@ -1358,39 +1352,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:
@@ -5274,7 +5235,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
@@ -5541,7 +5504,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)
@@ -5684,10 +5649,6 @@ void LLPipeline::enableLights(U32 mask)
{
assertInitialized();
- if (mLightingDetail == 0)
- {
- mask &= 0xf003; // sun and backlight only (and fullbright bit)
- }
if (mLightMask != mask)
{
stop_glerror();
@@ -5715,28 +5676,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
{
@@ -7984,9 +7930,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;
@@ -8021,8 +7967,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)
@@ -8069,24 +8022,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
{