From 64112134be2a4b46c7ade1483e3d968ea1e3e81f Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 26 Apr 2010 14:42:06 +0100 Subject: EXT-7060 default auto alpha masking to ON for deferred rendering (only deferred rendering) --- indra/newview/app_settings/settings.xml | 15 +++++++++++++-- indra/newview/lldrawpoolalpha.cpp | 2 +- indra/newview/llface.cpp | 20 ++++++++++++++++++++ indra/newview/llface.h | 2 +- indra/newview/llspatialpartition.h | 2 -- indra/newview/llviewercontrol.cpp | 3 ++- indra/newview/llviewerdisplay.cpp | 3 ++- indra/newview/llvovolume.cpp | 21 +++------------------ indra/newview/pipeline.cpp | 3 ++- indra/newview/pipeline.h | 3 ++- 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 8abb0f7106..a820d82f6f 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6996,10 +6996,10 @@ Value 256.0 - RenderFastAlpha + RenderAutoMaskAlphaNonDeferred Comment - Use alpha masks where appropriate. + Use alpha masks where appropriate, in the non-deferred (non-'Lighting and Shadows') graphics mode Persist 1 Type @@ -7007,6 +7007,17 @@ Value 0 + RenderAutoMaskAlphaDeferred + + Comment + Use alpha masks where appropriate, in the deferred ('Lighting and Shadows') graphics mode + Persist + 1 + Type + Boolean + Value + 1 + RenderFastUI Comment 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 bc3e04db18..7816418dc2 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -883,6 +883,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 06ec043c76..bbf8de04bc 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -139,10 +139,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 b5e5967374..67c33d5b0f 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -628,8 +628,6 @@ class LLVolumeGeometryManager: public LLGeometryManager virtual void getGeometry(LLSpatialGroup* group); void genDrawInfo(LLSpatialGroup* group, U32 mask, std::vector& 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 5be5dc0444..18558425ac 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 56fb42bb89..96f69b3676 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3042,9 +3042,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; @@ -3417,19 +3415,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) { @@ -3576,7 +3561,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); } @@ -3930,7 +3915,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 5a173d8460..3df9a119bf 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -271,7 +271,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 8bdc635d05..be878ae667 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -450,7 +450,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 bb57464741..6a5f9ed8f8 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2148,14 +2148,24 @@ parameter="RenderDebugPipeline" /> + label="Automatic Alpha Masks (deferred)" + name="Automatic Alpha Masks (deferred)"> + parameter="RenderAutoMaskAlphaDeferred" /> + parameter="RenderAutoMaskAlphaDeferred" /> + + + +