summaryrefslogtreecommitdiff
path: root/indra/newview/pipeline.cpp
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-03-07 10:56:26 -0800
committerGraham Linden <graham@lindenlab.com>2019-03-07 10:56:26 -0800
commit423fa1ac297e39c9395f45490278b8751188b6db (patch)
tree35b1689b3121f59448e53d06ba22f7d4118df305 /indra/newview/pipeline.cpp
parentf488e5855a310d0db55baac758da5c2f8621d2ee (diff)
SL-10618, SL-10698
Fix reflection/distortion map culling planes again. Fix broken handling of shadow disables in ALM forward shaders.
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r--indra/newview/pipeline.cpp98
1 files changed, 67 insertions, 31 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 2adee2a0ae..6e7e8eef21 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -403,7 +403,8 @@ LLPipeline::LLPipeline() :
mLightMovingMask(0),
mLightingDetail(0),
mScreenWidth(0),
- mScreenHeight(0)
+ mScreenHeight(0),
+ mNeedsShadowTargetClear(true)
{
mNoiseMap = 0;
mTrueNoiseMap = 0;
@@ -9336,7 +9337,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
S32 occlusion = LLPipeline::sUseOcclusion;
//disable occlusion culling for reflection map for now
- LLPipeline::sUseOcclusion = 0;
+ //LLPipeline::sUseOcclusion = 0;
glh::matrix4f current = get_current_modelview();
@@ -9484,7 +9485,8 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
//clip out geometry on the same side of water as the camera w/ enough margin to not include the water geo itself,
// but not so much as to clip out parts of avatars that should be seen under the water in the distortion map
- LLPlane plane(pnorm, -water_height * LLPipeline::sDistortionWaterClipPlaneMargin);
+ LLPlane plane(-pnorm, water_height * LLPipeline::sDistortionWaterClipPlaneMargin);
+
LLGLUserClipPlane clip_plane(plane, current, projection);
gGL.setColorMask(true, true);
@@ -9503,7 +9505,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
renderGeom(camera);
- /*if (LLGLSLShader::sNoFixedFunction)
+ if (LLGLSLShader::sNoFixedFunction)
{
gUIProgram.bind();
}
@@ -9513,7 +9515,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
if (LLGLSLShader::sNoFixedFunction)
{
gUIProgram.unbind();
- }*/
+ }
mWaterDis.flush();
}
@@ -10090,11 +10092,33 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
{
if (!sRenderDeferred || RenderShadowDetail <= 0)
{
+ if (mNeedsShadowTargetClear)
+ {
+ LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
+
+ for (S32 j = 0; j < 6; j++)
+ {
+ LLRenderTarget* shadow_target = getShadowTarget(j);
+ if (shadow_target)
+ {
+ shadow_target->bindTarget();
+ shadow_target->clear();
+ shadow_target->flush();
+ }
+ }
+ mNeedsShadowTargetClear = false;
+ }
+
return;
}
+ mNeedsShadowTargetClear = true;
+
LL_RECORD_BLOCK_TIME(FTM_GEN_SUN_SHADOW);
+ LLEnvironment& environment = LLEnvironment::instance();
+ LLSettingsSky::ptr_t psky = environment.getCurrentSky();
+
bool skip_avatar_update = false;
if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson)
{
@@ -10156,6 +10180,43 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
gGL.setColorMask(false, false);
}
+ bool sun_up = environment.getIsSunUp();
+ bool moon_up = environment.getIsMoonUp();
+ bool ignore_shadows = (shadow_detail == 0)
+ || (sun_up && (mSunDiffuse == LLColor4::black))
+ || (moon_up && (mMoonDiffuse == LLColor4::black))
+ || !(sun_up || moon_up);
+
+ if (ignore_shadows)
+ { //sun diffuse is totally black, shadows don't matter
+ LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
+
+ for (S32 j = 0; j < 4; j++)
+ {
+ LLRenderTarget* shadow_target = getShadowTarget(j);
+ if (shadow_target)
+ {
+ shadow_target->bindTarget();
+ shadow_target->clear();
+ shadow_target->flush();
+ }
+ }
+
+ if (shadow_detail == 0)
+ {
+ for (S32 j = 4; j < 6; j++)
+ {
+ LLRenderTarget* shadow_target = getShadowTarget(j);
+ if (shadow_target)
+ {
+ shadow_target->bindTarget();
+ shadow_target->clear();
+ shadow_target->flush();
+ }
+ }
+ }
+ }
+
//get sun view matrix
//store current projection/modelview matrix
@@ -10181,9 +10242,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
//LLVector3 n = RenderShadowNearDist;
//F32 nearDist[] = { n.mV[0], n.mV[1], n.mV[2], n.mV[2] };
- LLEnvironment& environment = LLEnvironment::instance();
- LLSettingsSky::ptr_t psky = environment.getCurrentSky();
-
LLVector3 caster_dir(environment.getIsSunUp() ? mSunDir : mMoonDir);
//put together a universal "near clip" plane for shadow frusta
@@ -10216,7 +10274,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
up.normVec();
at.normVec();
-
LLCamera main_camera = camera;
F32 near_clip = 0.f;
@@ -10298,28 +10355,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
// convenience array of 4 near clip plane distances
F32 dist[] = { near_clip, mSunClipPlanes.mV[0], mSunClipPlanes.mV[1], mSunClipPlanes.mV[2], mSunClipPlanes.mV[3] };
- bool sun_up = environment.getIsSunUp();
- bool moon_up = environment.getIsMoonUp();
- bool ignore_shadows = (sun_up && (mSunDiffuse == LLColor4::black))
- || (moon_up && (mMoonDiffuse == LLColor4::black))
- || !(sun_up || moon_up);
-
- if (ignore_shadows)
- { //sun diffuse is totally black, shadows don't matter
- LLGLDepthTest depth(GL_TRUE);
-
- for (S32 j = 0; j < 4; j++)
- {
- LLRenderTarget* shadow_target = getShadowTarget(j);
- if (shadow_target)
- {
- shadow_target->bindTarget();
- shadow_target->clear();
- shadow_target->flush();
- }
- }
- }
- else
+ if (!ignore_shadows)
{
for (S32 j = 0; j < 4; j++)
{