summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llmath/llcamera.cpp5
-rw-r--r--indra/llmath/llcamera.h1
-rw-r--r--indra/newview/lldrawpoolalpha.cpp121
-rw-r--r--indra/newview/lldrawpoolwater.cpp24
-rw-r--r--indra/newview/llfloaterpreference.cpp10
-rw-r--r--indra/newview/llviewershadermgr.cpp19
-rw-r--r--indra/newview/pipeline.cpp66
-rw-r--r--indra/newview/pipeline.h1
8 files changed, 98 insertions, 149 deletions
diff --git a/indra/llmath/llcamera.cpp b/indra/llmath/llcamera.cpp
index ff90532f75..9034182072 100644
--- a/indra/llmath/llcamera.cpp
+++ b/indra/llmath/llcamera.cpp
@@ -93,6 +93,11 @@ F32 LLCamera::getMaxView() const
: MAX_FIELD_OF_VIEW; // narrow views
}
+LLPlane LLCamera::getUserClipPlane()
+{
+ return mAgentPlanes[AGENT_PLANE_USER_CLIP];
+}
+
// ---------------- LLCamera::setFoo() member functions ----------------
void LLCamera::setUserClipPlane(LLPlane& plane)
diff --git a/indra/llmath/llcamera.h b/indra/llmath/llcamera.h
index 321b8ddcc4..d0afa0e88f 100644
--- a/indra/llmath/llcamera.h
+++ b/indra/llmath/llcamera.h
@@ -154,6 +154,7 @@ public:
bool isChanged(); //check if mAgentPlanes changed since last frame.
+ LLPlane getUserClipPlane();
void setUserClipPlane(LLPlane& plane);
void disableUserClipPlane();
virtual void setView(F32 vertical_fov_rads);
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 73582e2345..b896ecde30 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -90,7 +90,7 @@ S32 LLDrawPoolAlpha::getNumPostDeferredPasses()
void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass)
{
- LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA);
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_DEFERRED);
if (pass == 0)
{
@@ -115,20 +115,14 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass)
fullbright_shader->bind();
fullbright_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
fullbright_shader->uniform1f(LLShaderMgr::DISPLAY_GAMMA, (gamma > 0.1f) ? 1.0f / gamma : (1.0f/2.2f));
- fullbright_shader->unbind();
+ fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, LLPipeline::sRenderingHUDs ? 1 : 0);
+ fullbright_shader->setMinimumAlpha(LLPipeline::sImpostorRender ? 0.5f : 0.0f);
+ fullbright_shader->unbind();
- if (LLPipeline::sRenderingHUDs)
- {
- fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
//prime simple shader (loads shadow relevant uniforms)
gPipeline.bindDeferredShader(*simple_shader);
-
- simple_shader->uniform1f(LLShaderMgr::DISPLAY_GAMMA, (gamma > 0.1f) ? 1.0f / gamma : (1.0f/2.2f));
+ simple_shader->uniform1f(LLShaderMgr::DISPLAY_GAMMA, (gamma > 0.1f) ? 1.0f / gamma : (1.0f/2.2f));
+ simple_shader->setMinimumAlpha(LLPipeline::sImpostorRender ? 0.5f : 0.0f);
}
else if (!LLPipeline::sImpostorRender)
{
@@ -170,6 +164,8 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass)
void LLDrawPoolAlpha::endPostDeferredPass(S32 pass)
{
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_DEFERRED);
+
if (pass == 1 && !LLPipeline::sImpostorRender)
{
gPipeline.mDeferredDepth.flush();
@@ -183,6 +179,7 @@ void LLDrawPoolAlpha::endPostDeferredPass(S32 pass)
void LLDrawPoolAlpha::renderPostDeferred(S32 pass)
{
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_DEFERRED);
render(pass);
}
@@ -195,6 +192,18 @@ void LLDrawPoolAlpha::beginRenderPass(S32 pass)
simple_shader = &gObjectSimpleImpostorProgram;
fullbright_shader = &gObjectFullbrightProgram;
emissive_shader = &gObjectEmissiveProgram;
+
+ if (mShaderLevel > 0)
+ {
+ fullbright_shader->bind();
+ fullbright_shader->setMinimumAlpha(0.5f);
+ simple_shader->bind();
+ simple_shader->setMinimumAlpha(0.5f);
+ }
+ else
+ {
+ gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); //OK
+ }
}
else if (LLPipeline::sUnderWaterRender)
{
@@ -209,12 +218,20 @@ void LLDrawPoolAlpha::beginRenderPass(S32 pass)
emissive_shader = &gObjectEmissiveProgram;
}
- if (mShaderLevel > 0)
+ if (!LLPipeline::sImpostorRender)
{
- // Start out with no shaders.
- current_shader = target_shader = NULL;
- LLGLSLShader::bindNoShader();
- }
+ if (mShaderLevel > 0)
+ {
+ fullbright_shader->bind();
+ fullbright_shader->setMinimumAlpha(0.f);
+ simple_shader->bind();
+ simple_shader->setMinimumAlpha(0.f);
+ }
+ else
+ {
+ gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); //OK
+ }
+ }
gPipeline.enableLightsDynamic();
}
@@ -264,66 +281,7 @@ void LLDrawPoolAlpha::render(S32 pass)
mAlphaDFactor = LLRender::BF_ONE_MINUS_SOURCE_ALPHA; // }
gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
- if (mShaderLevel > 0)
- {
- if (LLPipeline::sImpostorRender)
- {
- fullbright_shader->bind();
- fullbright_shader->setMinimumAlpha(0.5f);
- if (LLPipeline::sRenderingHUDs)
- {
- fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
- simple_shader->bind();
- simple_shader->setMinimumAlpha(0.5f);
- if (LLPipeline::sRenderingHUDs)
- {
- simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
- }
- else
- {
- fullbright_shader->bind();
- fullbright_shader->setMinimumAlpha(0.f);
- if (LLPipeline::sRenderingHUDs)
- {
- fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
- simple_shader->bind();
- simple_shader->setMinimumAlpha(0.f);
- if (LLPipeline::sRenderingHUDs)
- {
- simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
- }
- }
- else
- {
- if (LLPipeline::sImpostorRender)
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); //OK
- }
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); //OK
- }
- }
+
}
if (mShaderLevel > 0)
@@ -650,14 +608,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
LLRender::BF_ONE, LLRender::BF_ONE); // add to alpha (glow)
emissive_shader->bind();
- if (LLPipeline::sRenderingHUDs)
- {
- emissive_shader->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- emissive_shader->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
+
params.mVertexBuffer->setBuffer((mask & ~LLVertexBuffer::MAP_COLOR) | LLVertexBuffer::MAP_EMISSIVE);
// do the actual drawing, again
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index f5a41fd5f6..5760a28049 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -619,9 +619,6 @@ void LLDrawPoolWater::shade2(bool edge, LLGLSLShader* shader, const LLColor3& li
{
LLGLDisable cullface(GL_CULL_FACE);
- sNeedsReflectionUpdate = TRUE;
- sNeedsDistortionUpdate = TRUE;
-
if (edge)
{
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); iter != mDrawFace.end(); iter++)
@@ -632,10 +629,14 @@ void LLDrawPoolWater::shade2(bool edge, LLGLSLShader* shader, const LLColor3& li
LLVOWater* water = (LLVOWater*) face->getViewerObject();
gGL.getTexUnit(diffTex)->bind(face->getTexture());
- bool edge_patch = water && water->getIsEdgePatch();
- if (edge_patch)
+ if (water)
{
- face->renderIndexed();
+ bool edge_patch = water->getIsEdgePatch();
+ if (edge_patch)
+ {
+ sNeedsReflectionUpdate = TRUE;
+ face->renderIndexed();
+ }
}
}
}
@@ -650,10 +651,15 @@ void LLDrawPoolWater::shade2(bool edge, LLGLSLShader* shader, const LLColor3& li
LLVOWater* water = (LLVOWater*) face->getViewerObject();
gGL.getTexUnit(diffTex)->bind(face->getTexture());
- bool edge_patch = water && water->getIsEdgePatch();
- if (!edge_patch)
+ if (water)
{
- face->renderIndexed();
+ bool edge_patch = water->getIsEdgePatch();
+ if (!edge_patch)
+ {
+ sNeedsReflectionUpdate = TRUE;
+ sNeedsDistortionUpdate = TRUE;
+ face->renderIndexed();
+ }
}
}
}
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 4eb2814dfb..55796b1e7f 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -1355,13 +1355,6 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState()
ctrl_ssao->setEnabled(enabled);
ctrl_dof->setEnabled(enabled);
-#if USE_ADVANCED_ATMOSPHERICS
- LLCheckBoxCtrl* ctrl_advanced_atmo = getChild<LLCheckBoxCtrl>("UseAdvancedAtmo");
-
- bool advanced_atmo_enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderUseAdvancedAtmospherics");
- ctrl_advanced_atmo->setEnabled(advanced_atmo_enabled);
-#endif
-
enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail");
ctrl_shadow->setEnabled(enabled);
@@ -2759,9 +2752,6 @@ LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const L
: LLFloater(key)
{
mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onVertexShaderEnable, this));
-#if USE_ADVANCED_ATMOSPHERICS
- mCommitCallbackRegistrar.add("Pref.AdvancedAtmosphericsEnable", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onAdvancedAtmosphericsEnable, this));
-#endif
mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxNonImpostors", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors,this));
mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity,this));
}
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 4beeec378d..c66e46872d 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -498,15 +498,6 @@ void LLViewerShaderMgr::setShaders()
transform_class = 0;
}
- #if USE_ADVANCED_ATMOSPHERICS
- bool useAdvancedAtmospherics = doingWindLight && gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics");
- if (useAdvancedAtmospherics)
- {
- deferred_class = 3;
- wl_class = 3;
- }
- #endif
-
if (useRenderDeferred && doingWindLight)
{
//shadows
@@ -515,7 +506,6 @@ void LLViewerShaderMgr::setShaders()
case 0: deferred_class = 1; break; // no shadows
case 1: deferred_class = 2; break; // PCF shadows
case 2: deferred_class = 2; break; // PCF shadows
- case 3: deferred_class = 3; break; // VSM shadows
default:
break;
}
@@ -3820,15 +3810,6 @@ BOOL LLViewerShaderMgr::loadShadersWindLight()
return TRUE;
}
-#if USE_ADVANCED_ATMOSPHERICS
-// disabled until we can determine why low-end machines crash during this init...
- if (gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics") && mShaderLevel[SHADER_WINDLIGHT] > 2)
- {
- // Prepare precomputed atmospherics textures using libatmosphere
- LLAtmosphere::initClass();
- }
-#endif
-
if (success)
{
gWLSkyProgram.mName = "Windlight Sky Shader";
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index f73d79776d..333fae558a 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -235,6 +235,7 @@ LLTrace::BlockTimerStatHandle FTM_RENDER_UI("UI");
LLTrace::BlockTimerStatHandle FTM_RENDER_WATER("Water");
LLTrace::BlockTimerStatHandle FTM_RENDER_WL_SKY("Windlight Sky");
LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA("Alpha Objects");
+LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_DEFERRED("Alpha Deferred Objects");
LLTrace::BlockTimerStatHandle FTM_RENDER_CHARACTERS("Avatars");
LLTrace::BlockTimerStatHandle FTM_RENDER_BUMP("Bump");
LLTrace::BlockTimerStatHandle FTM_RENDER_MATERIALS("Render Materials");
@@ -2531,13 +2532,17 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
gSky.mVOWLSkyp->mDrawable->setVisible(camera);
sCull->pushDrawable(gSky.mVOWLSkyp->mDrawable);
}
-
+
+// not currently enabled as it causes reflection/distortion map
+// rendering to occur every frame instead of periodically for visible near water
+#if PRECULL_WATER_OBJECTS
bool render_water = !sReflectionRender && (hasRenderType(LLPipeline::RENDER_TYPE_WATER) || hasRenderType(LLPipeline::RENDER_TYPE_VOIDWATER));
if (render_water)
{
LLWorld::getInstance()->precullWaterObjects(camera, sCull, render_water);
}
+#endif
gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.popMatrix();
@@ -9381,9 +9386,11 @@ inline float sgn(float a)
}
void LLPipeline::generateWaterReflection(LLCamera& camera_in)
-{
+{
if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate)
{
+ LLPlane restore_plane = LLViewerCamera::getInstance()->getUserClipPlane();
+
bool skip_avatar_update = false;
if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson)
{
@@ -9427,6 +9434,10 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
LLVector3 reflect_origin = camera_in.getOrigin() - reflection_offset;
LLVector3 reflect_interest_point = reflect_origin + (reflection_look_at * 5.0f);
+ U32 reflected_objects_size = 0;
+ U32 sky_and_clouds_size = 0;
+ U32 refracted_objects_size = 0;
+
camera.setOriginAndLookAt(reflect_origin, LLVector3::z_axis, reflect_interest_point);
//plane params
@@ -9506,6 +9517,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
static LLCullResult sky_and_clouds;
updateCull(camera, sky_and_clouds);
stateSort(camera, sky_and_clouds);
+
+ sky_and_clouds_size = sky_and_clouds.getVisibleListSize();
+
gPipeline.grabReferences(sky_and_clouds);
if (materials_in_water)
@@ -9565,6 +9579,8 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
updateCull(camera, reflected_objects);
stateSort(camera, reflected_objects);
+ reflected_objects_size = reflected_objects.getVisibleListSize();
+
gPipeline.grabReferences(reflected_objects);
if (materials_in_water)
@@ -9602,8 +9618,6 @@ 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,
@@ -9627,28 +9641,24 @@ 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();
- glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f);
- mWaterDis.bindTarget();
- LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER1;
-
- mWaterDis.getViewport(gGLViewport);
-
- if (LLPipeline::sUnderWaterRender || LLDrawPoolWater::sNeedsReflectionUpdate)
+ if (!LLPipeline::sUnderWaterRender || LLDrawPoolWater::sNeedsDistortionUpdate)
{
+ LLPipeline::sDistortionRender = true;
+
+ LLColor3 col = LLEnvironment::instance().getCurrentWater()->getWaterFogColor();
+ glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f);
+ mWaterDis.bindTarget();
+ LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER1;
+
+ mWaterDis.getViewport(gGLViewport);
+
//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);
- LLGLUserClipPlane clip_plane(plane, mReflectionModelView, projection);
-
- static LLCullResult refracted_objects;
- updateCull(camera, refracted_objects, water_clip, &plane);
- stateSort(camera, refracted_objects);
+ mat = get_current_modelview();
+ LLGLUserClipPlane clip_plane(plane, mat, projection);
gGL.setColorMask(true, true);
mWaterDis.clear();
@@ -9661,7 +9671,13 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
}
if (materials_in_water)
- {
+ {
+ static LLCullResult refracted_objects;
+ updateCull(camera, refracted_objects, water_clip, &plane);
+ stateSort(camera, refracted_objects);
+ refracted_objects_size = refracted_objects.getVisibleListSize();
+ gPipeline.grabReferences(refracted_objects);
+
mWaterDis.flush();
gGL.setColorMask(true, true);
glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f);
@@ -9669,7 +9685,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
gPipeline.mWaterDeferredDepth.clear();
gPipeline.mWaterDeferredScreen.bindTarget();
gPipeline.mWaterDeferredScreen.clear();
- gPipeline.grabReferences(refracted_objects);
gGL.setColorMask(true, false);
renderGeomDeferred(camera);
renderGeomPostDeferred(camera);
@@ -9698,13 +9713,10 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
mWaterDis.copyContents(gPipeline.mWaterDeferredScreen, 0, 0, gPipeline.mWaterDeferredScreen.getWidth(), gPipeline.mWaterDeferredScreen.getHeight(),
0, 0, gPipeline.mWaterDis.getWidth(), gPipeline.mWaterDis.getHeight(), GL_COLOR_BUFFER_BIT, GL_NEAREST);
}
+ mWaterDis.flush();
}
- mWaterDis.flush();
-
LLPipeline::sDistortionRender = false;
-
- gPipeline.popRenderTypeMask();
}
last_update = LLDrawPoolWater::sNeedsReflectionUpdate && LLDrawPoolWater::sNeedsDistortionUpdate;
@@ -9731,6 +9743,8 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
}
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
+
+ LLViewerCamera::getInstance()->setUserClipPlane(restore_plane);
}
}
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index b3aa48e39f..8a6ae1bc4f 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -75,6 +75,7 @@ extern LLTrace::BlockTimerStatHandle FTM_RENDER_UI;
extern LLTrace::BlockTimerStatHandle FTM_RENDER_WATER;
extern LLTrace::BlockTimerStatHandle FTM_RENDER_WL_SKY;
extern LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA;
+extern LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_DEFERRED;
extern LLTrace::BlockTimerStatHandle FTM_RENDER_CHARACTERS;
extern LLTrace::BlockTimerStatHandle FTM_RENDER_BUMP;
extern LLTrace::BlockTimerStatHandle FTM_RENDER_MATERIALS;