summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-01-08 17:20:56 -0800
committerGraham Linden <graham@lindenlab.com>2019-01-08 17:20:56 -0800
commitb865fc88e575e39111418a329362eada368445cd (patch)
tree9e08290dbc80a7c603e4baec36b8f7a72fdf5ee3
parent0931bbbf96b540a8547569b0941c1be810b7c3d4 (diff)
Fix broken distortion map rendering (was culling everything).
Clean up deferred\alpha shader to allow re-entrant graphics switching (link error on 2nd compile/link of deferred shaders). Clean up some uses of pragma(optimize,...).
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl14
-rw-r--r--indra/newview/llcontrolavatar.cpp2
-rw-r--r--indra/newview/llspatialpartition.cpp2
-rw-r--r--indra/newview/llviewershadermgr.cpp4
-rw-r--r--indra/newview/pipeline.cpp31
-rw-r--r--indra/newview/pipeline.h1
6 files changed, 22 insertions, 32 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 9670b39fdb..132364882b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -45,20 +45,6 @@ uniform mat3 ssao_effect_mat;
uniform vec3 sun_dir;
uniform vec3 moon_dir;
-#if HAS_SHADOW
-uniform sampler2DShadow shadowMap0;
-uniform sampler2DShadow shadowMap1;
-uniform sampler2DShadow shadowMap2;
-uniform sampler2DShadow shadowMap3;
-
-uniform vec2 shadow_res;
-
-uniform mat4 shadow_matrix[6];
-uniform vec4 shadow_clip;
-uniform float shadow_bias;
-
-#endif
-
#ifdef USE_DIFFUSE_TEX
uniform sampler2D diffuseMap;
#endif
diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp
index d3fd5813a0..fb61ad4b07 100644
--- a/indra/newview/llcontrolavatar.cpp
+++ b/indra/newview/llcontrolavatar.cpp
@@ -35,8 +35,6 @@
#include "llviewerregion.h"
#include "llskinningutil.h"
-//#pragma optimize("", off)
-
const F32 LLControlAvatar::MAX_LEGAL_OFFSET = 3.0f;
const F32 LLControlAvatar::MAX_LEGAL_SIZE = 64.0f;
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 1dc1e65fe5..b24f37fc72 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -55,8 +55,6 @@
#include "llviewershadermgr.h"
#include "llcontrolavatar.h"
-//#pragma optimize("", off)
-
static LLTrace::BlockTimerStatHandle FTM_FRUSTUM_CULL("Frustum Culling");
static LLTrace::BlockTimerStatHandle FTM_CULL_REBOUND("Cull Rebound Partition");
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 85a13d9990..000d67a4e2 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -49,10 +49,6 @@
#include "lljoint.h"
#include "llskinningutil.h"
-#if LL_WINDOWS
-#pragma optimize("", off)
-#endif
-
static LLStaticHashedString sTexture0("texture0");
static LLStaticHashedString sTexture1("texture1");
static LLStaticHashedString sTex0("tex0");
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index e60828a81c..887421d3f8 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -336,6 +336,7 @@ bool LLPipeline::sShadowRender = false;
bool LLPipeline::sWaterReflections = false;
bool LLPipeline::sRenderGlow = false;
bool LLPipeline::sReflectionRender = false;
+bool LLPipeline::sDistortionRender = false;
bool LLPipeline::sImpostorRender = false;
bool LLPipeline::sImpostorRenderAlphaDepthPass = false;
bool LLPipeline::sUnderWaterRender = false;
@@ -2425,7 +2426,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
if (to_texture)
{
- if (LLPipeline::sRenderDeferred && LLPipeline::sReflectionRender)
+ if (LLPipeline::sRenderDeferred && LLPipeline::sReflectionRender)
{
mWaterOcclusionDepth.bindTarget();
}
@@ -8330,7 +8331,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
(F32) gGLViewport[3]);
}
- if (sReflectionRender && shader.getUniformLocation(LLShaderMgr::MODELVIEW_MATRIX))
+ if (sReflectionRender && !LLPipeline::sDistortionRender && !shader.getUniformLocation(LLShaderMgr::MODELVIEW_MATRIX))
{
shader.uniformMatrix4fv(LLShaderMgr::MODELVIEW_MATRIX, 1, FALSE, mReflectionModelView.m);
}
@@ -9613,6 +9614,8 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
static bool last_update = true;
if (last_update)
{
+ gPipeline.pushRenderTypeMask();
+
camera.setFar(camera_in.getFar());
clearRenderTypeMask(LLPipeline::RENDER_TYPE_WATER,
LLPipeline::RENDER_TYPE_VOIDWATER,
@@ -9620,7 +9623,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
END_RENDER_TYPES);
stop_glerror();
- LLPipeline::sUnderWaterRender = ! LLViewerCamera::getInstance()->cameraUnderWater();
+ LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater();
if (LLPipeline::sUnderWaterRender)
{
@@ -9632,6 +9635,8 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
}
LLViewerCamera::updateFrustumPlanes(camera);
+ LLPipeline::sDistortionRender = true;
+
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLColor3 col = LLEnvironment::instance().getCurrentWater()->getWaterFogColor();
@@ -9645,28 +9650,30 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
{
//clip out geometry on the same side of water as the camera
mat = get_current_modelview();
- LLPlane plane(-pnorm, -distance_to_water);
- LLGLUserClipPlane clip_plane(plane, mat, projection);
+ LLPlane plane(pnorm, water_height);
+ LLGLUserClipPlane clip_plane(plane, mat, projection);
+
static LLCullResult result;
updateCull(camera, result, water_clip, &plane);
stateSort(camera, result);
gGL.setColorMask(true, true);
mWaterDis.clear();
-
-
gGL.setColorMask(true, false);
-
if (LLPipeline::sRenderDeferred)
{
mWaterDis.flush();
- gPipeline.mWaterDeferredScreen.bindTarget();
- gGL.setColorMask(true, true);
+ gGL.setColorMask(true, true);
glClearColor(0,0,0,0);
+ gPipeline.mWaterDeferredDepth.bindTarget();
+ gPipeline.mWaterDeferredDepth.clear();
+ gPipeline.mWaterDeferredScreen.bindTarget();
gPipeline.mWaterDeferredScreen.clear();
gPipeline.grabReferences(result);
+ gGL.setColorMask(true, false);
+
renderGeomDeferred(camera);
}
else
@@ -9696,6 +9703,10 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
}
mWaterDis.flush();
+
+ LLPipeline::sDistortionRender = false;
+
+ gPipeline.popRenderTypeMask();
}
last_update = LLDrawPoolWater::sNeedsReflectionUpdate && LLDrawPoolWater::sNeedsDistortionUpdate;
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 66cae8bf72..c76b91266e 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -580,6 +580,7 @@ public:
static bool sDynamicLOD;
static bool sPickAvatar;
static bool sReflectionRender;
+ static bool sDistortionRender;
static bool sImpostorRender;
static bool sImpostorRenderAlphaDepthPass;
static bool sUnderWaterRender;