summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-04-26 14:42:06 +0100
committerTofu Linden <tofu.linden@lindenlab.com>2010-04-26 14:42:06 +0100
commit0655104fa2339fd0b8e5a0385e5a1d8141834a88 (patch)
treebedde1fad1c13c46be961af2408cc175ac21bfca /indra
parente53c35ac607c75abcad62a7ec05b0ef558af1ec5 (diff)
EXT-7060 default auto alpha masking to ON for deferred rendering (only deferred rendering)
(transplanted from 050ae2c9451a6b89374c5a10403f373e2475f23b)
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/settings.xml15
-rw-r--r--indra/newview/lldrawpoolalpha.cpp2
-rw-r--r--indra/newview/llface.cpp20
-rw-r--r--indra/newview/llface.h40
-rw-r--r--indra/newview/llspatialpartition.h2
-rw-r--r--indra/newview/llviewercontrol.cpp3
-rw-r--r--indra/newview/llviewerdisplay.cpp3
-rw-r--r--indra/newview/llvovolume.cpp21
-rw-r--r--indra/newview/pipeline.cpp3
-rw-r--r--indra/newview/pipeline.h3
-rw-r--r--indra/newview/skins/default/xui/en/menu_viewer.xml18
11 files changed, 82 insertions, 48 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 43e7f1c06c..5014ba3349 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -6973,10 +6973,10 @@
<key>Value</key>
<real>256.0</real>
</map>
- <key>RenderFastAlpha</key>
+ <key>RenderAutoMaskAlphaNonDeferred</key>
<map>
<key>Comment</key>
- <string>Use lossy alpha rendering optimization (opaque/nonexistent small alpha faces).</string>
+ <string>Use alpha masks where appropriate, in the non-deferred (non-'Lighting and Shadows') graphics mode</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
@@ -6984,6 +6984,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>RenderAutoMaskAlphaDeferred</key>
+ <map>
+ <key>Comment</key>
+ <string>Use alpha masks where appropriate, in the deferred ('Lighting and Shadows') graphics mode</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>1</integer>
+ </map>
<key>RenderFastUI</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 7fd7cd3910..def463cb41 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -182,7 +182,7 @@ void LLDrawPoolAlpha::render(S32 pass)
gGL.setColorMask(true, true);
- if (LLPipeline::sFastAlpha && !deferred_render)
+ if (LLPipeline::sAutoMaskAlphaNonDeferred && !deferred_render)
{
mColorSFactor = LLRender::BF_ONE; // }
mColorDFactor = LLRender::BF_ZERO; // } these are like disabling blend on the color channels, but we're still blending on the alpha channel so that we can suppress glow
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 8d86070bdf..f6932b0e68 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -862,6 +862,26 @@ void LLFace::updateRebuildFlags()
}
}
+
+bool LLFace::canRenderAsMask()
+{
+ const LLTextureEntry* te = getTextureEntry();
+ return (
+ (
+ (LLPipeline::sRenderDeferred && LLPipeline::sAutoMaskAlphaDeferred) ||
+
+ (!LLPipeline::sRenderDeferred && LLPipeline::sAutoMaskAlphaNonDeferred)
+ ) // do we want masks at all?
+ &&
+ (te->getColor().mV[3] == 1.0f) && // can't treat as mask if we have face alpha
+ !(LLPipeline::sRenderDeferred && te->getFullbright()) && // hack: alpha masking renders fullbright faces invisible in deferred rendering mode, need to figure out why - for now, avoid
+ (te->getGlow() == 0.f) && // glowing masks are hard to implement - don't mask
+
+ getTexture()->getIsAlphaMask() // texture actually qualifies for masking (lazily recalculated but expensive)
+ );
+}
+
+
static LLFastTimer::DeclareTimer FTM_FACE_GET_GEOM("Face Geom");
BOOL LLFace::getGeometryVolume(const LLVolume& volume,
diff --git a/indra/newview/llface.h b/indra/newview/llface.h
index 351d48a671..02cc2af433 100644
--- a/indra/newview/llface.h
+++ b/indra/newview/llface.h
@@ -2,25 +2,31 @@
* @file llface.h
* @brief LLFace class definition
*
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
*
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
@@ -132,10 +138,10 @@ public:
void unsetFaceColor(); // switch back to material color
const LLColor4& getFaceColor() const { return mFaceColor; }
const LLColor4& getRenderColor() const;
-
//for volumes
void updateRebuildFlags();
+ bool canRenderAsMask(); // logic helper
BOOL getGeometryVolume(const LLVolume& volume,
const S32 &f,
const LLMatrix4& mat_vert, const LLMatrix3& mat_normal,
@@ -273,7 +279,7 @@ public:
{
bool operator()(const LLFace* const& lhs, const LLFace* const& rhs)
{
- return !lhs || (rhs && (lhs->mDistance > rhs->mDistance)); // farthest = first
+ return lhs->mDistance > rhs->mDistance; // farthest = first
}
};
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h
index 2c09a25e04..19af6a0c38 100644
--- a/indra/newview/llspatialpartition.h
+++ b/indra/newview/llspatialpartition.h
@@ -620,8 +620,6 @@ class LLVolumeGeometryManager: public LLGeometryManager
virtual void getGeometry(LLSpatialGroup* group);
void genDrawInfo(LLSpatialGroup* group, U32 mask, std::vector<LLFace*>& faces, BOOL distance_sort = FALSE);
void registerFace(LLSpatialGroup* group, LLFace* facep, U32 type);
- private:
- bool canRenderAsMask(LLFace* facep); // logic helper
};
//spatial partition that uses volume geometry manager (implemented in LLVOVolume.cpp)
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 3fa6b0c8c2..33fb3d0f0f 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -532,7 +532,8 @@ void settings_setup_listeners()
gSavedSettings.getControl("RenderMaxPartCount")->getSignal()->connect(boost::bind(&handleMaxPartCountChanged, _2));
gSavedSettings.getControl("RenderDynamicLOD")->getSignal()->connect(boost::bind(&handleRenderDynamicLODChanged, _2));
gSavedSettings.getControl("RenderDebugTextureBind")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
- gSavedSettings.getControl("RenderFastAlpha")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
+ gSavedSettings.getControl("RenderAutoMaskAlphaDeferred")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
+ gSavedSettings.getControl("RenderAutoMaskAlphaNonDeferred")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
gSavedSettings.getControl("RenderObjectBump")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
gSavedSettings.getControl("RenderMaxVBOSize")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
gSavedSettings.getControl("RenderUseFBO")->getSignal()->connect(boost::bind(&handleRenderUseFBOChanged, _2));
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 8e2e2283bf..ede5950ecc 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -596,7 +596,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
LLPipeline::sUseOcclusion = 3;
}
- LLPipeline::sFastAlpha = gSavedSettings.getBOOL("RenderFastAlpha");
+ LLPipeline::sAutoMaskAlphaDeferred = gSavedSettings.getBOOL("RenderAutoMaskAlphaDeferred");
+ LLPipeline::sAutoMaskAlphaNonDeferred = gSavedSettings.getBOOL("RenderAutoMaskAlphaNonDeferred");
LLPipeline::sUseFarClip = gSavedSettings.getBOOL("RenderUseFarClip");
LLVOAvatar::sMaxVisible = gSavedSettings.getS32("RenderAvatarMaxVisible");
LLPipeline::sDelayVBUpdate = gSavedSettings.getBOOL("RenderDelayVBUpdate");
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 49c0c4d4e0..aa22dc7f5d 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -2921,9 +2921,7 @@ F32 LLVOVolume::getBinRadius()
{
LLFace* face = mDrawable->getFace(i);
if (face->getPoolType() == LLDrawPool::POOL_ALPHA &&
- (!LLPipeline::sFastAlpha ||
- face->getFaceColor().mV[3] != 1.f ||
- !face->getTexture()->getIsAlphaMask()))
+ !face->canRenderAsMask())
{
alpha_wrap = TRUE;
break;
@@ -3296,19 +3294,6 @@ void LLVolumeGeometryManager::getGeometry(LLSpatialGroup* group)
static LLFastTimer::DeclareTimer FTM_REBUILD_VOLUME_VB("Volume");
static LLFastTimer::DeclareTimer FTM_REBUILD_VBO("VBO Rebuilt");
-bool LLVolumeGeometryManager::canRenderAsMask(LLFace* facep)
-{
- const LLTextureEntry* te = facep->getTextureEntry();
- return (
- LLPipeline::sFastAlpha && // do we want masks at all?
-
- (te->getColor().mV[3] == 1.0f) && // can't treat as mask if we have face alpha
- !(LLPipeline::sRenderDeferred && te->getFullbright()) && // hack: alpha masking renders fullbright faces invisible in deferred rendering mode, need to figure out why - for now, avoid
- (te->getGlow() == 0.f) && // glowing masks are hard to implement - don't mask
-
- facep->getTexture()->getIsAlphaMask() // texture actually qualifies for masking (lazily calculated but expensive)
- );
-}
void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
@@ -3435,7 +3420,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
if (type == LLDrawPool::POOL_ALPHA)
{
- if (canRenderAsMask(facep))
+ if (facep->canRenderAsMask())
{ //can be treated as alpha mask
simple_faces.push_back(facep);
}
@@ -3784,7 +3769,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
if (is_alpha)
{
// can we safely treat this as an alpha mask?
- if (canRenderAsMask(facep))
+ if (facep->canRenderAsMask())
{
if (te->getFullbright())
{
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 7a9a47feab..e6b4c5f3ed 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -269,7 +269,8 @@ BOOL LLPipeline::sRenderHighlight = TRUE;
BOOL LLPipeline::sForceOldBakedUpload = FALSE;
S32 LLPipeline::sUseOcclusion = 0;
BOOL LLPipeline::sDelayVBUpdate = TRUE;
-BOOL LLPipeline::sFastAlpha = TRUE;
+BOOL LLPipeline::sAutoMaskAlphaDeferred = TRUE;
+BOOL LLPipeline::sAutoMaskAlphaNonDeferred = FALSE;
BOOL LLPipeline::sDisableShaders = FALSE;
BOOL LLPipeline::sRenderBump = TRUE;
BOOL LLPipeline::sUseTriStrips = TRUE;
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 60e0b0ae8c..a096a887b0 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -444,7 +444,8 @@ public:
static BOOL sForceOldBakedUpload; // If true will not use capabilities to upload baked textures.
static S32 sUseOcclusion; // 0 = no occlusion, 1 = read only, 2 = read/write
static BOOL sDelayVBUpdate;
- static BOOL sFastAlpha;
+ static BOOL sAutoMaskAlphaDeferred;
+ static BOOL sAutoMaskAlphaNonDeferred;
static BOOL sDisableShaders; // if TRUE, rendering will be done without shaders
static BOOL sRenderBump;
static BOOL sUseTriStrips;
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 3af80f63fe..cc16194c2d 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -2137,14 +2137,24 @@
parameter="RenderDebugPipeline" />
</menu_item_check>
<menu_item_check
- label="Fast Alpha"
- name="Fast Alpha">
+ label="Automatic Alpha Masks (deferred)"
+ name="Automatic Alpha Masks (deferred)">
<menu_item_check.on_check
function="CheckControl"
- parameter="RenderFastAlpha" />
+ parameter="RenderAutoMaskAlphaDeferred" />
<menu_item_check.on_click
function="ToggleControl"
- parameter="RenderFastAlpha" />
+ parameter="RenderAutoMaskAlphaDeferred" />
+ </menu_item_check>
+ <menu_item_check
+ label="Automatic Alpha Masks (non-deferred)"
+ name="Automatic Alpha Masks (non-deferred)">
+ <menu_item_check.on_check
+ function="CheckControl"
+ parameter="RenderAutoMaskAlphaNonDeferred" />
+ <menu_item_check.on_click
+ function="ToggleControl"
+ parameter="RenderAutoMaskAlphaNonDeferred" />
</menu_item_check>
<menu_item_check
label="Animation Textures"