diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-04-26 14:42:06 +0100 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-04-26 14:42:06 +0100 |
commit | 9e51aa3fd6d50181e78c42321ab90eda5761ff01 (patch) | |
tree | b0845c96ee1cb5eab1a926b6cc0b85802d8e7559 /indra | |
parent | 61714c5f3558a3ba85bd82549b599ef6364049fa (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.xml | 15 | ||||
-rw-r--r-- | indra/newview/lldrawpoolalpha.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llface.cpp | 20 | ||||
-rw-r--r-- | indra/newview/llface.h | 2 | ||||
-rw-r--r-- | indra/newview/llspatialpartition.h | 2 | ||||
-rw-r--r-- | indra/newview/llviewercontrol.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llviewerdisplay.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 21 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 3 | ||||
-rw-r--r-- | indra/newview/pipeline.h | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 18 |
11 files changed, 60 insertions, 32 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 67dd97e6f7..02cc2af433 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -138,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, 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" |