summaryrefslogtreecommitdiff
path: root/indra/newview/pipeline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r--indra/newview/pipeline.cpp1598
1 files changed, 767 insertions, 831 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index d797b64731..da16c8209f 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -142,7 +142,6 @@
bool gShiftFrame = false;
//cached settings
-bool LLPipeline::RenderAvatarVP;
bool LLPipeline::WindLightUseAtmosShaders;
bool LLPipeline::RenderDeferred;
F32 LLPipeline::RenderDeferredSunWash;
@@ -238,7 +237,6 @@ const LLMatrix4* gGLLastMatrix = NULL;
LLTrace::BlockTimerStatHandle FTM_RENDER_GEOMETRY("Render Geometry");
LLTrace::BlockTimerStatHandle FTM_RENDER_GRASS("Grass");
LLTrace::BlockTimerStatHandle FTM_RENDER_INVISIBLE("Invisible");
-LLTrace::BlockTimerStatHandle FTM_RENDER_OCCLUSION("Occlusion");
LLTrace::BlockTimerStatHandle FTM_RENDER_SHINY("Shiny");
LLTrace::BlockTimerStatHandle FTM_RENDER_SIMPLE("Simple");
LLTrace::BlockTimerStatHandle FTM_RENDER_TERRAIN("Terrain");
@@ -253,14 +251,12 @@ LLTrace::BlockTimerStatHandle FTM_RENDER_MATERIALS("Render Materials");
LLTrace::BlockTimerStatHandle FTM_RENDER_FULLBRIGHT("Fullbright");
LLTrace::BlockTimerStatHandle FTM_RENDER_GLOW("Glow");
LLTrace::BlockTimerStatHandle FTM_GEO_UPDATE("Geo Update");
-LLTrace::BlockTimerStatHandle FTM_PIPELINE_CREATE("Pipeline Create");
LLTrace::BlockTimerStatHandle FTM_POOLRENDER("RenderPool");
LLTrace::BlockTimerStatHandle FTM_POOLS("Pools");
LLTrace::BlockTimerStatHandle FTM_DEFERRED_POOLRENDER("RenderPool (Deferred)");
LLTrace::BlockTimerStatHandle FTM_DEFERRED_POOLS("Pools (Deferred)");
LLTrace::BlockTimerStatHandle FTM_POST_DEFERRED_POOLRENDER("RenderPool (Post)");
LLTrace::BlockTimerStatHandle FTM_POST_DEFERRED_POOLS("Pools (Post)");
-LLTrace::BlockTimerStatHandle FTM_RENDER_BLOOM_FBO("First FBO");
LLTrace::BlockTimerStatHandle FTM_STATESORT("Sort Draw State");
LLTrace::BlockTimerStatHandle FTM_PIPELINE("Pipeline");
LLTrace::BlockTimerStatHandle FTM_CLIENT_COPY("Client Copy");
@@ -269,11 +265,8 @@ LLTrace::BlockTimerStatHandle FTM_RENDER_DEFERRED("Deferred Shading");
LLTrace::BlockTimerStatHandle FTM_RENDER_UI_HUD("HUD");
LLTrace::BlockTimerStatHandle FTM_RENDER_UI_3D("3D");
LLTrace::BlockTimerStatHandle FTM_RENDER_UI_2D("2D");
-LLTrace::BlockTimerStatHandle FTM_RENDER_UI_DEBUG_TEXT("Debug Text");
-LLTrace::BlockTimerStatHandle FTM_RENDER_UI_SCENE_MON("Scene Mon");
static LLTrace::BlockTimerStatHandle FTM_STATESORT_DRAWABLE("Sort Drawables");
-static LLTrace::BlockTimerStatHandle FTM_STATESORT_POSTSORT("Post Sort");
static LLStaticHashedString sTint("tint");
static LLStaticHashedString sAmbiance("ambiance");
@@ -338,7 +331,6 @@ S32 LLPipeline::sUseOcclusion = 0;
bool LLPipeline::sDelayVBUpdate = true;
bool LLPipeline::sAutoMaskAlphaDeferred = true;
bool LLPipeline::sAutoMaskAlphaNonDeferred = false;
-bool LLPipeline::sDisableShaders = false;
bool LLPipeline::sRenderTransparentWater = true;
bool LLPipeline::sRenderBump = true;
bool LLPipeline::sBakeSunlight = false;
@@ -359,7 +351,6 @@ bool LLPipeline::sRenderAttachedLights = true;
bool LLPipeline::sRenderAttachedParticles = true;
bool LLPipeline::sRenderDeferred = false;
S32 LLPipeline::sVisibleLightCount = 0;
-F32 LLPipeline::sMinRenderSize = 0.f;
bool LLPipeline::sRenderingHUDs;
F32 LLPipeline::sDistortionWaterClipPlaneMargin = 1.0125f;
@@ -370,10 +361,12 @@ static LLCullResult* sCull = NULL;
void validate_framebuffer_object();
-
-bool addDeferredAttachments(LLRenderTarget& target)
+// Add color attachments for deferred rendering
+// target -- RenderTarget to add attachments to
+// for_impostor -- whether or not these render targets are for an impostor (if true, avoids implicit sRGB conversions)
+bool addDeferredAttachments(LLRenderTarget& target, bool for_impostor = false)
{
- return target.addColorAttachment(GL_SRGB8_ALPHA8) && //specular
+ return target.addColorAttachment(for_impostor ? GL_RGBA : GL_SRGB8_ALPHA8) && //specular
target.addColorAttachment(GL_RGB10_A2); //normal+z
}
@@ -385,8 +378,7 @@ LLPipeline::LLPipeline() :
mNumVisibleFaces(0),
mInitialized(false),
- mVertexShadersEnabled(false),
- mVertexShadersLoaded(0),
+ mShadersLoaded(false),
mTransformFeedbackPrimitives(0),
mRenderDebugFeatureMask(0),
mRenderDebugMask(0),
@@ -487,6 +479,10 @@ void LLPipeline::init()
{
clearAllRenderTypes();
}
+ else if (gNonInteractive)
+ {
+ clearAllRenderTypes();
+ }
else
{
setAllRenderTypes(); // By default, all rendering types start enabled
@@ -541,7 +537,6 @@ void LLPipeline::init()
connectRefreshCachedSettingsSafe("RenderAvatarMaxNonImpostors");
connectRefreshCachedSettingsSafe("RenderDelayVBUpdate");
connectRefreshCachedSettingsSafe("UseOcclusion");
- connectRefreshCachedSettingsSafe("RenderAvatarVP");
connectRefreshCachedSettingsSafe("WindLightUseAtmosShaders");
connectRefreshCachedSettingsSafe("RenderDeferred");
connectRefreshCachedSettingsSafe("RenderDeferredSunWash");
@@ -725,8 +720,6 @@ void LLPipeline::destroyGL()
}
}
-static LLTrace::BlockTimerStatHandle FTM_RESIZE_SCREEN_TEXTURE("Resize Screen Texture");
-
void LLPipeline::requestResizeScreenTexture()
{
gResizeScreenTexture = TRUE;
@@ -746,8 +739,7 @@ void LLPipeline::resizeShadowTexture()
void LLPipeline::resizeScreenTexture()
{
- LL_RECORD_BLOCK_TIME(FTM_RESIZE_SCREEN_TEXTURE);
- if (gPipeline.canUseVertexShaders() && assertInitialized())
+ if (gPipeline.shadersLoaded())
{
GLuint resX = gViewerWindow->getWorldViewWidthRaw();
GLuint resY = gViewerWindow->getWorldViewHeightRaw();
@@ -758,8 +750,8 @@ void LLPipeline::resizeScreenTexture()
releaseShadowTargets();
allocateScreenBuffer(resX,resY);
gResizeScreenTexture = FALSE;
- }
- }
+ }
+ }
}
void LLPipeline::allocatePhysicsBuffer()
@@ -900,7 +892,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
if (!addDeferredAttachments(mDeferredScreen)) return false;
GLuint screenFormat = GL_RGBA16;
- if (gGLManager.mIsATI)
+ if (gGLManager.mIsAMD)
{
screenFormat = GL_RGBA12;
}
@@ -1054,8 +1046,6 @@ void LLPipeline::updateRenderDeferred()
RenderDeferred &&
LLRenderTarget::sUseFBO &&
LLPipeline::sRenderBump &&
- LLPipeline::sRenderTransparentWater &&
- RenderAvatarVP &&
WindLightUseAtmosShaders &&
(bool) LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred");
}
@@ -1072,12 +1062,10 @@ void LLPipeline::refreshCachedSettings()
LLPipeline::sUseOcclusion =
(!gUseWireframe
- && LLGLSLShader::sNoFixedFunction
&& LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")
&& gSavedSettings.getBOOL("UseOcclusion")
&& gGLManager.mHasOcclusionQuery) ? 2 : 0;
- RenderAvatarVP = gSavedSettings.getBOOL("RenderAvatarVP");
WindLightUseAtmosShaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders");
RenderDeferred = gSavedSettings.getBOOL("RenderDeferred");
RenderDeferredSunWash = gSavedSettings.getF32("RenderDeferredSunWash");
@@ -1153,6 +1141,12 @@ void LLPipeline::refreshCachedSettings()
RenderAutoHideSurfaceAreaLimit = gSavedSettings.getF32("RenderAutoHideSurfaceAreaLimit");
RenderSpotLight = nullptr;
updateRenderDeferred();
+
+ if (gNonInteractive)
+ {
+ LLVOAvatar::sMaxNonImpostors = 1;
+ LLVOAvatar::updateImpostorRendering(LLVOAvatar::sMaxNonImpostors);
+ }
}
void LLPipeline::releaseGLBuffers()
@@ -1232,7 +1226,8 @@ void LLPipeline::releaseShadowTargets()
void LLPipeline::createGLBuffers()
{
- stop_glerror();
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
+ stop_glerror();
assertInitialized();
updateRenderDeferred();
@@ -1370,10 +1365,7 @@ void LLPipeline::restoreGL()
{
assertInitialized();
- if (mVertexShadersEnabled)
- {
- LLViewerShaderMgr::instance()->setShaders();
- }
+ LLViewerShaderMgr::instance()->setShaders();
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
@@ -1385,31 +1377,19 @@ void LLPipeline::restoreGL()
if (part)
{
part->restoreGL();
- }
+ }
}
}
}
-
-bool LLPipeline::canUseVertexShaders()
+bool LLPipeline::shadersLoaded()
{
- if (sDisableShaders ||
- !gGLManager.mHasVertexShader ||
- !gGLManager.mHasFragmentShader ||
- (assertInitialized() && mVertexShadersLoaded != 1) )
- {
- return false;
- }
- else
- {
- return true;
- }
+ return (assertInitialized() && mShadersLoaded);
}
bool LLPipeline::canUseWindLightShaders() const
{
- return (!LLPipeline::sDisableShaders &&
- gWLSkyProgram.mProgramObject != 0 &&
+ return (gWLSkyProgram.mProgramObject != 0 &&
LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_WINDLIGHT) > 1);
}
@@ -1427,8 +1407,7 @@ bool LLPipeline::canUseAntiAliasing() const
void LLPipeline::unloadShaders()
{
LLViewerShaderMgr::instance()->unloadShaders();
-
- mVertexShadersLoaded = 0;
+ mShadersLoaded = false;
}
void LLPipeline::assertInitializedDoError()
@@ -1514,6 +1493,7 @@ public:
// Called when a texture changes # of channels (causes faces to move to alpha pool)
void LLPipeline::dirtyPoolObjectTextures(const std::set<LLViewerFetchedTexture*>& textures)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
assertInitialized();
// *TODO: This is inefficient and causes frame spikes; need a better way to do this
@@ -1725,15 +1705,9 @@ void LLPipeline::allocDrawable(LLViewerObject *vobj)
}
-static LLTrace::BlockTimerStatHandle FTM_UNLINK("Unlink");
-static LLTrace::BlockTimerStatHandle FTM_REMOVE_FROM_MOVE_LIST("Movelist");
-static LLTrace::BlockTimerStatHandle FTM_REMOVE_FROM_SPATIAL_PARTITION("Spatial Partition");
-static LLTrace::BlockTimerStatHandle FTM_REMOVE_FROM_LIGHT_SET("Light Set");
-static LLTrace::BlockTimerStatHandle FTM_REMOVE_FROM_HIGHLIGHT_SET("Highlight Set");
-
void LLPipeline::unlinkDrawable(LLDrawable *drawable)
{
- LL_RECORD_BLOCK_TIME(FTM_UNLINK);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
assertInitialized();
@@ -1742,7 +1716,6 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable)
// Based on flags, remove the drawable from the queues that it's on.
if (drawablep->isState(LLDrawable::ON_MOVE_LIST))
{
- LL_RECORD_BLOCK_TIME(FTM_REMOVE_FROM_MOVE_LIST);
LLDrawable::drawable_vector_t::iterator iter = std::find(mMovedList.begin(), mMovedList.end(), drawablep);
if (iter != mMovedList.end())
{
@@ -1752,7 +1725,6 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable)
if (drawablep->getSpatialGroup())
{
- LL_RECORD_BLOCK_TIME(FTM_REMOVE_FROM_SPATIAL_PARTITION);
if (!drawablep->getSpatialGroup()->getSpatialPartition()->remove(drawablep, drawablep->getSpatialGroup()))
{
#ifdef LL_RELEASE_FOR_DOWNLOAD
@@ -1763,30 +1735,24 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable)
}
}
- {
- LL_RECORD_BLOCK_TIME(FTM_REMOVE_FROM_LIGHT_SET);
- mLights.erase(drawablep);
+ mLights.erase(drawablep);
- for (light_set_t::iterator iter = mNearbyLights.begin();
- iter != mNearbyLights.end(); iter++)
+ for (light_set_t::iterator iter = mNearbyLights.begin();
+ iter != mNearbyLights.end(); iter++)
+ {
+ if (iter->drawable == drawablep)
{
- if (iter->drawable == drawablep)
- {
- mNearbyLights.erase(iter);
- break;
- }
+ mNearbyLights.erase(iter);
+ break;
}
}
- {
- LL_RECORD_BLOCK_TIME(FTM_REMOVE_FROM_HIGHLIGHT_SET);
- HighlightItem item(drawablep);
- mHighlightSet.erase(item);
+ HighlightItem item(drawablep);
+ mHighlightSet.erase(item);
- if (mHighlightObject == drawablep)
- {
- mHighlightObject = NULL;
- }
+ if (mHighlightObject == drawablep)
+ {
+ mHighlightObject = NULL;
}
for (U32 i = 0; i < 2; ++i)
@@ -1801,14 +1767,12 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable)
mTargetShadowSpotLight[i] = NULL;
}
}
-
-
}
//static
void LLPipeline::removeMutedAVsLights(LLVOAvatar* muted_avatar)
{
- LL_RECORD_BLOCK_TIME(FTM_REMOVE_FROM_LIGHT_SET);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
for (light_set_t::iterator iter = gPipeline.mNearbyLights.begin();
iter != gPipeline.mNearbyLights.end(); iter++)
{
@@ -1836,7 +1800,7 @@ U32 LLPipeline::addObject(LLViewerObject *vobj)
void LLPipeline::createObjects(F32 max_dtime)
{
- LL_RECORD_BLOCK_TIME(FTM_PIPELINE_CREATE);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
LLTimer update_timer;
@@ -1860,6 +1824,7 @@ void LLPipeline::createObjects(F32 max_dtime)
void LLPipeline::createObject(LLViewerObject* vobj)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
LLDrawable* drawablep = vobj->mDrawable;
if (!drawablep)
@@ -1897,6 +1862,7 @@ void LLPipeline::createObject(LLViewerObject* vobj)
void LLPipeline::resetFrameStats()
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
assertInitialized();
sCompiles = 0;
@@ -1912,6 +1878,7 @@ void LLPipeline::resetFrameStats()
//external functions for asynchronous updating
void LLPipeline::updateMoveDampedAsync(LLDrawable* drawablep)
{
+ LL_PROFILE_ZONE_SCOPED;
if (FreezeTime)
{
return;
@@ -1942,6 +1909,7 @@ void LLPipeline::updateMoveDampedAsync(LLDrawable* drawablep)
void LLPipeline::updateMoveNormalAsync(LLDrawable* drawablep)
{
+ LL_PROFILE_ZONE_SCOPED;
if (FreezeTime)
{
return;
@@ -1972,6 +1940,7 @@ void LLPipeline::updateMoveNormalAsync(LLDrawable* drawablep)
void LLPipeline::updateMovedList(LLDrawable::drawable_vector_t& moved_list)
{
+ LL_PROFILE_ZONE_SCOPED;
for (LLDrawable::drawable_vector_t::iterator iter = moved_list.begin();
iter != moved_list.end(); )
{
@@ -2005,14 +1974,9 @@ void LLPipeline::updateMovedList(LLDrawable::drawable_vector_t& moved_list)
}
}
-static LLTrace::BlockTimerStatHandle FTM_OCTREE_BALANCE("Balance Octree");
-static LLTrace::BlockTimerStatHandle FTM_UPDATE_MOVE("Update Move");
-static LLTrace::BlockTimerStatHandle FTM_RETEXTURE("Retexture");
-static LLTrace::BlockTimerStatHandle FTM_MOVED_LIST("Moved List");
-
void LLPipeline::updateMove()
{
- LL_RECORD_BLOCK_TIME(FTM_UPDATE_MOVE);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
if (FreezeTime)
{
@@ -2021,49 +1985,38 @@ void LLPipeline::updateMove()
assertInitialized();
+ for (LLDrawable::drawable_set_t::iterator iter = mRetexturedList.begin();
+ iter != mRetexturedList.end(); ++iter)
{
- LL_RECORD_BLOCK_TIME(FTM_RETEXTURE);
-
- for (LLDrawable::drawable_set_t::iterator iter = mRetexturedList.begin();
- iter != mRetexturedList.end(); ++iter)
+ LLDrawable* drawablep = *iter;
+ if (drawablep && !drawablep->isDead())
{
- LLDrawable* drawablep = *iter;
- if (drawablep && !drawablep->isDead())
- {
- drawablep->updateTexture();
- }
+ drawablep->updateTexture();
}
- mRetexturedList.clear();
}
+ mRetexturedList.clear();
- {
- LL_RECORD_BLOCK_TIME(FTM_MOVED_LIST);
- updateMovedList(mMovedList);
- }
+ updateMovedList(mMovedList);
//balance octrees
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{
- LL_RECORD_BLOCK_TIME(FTM_OCTREE_BALANCE);
-
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ LLViewerRegion* region = *iter;
+ for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
{
- LLViewerRegion* region = *iter;
- for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
+ LLSpatialPartition* part = region->getSpatialPartition(i);
+ if (part)
{
- LLSpatialPartition* part = region->getSpatialPartition(i);
- if (part)
- {
- part->mOctree->balance();
- }
+ part->mOctree->balance();
}
+ }
- //balance the VO Cache tree
- LLVOCachePartition* vo_part = region->getVOCachePartition();
- if(vo_part)
- {
- vo_part->mOctree->balance();
- }
+ //balance the VO Cache tree
+ LLVOCachePartition* vo_part = region->getVOCachePartition();
+ if(vo_part)
+ {
+ vo_part->mOctree->balance();
}
}
}
@@ -2125,6 +2078,7 @@ void LLPipeline::grabReferences(LLCullResult& result)
void LLPipeline::clearReferences()
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
sCull = NULL;
mGroupSaveQ1.clear();
}
@@ -2372,20 +2326,28 @@ bool LLPipeline::getVisibleExtents(LLCamera& camera, LLVector3& min, LLVector3&
static LLTrace::BlockTimerStatHandle FTM_CULL("Object Culling");
-void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_clip, LLPlane* planep)
+void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, LLPlane* planep)
{
static LLCachedControl<bool> use_occlusion(gSavedSettings,"UseOcclusion");
- static bool can_use_occlusion = LLGLSLShader::sNoFixedFunction
- && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")
+ static bool can_use_occlusion = LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")
&& gGLManager.mHasOcclusionQuery;
- LL_RECORD_BLOCK_TIME(FTM_CULL);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; //LL_RECORD_BLOCK_TIME(FTM_CULL);
+
+ if (planep != nullptr)
+ {
+ camera.setUserClipPlane(*planep);
+ }
+ else
+ {
+ camera.disableUserClipPlane();
+ }
grabReferences(result);
sCull->clear();
- bool to_texture = LLPipeline::sUseOcclusion > 1 && gPipeline.canUseVertexShaders();
+ bool to_texture = LLPipeline::sUseOcclusion > 1 && gPipeline.shadersLoaded();
if (to_texture)
{
@@ -2419,7 +2381,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
bool bound_shader = false;
- if (gPipeline.canUseVertexShaders() && LLGLSLShader::sCurBoundShader == 0)
+ if (gPipeline.shadersLoaded() && LLGLSLShader::sCurBoundShader == 0)
{ //if no shader is currently bound, use the occlusion shader instead of fixed function if we can
// (shadow render uses a special shader that clamps to clip planes)
bound_shader = true;
@@ -2435,11 +2397,6 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
mCubeVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
}
- if (!sReflectionRender)
- {
- camera.disableUserClipPlane();
- }
-
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{
@@ -2461,8 +2418,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
LLVOCachePartition* vo_part = region->getVOCachePartition();
if(vo_part)
{
- bool do_occlusion_cull = can_use_occlusion && use_occlusion && !gUseWireframe && 0 > water_clip /* && !gViewerWindow->getProgressView()->getVisible()*/;
- do_occlusion_cull &= !sReflectionRender;
+ bool do_occlusion_cull = can_use_occlusion && use_occlusion && !gUseWireframe;
vo_part->cull(camera, do_occlusion_cull);
}
}
@@ -2546,20 +2502,6 @@ void LLPipeline::markNotCulled(LLSpatialGroup* group, LLCamera& camera)
group->updateDistance(camera);
}
- const F32 MINIMUM_PIXEL_AREA = 16.f;
-
- if (group->mPixelArea < MINIMUM_PIXEL_AREA)
- {
- return;
- }
-
- const LLVector4a* bounds = group->getBounds();
- if (sMinRenderSize > 0.f &&
- llmax(llmax(bounds[1][0], bounds[1][1]), bounds[1][2]) < sMinRenderSize)
- {
- return;
- }
-
assertInitialized();
if (!group->getSpatialPartition()->mRenderByGroup)
@@ -2669,7 +2611,8 @@ void LLPipeline::doOcclusion(LLCamera& camera, LLRenderTarget& source, LLRenderT
void LLPipeline::doOcclusion(LLCamera& camera)
{
- if (LLPipeline::sUseOcclusion > 1 && !LLSpatialPartition::sTeleportRequested &&
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
+ if (LLPipeline::sUseOcclusion > 1 && !LLSpatialPartition::sTeleportRequested &&
(sCull->hasOcclusionGroups() || LLVOCachePartition::sNeedsOcclusionCheck))
{
LLVertexBuffer::unbind();
@@ -2690,7 +2633,7 @@ void LLPipeline::doOcclusion(LLCamera& camera)
LLGLDisable cull(GL_CULL_FACE);
- bool bind_shader = LLGLSLShader::sNoFixedFunction && LLGLSLShader::sCurBoundShader == 0;
+ bool bind_shader = (LLGLSLShader::sCurBoundShader == 0);
if (bind_shader)
{
if (LLPipeline::sShadowRender)
@@ -2753,14 +2696,10 @@ bool LLPipeline::updateDrawableGeom(LLDrawable* drawablep, bool priority)
return update_complete;
}
-static LLTrace::BlockTimerStatHandle FTM_SEED_VBO_POOLS("Seed VBO Pool");
-
-static LLTrace::BlockTimerStatHandle FTM_UPDATE_GL("Update GL");
-
void LLPipeline::updateGL()
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
{
- LL_RECORD_BLOCK_TIME(FTM_UPDATE_GL);
while (!LLGLUpdate::sGLQ.empty())
{
LLGLUpdate* glu = LLGLUpdate::sGLQ.front();
@@ -2771,15 +2710,13 @@ void LLPipeline::updateGL()
}
{ //seed VBO Pools
- LL_RECORD_BLOCK_TIME(FTM_SEED_VBO_POOLS);
LLVertexBuffer::seedPools();
}
}
-static LLTrace::BlockTimerStatHandle FTM_REBUILD_PRIORITY_GROUPS("Rebuild Priority Groups");
-
void LLPipeline::clearRebuildGroups()
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
LLSpatialGroup::sg_vector_t hudGroups;
mGroupQ1Locked = true;
@@ -2884,7 +2821,7 @@ void LLPipeline::clearRebuildDrawables()
void LLPipeline::rebuildPriorityGroups()
{
- LL_RECORD_BLOCK_TIME(FTM_REBUILD_PRIORITY_GROUPS);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
LLTimer update_timer;
assertInitialized();
@@ -2906,8 +2843,6 @@ void LLPipeline::rebuildPriorityGroups()
}
-static LLTrace::BlockTimerStatHandle FTM_REBUILD_GROUPS("Rebuild Groups");
-
void LLPipeline::rebuildGroups()
{
if (mGroupQ2.empty())
@@ -2915,7 +2850,7 @@ void LLPipeline::rebuildGroups()
return;
}
- LL_RECORD_BLOCK_TIME(FTM_REBUILD_GROUPS);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
mGroupQ2Locked = true;
// Iterate through some drawables on the non-priority build queue
S32 size = (S32) mGroupQ2.size();
@@ -3161,12 +3096,9 @@ void LLPipeline::markShift(LLDrawable *drawablep)
}
}
-static LLTrace::BlockTimerStatHandle FTM_SHIFT_DRAWABLE("Shift Drawable");
-static LLTrace::BlockTimerStatHandle FTM_SHIFT_OCTREE("Shift Octree");
-static LLTrace::BlockTimerStatHandle FTM_SHIFT_HUD("Shift HUD");
-
void LLPipeline::shiftObjects(const LLVector3 &offset)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
assertInitialized();
glClear(GL_DEPTH_BUFFER_BIT);
@@ -3175,46 +3107,36 @@ void LLPipeline::shiftObjects(const LLVector3 &offset)
LLVector4a offseta;
offseta.load3(offset.mV);
+ for (LLDrawable::drawable_vector_t::iterator iter = mShiftList.begin();
+ iter != mShiftList.end(); iter++)
{
- LL_RECORD_BLOCK_TIME(FTM_SHIFT_DRAWABLE);
-
- for (LLDrawable::drawable_vector_t::iterator iter = mShiftList.begin();
- iter != mShiftList.end(); iter++)
+ LLDrawable *drawablep = *iter;
+ if (drawablep->isDead())
{
- LLDrawable *drawablep = *iter;
- if (drawablep->isDead())
- {
- continue;
- }
- drawablep->shiftPos(offseta);
- drawablep->clearState(LLDrawable::ON_SHIFT_LIST);
- }
- mShiftList.resize(0);
+ continue;
+ }
+ drawablep->shiftPos(offseta);
+ drawablep->clearState(LLDrawable::ON_SHIFT_LIST);
}
-
+ mShiftList.resize(0);
+ for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+ iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{
- LL_RECORD_BLOCK_TIME(FTM_SHIFT_OCTREE);
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ LLViewerRegion* region = *iter;
+ for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
{
- LLViewerRegion* region = *iter;
- for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
+ LLSpatialPartition* part = region->getSpatialPartition(i);
+ if (part)
{
- LLSpatialPartition* part = region->getSpatialPartition(i);
- if (part)
- {
- part->shift(offseta);
- }
+ part->shift(offseta);
}
}
}
- {
- LL_RECORD_BLOCK_TIME(FTM_SHIFT_HUD);
- LLHUDText::shiftAll(offset);
- LLHUDNameTag::shiftAll(offset);
- }
+ LLHUDText::shiftAll(offset);
+ LLHUDNameTag::shiftAll(offset);
+
display_update_camera();
}
@@ -3245,10 +3167,9 @@ void LLPipeline::markPartitionMove(LLDrawable* drawable)
}
}
-static LLTrace::BlockTimerStatHandle FTM_PROCESS_PARTITIONQ("PartitionQ");
void LLPipeline::processPartitionQ()
{
- LL_RECORD_BLOCK_TIME(FTM_PROCESS_PARTITIONQ);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
for (LLDrawable::drawable_list_t::iterator iter = mPartitionQ.begin(); iter != mPartitionQ.end(); ++iter)
{
LLDrawable* drawable = *iter;
@@ -3348,10 +3269,10 @@ void LLPipeline::markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags f
}
}
-static LLTrace::BlockTimerStatHandle FTM_RESET_DRAWORDER("Reset Draw Order");
-
void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
+
if (hasAnyRenderType(LLPipeline::RENDER_TYPE_AVATAR,
LLPipeline::RENDER_TYPE_CONTROL_AV,
LLPipeline::RENDER_TYPE_GROUND,
@@ -3363,12 +3284,9 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
LLPipeline::END_RENDER_TYPES))
{
//clear faces from face pools
- LL_RECORD_BLOCK_TIME(FTM_RESET_DRAWORDER);
gPipeline.resetDrawOrders();
}
- LL_RECORD_BLOCK_TIME(FTM_STATESORT);
-
//LLVertexBuffer::unbind();
grabReferences(result);
@@ -3453,7 +3371,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
}
{
- LL_RECORD_BLOCK_TIME(FTM_STATESORT_DRAWABLE);
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWABLE("stateSort"); // LL_RECORD_BLOCK_TIME(FTM_STATESORT_DRAWABLE);
for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList();
iter != sCull->endVisibleList(); ++iter)
{
@@ -3483,12 +3401,12 @@ void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera)
group->mLastUpdateDistance = group->mDistance;
}
}
-
}
void LLPipeline::stateSort(LLSpatialBridge* bridge, LLCamera& camera, BOOL fov_changed)
{
- if (bridge->getSpatialGroup()->changeLOD() || fov_changed)
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
+ if (bridge->getSpatialGroup()->changeLOD() || fov_changed)
{
bool force_update = false;
bridge->updateDistance(camera, force_update);
@@ -3497,7 +3415,8 @@ void LLPipeline::stateSort(LLSpatialBridge* bridge, LLCamera& camera, BOOL fov_c
void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera)
{
- if (!drawablep
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
+ if (!drawablep
|| drawablep->isDead()
|| !hasRenderType(drawablep->getRenderType()))
{
@@ -3790,9 +3709,36 @@ void renderSoundHighlights(LLDrawable* drawablep)
}
}
+void LLPipeline::touchTexture(LLViewerTexture* tex, F32 vsize)
+{
+ if (tex)
+ {
+ LLImageGL* gl_tex = tex->getGLTexture();
+ if (gl_tex && gl_tex->updateBindStats(gl_tex->mTextureMemory))
+ {
+ tex->setActive();
+ tex->addTextureStats(vsize);
+ }
+ }
+
+
+}
+void LLPipeline::touchTextures(LLDrawInfo* info)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
+ for (int i = 0; i < info->mTextureList.size(); ++i)
+ {
+ touchTexture(info->mTextureList[i], info->mTextureListVSize[i]);
+ }
+
+ touchTexture(info->mTexture, info->mVSize);
+ touchTexture(info->mSpecularMap, info->mVSize);
+ touchTexture(info->mNormalMap, info->mVSize);
+}
+
void LLPipeline::postSort(LLCamera& camera)
{
- LL_RECORD_BLOCK_TIME(FTM_STATESORT_POSTSORT);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
assertInitialized();
@@ -3842,20 +3788,14 @@ void LLPipeline::postSort(LLCamera& camera)
for (LLSpatialGroup::drawmap_elem_t::iterator k = src_vec.begin(); k != src_vec.end(); ++k)
{
- if (sMinRenderSize > 0.f)
- {
- LLVector4a bounds;
- bounds.setSub((*k)->mExtents[1],(*k)->mExtents[0]);
-
- if (llmax(llmax(bounds[0], bounds[1]), bounds[2]) > sMinRenderSize)
- {
- sCull->pushDrawInfo(j->first, *k);
- }
- }
- else
- {
- sCull->pushDrawInfo(j->first, *k);
- }
+ LLDrawInfo* info = *k;
+
+ sCull->pushDrawInfo(j->first, info);
+ if (!sShadowRender && !sReflectionRender)
+ {
+ touchTextures(info);
+ addTrianglesDrawn(info->mCount, info->mDrawMode);
+ }
}
}
@@ -3884,6 +3824,16 @@ void LLPipeline::postSort(LLCamera& camera)
sCull->pushAlphaGroup(group);
}
}
+
+ LLSpatialGroup::draw_map_t::iterator rigged_alpha = group->mDrawMap.find(LLRenderPass::PASS_ALPHA_RIGGED);
+
+ if (rigged_alpha != group->mDrawMap.end())
+ { //store rigged alpha groups for LLDrawPoolAlpha prepass (skip distance update, rigged attachments use depth buffer)
+ if (hasRenderType(LLDrawPool::POOL_ALPHA))
+ {
+ sCull->pushRiggedAlphaGroup(group);
+ }
+ }
}
}
@@ -3927,7 +3877,11 @@ void LLPipeline::postSort(LLCamera& camera)
if (!sShadowRender)
{
+ // order alpha groups by distance
std::sort(sCull->beginAlphaGroups(), sCull->endAlphaGroups(), LLSpatialGroup::CompareDepthGreater());
+
+ // order rigged alpha groups by avatar attachment order
+ std::sort(sCull->beginRiggedAlphaGroups(), sCull->endRiggedAlphaGroups(), LLSpatialGroup::CompareRenderOrder());
}
LL_PUSH_CALLSTACKS();
@@ -3994,7 +3948,10 @@ void LLPipeline::postSort(LLCamera& camera)
{
mSelectedFaces.clear();
- LLPipeline::setRenderHighlightTextureChannel(gFloaterTools->getPanelFace()->getTextureChannelToEdit());
+ if (!gNonInteractive)
+ {
+ LLPipeline::setRenderHighlightTextureChannel(gFloaterTools->getPanelFace()->getTextureChannelToEdit());
+ }
// Draw face highlights for selected faces.
if (LLSelectMgr::getInstance()->getTEMode())
@@ -4025,8 +3982,8 @@ void LLPipeline::postSort(LLCamera& camera)
void render_hud_elements()
{
- LL_RECORD_BLOCK_TIME(FTM_RENDER_UI);
- gPipeline.disableLights();
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; //LL_RECORD_BLOCK_TIME(FTM_RENDER_UI);
+ gPipeline.disableLights();
LLGLDisable fog(GL_FOG);
LLGLSUIDefault gls_ui;
@@ -4038,10 +3995,7 @@ void render_hud_elements()
gGL.color4f(1,1,1,1);
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
@@ -4052,8 +4006,11 @@ void render_hud_elements()
// Draw the tracking overlays
LLTracker::render3D();
- // Show the property lines
- LLWorld::getInstance()->renderPropertyLines();
+ if (LLWorld::instanceExists())
+ {
+ // Show the property lines
+ LLWorld::getInstance()->renderPropertyLines();
+ }
LLViewerParcelMgr::getInstance()->render();
LLViewerParcelMgr::getInstance()->renderParcelCollision();
@@ -4070,10 +4027,7 @@ void render_hud_elements()
LLHUDText::renderAllHUD();
}
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.unbind();
- }
+ gUIProgram.unbind();
gGL.flush();
}
@@ -4105,10 +4059,7 @@ void LLPipeline::renderHighlights()
gGL.setColorMask(false, false);
- if (LLGLSLShader::sNoFixedFunction)
- {
- gHighlightProgram.bind();
- }
+ gHighlightProgram.bind();
for (std::set<HighlightItem>::iterator iter = mHighlightSet.begin(); iter != mHighlightSet.end(); ++iter)
{
@@ -4310,7 +4261,7 @@ U32 LLPipeline::sCurRenderPoolType = 0 ;
void LLPipeline::renderGeom(LLCamera& camera, bool forceVBOUpdate)
{
- LL_RECORD_BLOCK_TIME(FTM_RENDER_GEOMETRY);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; //LL_RECORD_BLOCK_TIME(FTM_RENDER_GEOMETRY);
assertInitialized();
@@ -4340,7 +4291,6 @@ void LLPipeline::renderGeom(LLCamera& camera, bool forceVBOUpdate)
// Do verification of GL state
LLGLState::checkStates();
LLGLState::checkTextureChannels();
- LLGLState::checkClientArrays();
if (mRenderDebugMask & RENDER_DEBUG_VERIFY)
{
if (!verify())
@@ -4397,7 +4347,7 @@ void LLPipeline::renderGeom(LLCamera& camera, bool forceVBOUpdate)
}
{
- LL_RECORD_BLOCK_TIME(FTM_POOLS);
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("pools"); //LL_RECORD_BLOCK_TIME(FTM_POOLS);
// HACK: don't calculate local lights if we're rendering the HUD!
// Removing this check will cause bad flickering when there are
@@ -4433,7 +4383,7 @@ void LLPipeline::renderGeom(LLCamera& camera, bool forceVBOUpdate)
pool_set_t::iterator iter2 = iter1;
if (hasRenderType(poolp->getType()) && poolp->getNumPasses() > 0)
{
- LL_RECORD_BLOCK_TIME(FTM_POOLRENDER);
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("pool render"); //LL_RECORD_BLOCK_TIME(FTM_POOLRENDER);
gGLLastMatrix = NULL;
gGL.loadMatrix(gGLModelView);
@@ -4563,98 +4513,104 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
{
LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderGeomDeferred");
- LL_RECORD_BLOCK_TIME(FTM_RENDER_GEOMETRY);
-
- LL_RECORD_BLOCK_TIME(FTM_DEFERRED_POOLS);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_GEOMETRY);
+ {
+ // SL-15709 -- NOTE: Tracy only allows one ZoneScoped per function.
+ // Solutions are:
+ // 1. Use a new scope
+ // 2. Use named zones
+ // 3. Use transient zones
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred pools"); //LL_RECORD_BLOCK_TIME(FTM_DEFERRED_POOLS);
- LLGLEnable cull(GL_CULL_FACE);
+ LLGLEnable cull(GL_CULL_FACE);
- for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter)
- {
- LLDrawPool *poolp = *iter;
- if (hasRenderType(poolp->getType()))
+ for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter)
{
- poolp->prerender();
+ LLDrawPool *poolp = *iter;
+ if (hasRenderType(poolp->getType()))
+ {
+ poolp->prerender();
+ }
}
- }
- LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
+ LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
- LLVertexBuffer::unbind();
+ LLVertexBuffer::unbind();
- LLGLState::checkStates();
- LLGLState::checkTextureChannels();
- LLGLState::checkClientArrays();
+ LLGLState::checkStates();
+ LLGLState::checkTextureChannels();
- U32 cur_type = 0;
+ U32 cur_type = 0;
- gGL.setColorMask(true, true);
+ gGL.setColorMask(true, true);
- pool_set_t::iterator iter1 = mPools.begin();
+ pool_set_t::iterator iter1 = mPools.begin();
- while ( iter1 != mPools.end() )
- {
- LLDrawPool *poolp = *iter1;
+ while ( iter1 != mPools.end() )
+ {
+ LLDrawPool *poolp = *iter1;
- cur_type = poolp->getType();
+ cur_type = poolp->getType();
- pool_set_t::iterator iter2 = iter1;
- if (hasRenderType(poolp->getType()) && poolp->getNumDeferredPasses() > 0)
- {
- LL_RECORD_BLOCK_TIME(FTM_DEFERRED_POOLRENDER);
+ pool_set_t::iterator iter2 = iter1;
+ if (hasRenderType(poolp->getType()) && poolp->getNumDeferredPasses() > 0)
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred pool render"); //LL_RECORD_BLOCK_TIME(FTM_DEFERRED_POOLRENDER);
- gGLLastMatrix = NULL;
- gGL.loadMatrix(gGLModelView);
+ gGLLastMatrix = NULL;
+ gGL.loadMatrix(gGLModelView);
- for( S32 i = 0; i < poolp->getNumDeferredPasses(); i++ )
- {
- LLVertexBuffer::unbind();
- poolp->beginDeferredPass(i);
- for (iter2 = iter1; iter2 != mPools.end(); iter2++)
+ for( S32 i = 0; i < poolp->getNumDeferredPasses(); i++ )
{
- LLDrawPool *p = *iter2;
- if (p->getType() != cur_type)
+ LLVertexBuffer::unbind();
+ poolp->beginDeferredPass(i);
+ for (iter2 = iter1; iter2 != mPools.end(); iter2++)
{
- break;
+ LLDrawPool *p = *iter2;
+ if (p->getType() != cur_type)
+ {
+ break;
+ }
+
+ if ( !p->getSkipRenderFlag() ) { p->renderDeferred(i); }
}
-
- if ( !p->getSkipRenderFlag() ) { p->renderDeferred(i); }
- }
- poolp->endDeferredPass(i);
- LLVertexBuffer::unbind();
+ poolp->endDeferredPass(i);
+ LLVertexBuffer::unbind();
- if (gDebugGL || gDebugPipeline)
- {
- LLGLState::checkStates();
+ if (gDebugGL || gDebugPipeline)
+ {
+ LLGLState::checkStates();
+ }
}
}
- }
- else
- {
- // Skip all pools of this type
- for (iter2 = iter1; iter2 != mPools.end(); iter2++)
+ else
{
- LLDrawPool *p = *iter2;
- if (p->getType() != cur_type)
+ // Skip all pools of this type
+ for (iter2 = iter1; iter2 != mPools.end(); iter2++)
{
- break;
+ LLDrawPool *p = *iter2;
+ if (p->getType() != cur_type)
+ {
+ break;
+ }
}
}
+ iter1 = iter2;
+ stop_glerror();
}
- iter1 = iter2;
- stop_glerror();
- }
- gGLLastMatrix = NULL;
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.loadMatrix(gGLModelView);
+ gGLLastMatrix = NULL;
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.loadMatrix(gGLModelView);
- gGL.setColorMask(true, false);
+ gGL.setColorMask(true, false);
+
+ } // Tracy ZoneScoped
}
void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion)
{
- LL_RECORD_BLOCK_TIME(FTM_POST_DEFERRED_POOLS);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_POST_DEFERRED_POOLS);
U32 cur_type = 0;
LLGLEnable cull(GL_CULL_FACE);
@@ -4688,7 +4644,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion)
pool_set_t::iterator iter2 = iter1;
if (hasRenderType(poolp->getType()) && poolp->getNumPostDeferredPasses() > 0)
{
- LL_RECORD_BLOCK_TIME(FTM_POST_DEFERRED_POOLRENDER);
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred poolrender"); //LL_RECORD_BLOCK_TIME(FTM_POST_DEFERRED_POOLRENDER);
gGLLastMatrix = NULL;
gGL.loadMatrix(gGLModelView);
@@ -4749,7 +4705,8 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion)
void LLPipeline::renderGeomShadow(LLCamera& camera)
{
- U32 cur_type = 0;
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
+ U32 cur_type = 0;
LLGLEnable cull(GL_CULL_FACE);
@@ -4814,6 +4771,7 @@ void LLPipeline::renderGeomShadow(LLCamera& camera)
void LLPipeline::addTrianglesDrawn(S32 index_count, U32 render_type)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
assertInitialized();
S32 count = 0;
if (render_type == LLRender::TRIANGLE_STRIP)
@@ -4853,10 +4811,7 @@ void LLPipeline::renderPhysicsDisplay()
gGL.setColorMask(true, false);
- if (LLGLSLShader::sNoFixedFunction)
- {
- gDebugProgram.bind();
- }
+ gDebugProgram.bind();
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
@@ -4877,11 +4832,7 @@ void LLPipeline::renderPhysicsDisplay()
gGL.flush();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gDebugProgram.unbind();
- }
-
+ gDebugProgram.unbind();
mPhysicsDisplay.flush();
}
@@ -4908,13 +4859,10 @@ void LLPipeline::renderDebug()
if ( pathfindingCharacter->getVisible() || gAgentCamera.cameraMouselook() )
{
- if (LLGLSLShader::sNoFixedFunction)
- {
- gPathfindingProgram.bind();
- gPathfindingProgram.uniform1f(sTint, 1.f);
- gPathfindingProgram.uniform1f(sAmbiance, 1.f);
- gPathfindingProgram.uniform1f(sAlphaScale, 1.f);
- }
+ gPathfindingProgram.bind();
+ gPathfindingProgram.uniform1f(sTint, 1.f);
+ gPathfindingProgram.uniform1f(sAmbiance, 1.f);
+ gPathfindingProgram.uniform1f(sAlphaScale, 1.f);
//Requried character physics capsule render parameters
LLUUID id;
@@ -4923,21 +4871,14 @@ void LLPipeline::renderDebug()
if ( pathfindingCharacter->isPhysicsCapsuleEnabled( id, pos, rot ) )
{
- if (LLGLSLShader::sNoFixedFunction)
- {
- //remove blending artifacts
- gGL.setColorMask(false, false);
- llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos, rot );
- gGL.setColorMask(true, false);
- LLGLEnable blend(GL_BLEND);
- gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
- llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos, rot );
- gPathfindingProgram.bind();
- }
- else
- {
- llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos, rot );
- }
+ //remove blending artifacts
+ gGL.setColorMask(false, false);
+ llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos, rot );
+ gGL.setColorMask(true, false);
+ LLGLEnable blend(GL_BLEND);
+ gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
+ llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos, rot );
+ gPathfindingProgram.bind();
}
}
}
@@ -4953,14 +4894,11 @@ void LLPipeline::renderDebug()
{
F32 ambiance = gSavedSettings.getF32("PathfindingAmbiance");
- if (LLGLSLShader::sNoFixedFunction)
- {
- gPathfindingProgram.bind();
+ gPathfindingProgram.bind();
- gPathfindingProgram.uniform1f(sTint, 1.f);
- gPathfindingProgram.uniform1f(sAmbiance, ambiance);
- gPathfindingProgram.uniform1f(sAlphaScale, 1.f);
- }
+ gPathfindingProgram.uniform1f(sTint, 1.f);
+ gPathfindingProgram.uniform1f(sAmbiance, ambiance);
+ gPathfindingProgram.uniform1f(sAlphaScale, 1.f);
if ( !pathfindingConsole->isRenderWorld() )
{
@@ -4992,18 +4930,11 @@ void LLPipeline::renderDebug()
}
//render edges
- if (LLGLSLShader::sNoFixedFunction)
- {
- gPathfindingNoNormalsProgram.bind();
- gPathfindingNoNormalsProgram.uniform1f(sTint, 1.f);
- gPathfindingNoNormalsProgram.uniform1f(sAlphaScale, 1.f);
- llPathingLibInstance->renderNavMeshEdges();
- gPathfindingProgram.bind();
- }
- else
- {
- llPathingLibInstance->renderNavMeshEdges();
- }
+ gPathfindingNoNormalsProgram.bind();
+ gPathfindingNoNormalsProgram.uniform1f(sTint, 1.f);
+ gPathfindingNoNormalsProgram.uniform1f(sAlphaScale, 1.f);
+ llPathingLibInstance->renderNavMeshEdges();
+ gPathfindingProgram.bind();
gGL.flush();
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
@@ -5014,53 +4945,31 @@ void LLPipeline::renderDebug()
if ( LLPathfindingPathTool::getInstance()->isRenderPath() )
{
//The path
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
- llPathingLibInstance->renderPath();
- gPathfindingProgram.bind();
- }
- else
- {
- llPathingLibInstance->renderPath();
- }
- //The bookends
- if (LLGLSLShader::sNoFixedFunction)
- {
- //remove blending artifacts
- gGL.setColorMask(false, false);
- llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START );
- llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END );
+ gUIProgram.bind();
+ gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
+ llPathingLibInstance->renderPath();
+ gPathfindingProgram.bind();
+
+ //The bookends
+ //remove blending artifacts
+ gGL.setColorMask(false, false);
+ llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START );
+ llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END );
- gGL.setColorMask(true, false);
- //render the bookends
- LLGLEnable blend(GL_BLEND);
- gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
- llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START );
- llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END );
- gPathfindingProgram.bind();
- }
- else
- {
- llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START );
- llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END );
- }
-
+ gGL.setColorMask(true, false);
+ //render the bookends
+ LLGLEnable blend(GL_BLEND);
+ gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
+ llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START );
+ llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END );
+ gPathfindingProgram.bind();
}
if ( pathfindingConsole->isRenderWaterPlane() )
{
- if (LLGLSLShader::sNoFixedFunction)
- {
- LLGLEnable blend(GL_BLEND);
- gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
- llPathingLibInstance->renderSimpleShapes( gGL, gAgent.getRegion()->getWaterHeight() );
- }
- else
- {
- llPathingLibInstance->renderSimpleShapes( gGL, gAgent.getRegion()->getWaterHeight() );
- }
+ LLGLEnable blend(GL_BLEND);
+ gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
+ llPathingLibInstance->renderSimpleShapes( gGL, gAgent.getRegion()->getWaterHeight() );
}
//physics/exclusion shapes
if ( pathfindingConsole->isRenderAnyShapes() )
@@ -5191,18 +5100,11 @@ void LLPipeline::renderDebug()
}
//render edges
- if (LLGLSLShader::sNoFixedFunction)
- {
- gPathfindingNoNormalsProgram.bind();
- gPathfindingNoNormalsProgram.uniform1f(sTint, gSavedSettings.getF32("PathfindingXRayTint"));
- gPathfindingNoNormalsProgram.uniform1f(sAlphaScale, gSavedSettings.getF32("PathfindingXRayOpacity"));
- llPathingLibInstance->renderNavMeshEdges();
- gPathfindingProgram.bind();
- }
- else
- {
- llPathingLibInstance->renderNavMeshEdges();
- }
+ gPathfindingNoNormalsProgram.bind();
+ gPathfindingNoNormalsProgram.uniform1f(sTint, gSavedSettings.getF32("PathfindingXRayTint"));
+ gPathfindingNoNormalsProgram.uniform1f(sAlphaScale, gSavedSettings.getF32("PathfindingXRayOpacity"));
+ llPathingLibInstance->renderNavMeshEdges();
+ gPathfindingProgram.bind();
gGL.flush();
glLineWidth(1.0f);
@@ -5211,10 +5113,7 @@ void LLPipeline::renderDebug()
glPolygonOffset(0.f, 0.f);
gGL.flush();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gPathfindingProgram.unbind();
- }
+ gPathfindingProgram.unbind();
}
}
}
@@ -5229,10 +5128,7 @@ void LLPipeline::renderDebug()
if (!hud_only && !mDebugBlips.empty())
{ //render debug blips
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep, true);
@@ -5296,7 +5192,7 @@ void LLPipeline::renderDebug()
}
}
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION) && LLGLSLShader::sNoFixedFunction)
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION))
{ //render visible selected group occlusion geometry
gDebugProgram.bind();
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
@@ -5318,44 +5214,38 @@ void LLPipeline::renderDebug()
visible_selected_groups.clear();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RAYCAST) && !hud_only)
{ //draw crosshairs on particle intersection
if (gDebugRaycastParticle)
{
- if (LLGLSLShader::sNoFixedFunction)
- { //this debug display requires shaders
- gDebugProgram.bind();
+ gDebugProgram.bind();
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLVector3 center(gDebugRaycastParticleIntersection.getF32ptr());
- LLVector3 size(0.1f, 0.1f, 0.1f);
+ LLVector3 center(gDebugRaycastParticleIntersection.getF32ptr());
+ LLVector3 size(0.1f, 0.1f, 0.1f);
- LLVector3 p[6];
+ LLVector3 p[6];
- p[0] = center + size.scaledVec(LLVector3(1,0,0));
- p[1] = center + size.scaledVec(LLVector3(-1,0,0));
- p[2] = center + size.scaledVec(LLVector3(0,1,0));
- p[3] = center + size.scaledVec(LLVector3(0,-1,0));
- p[4] = center + size.scaledVec(LLVector3(0,0,1));
- p[5] = center + size.scaledVec(LLVector3(0,0,-1));
+ p[0] = center + size.scaledVec(LLVector3(1,0,0));
+ p[1] = center + size.scaledVec(LLVector3(-1,0,0));
+ p[2] = center + size.scaledVec(LLVector3(0,1,0));
+ p[3] = center + size.scaledVec(LLVector3(0,-1,0));
+ p[4] = center + size.scaledVec(LLVector3(0,0,1));
+ p[5] = center + size.scaledVec(LLVector3(0,0,-1));
- gGL.begin(LLRender::LINES);
- gGL.diffuseColor3f(1.f, 1.f, 0.f);
- for (U32 i = 0; i < 6; i++)
- {
- gGL.vertex3fv(p[i].mV);
- }
- gGL.end();
- gGL.flush();
-
- gDebugProgram.unbind();
+ gGL.begin(LLRender::LINES);
+ gGL.diffuseColor3f(1.f, 1.f, 0.f);
+ for (U32 i = 0; i < 6; i++)
+ {
+ gGL.vertex3fv(p[i].mV);
}
+ gGL.end();
+ gGL.flush();
+
+ gDebugProgram.unbind();
}
}
@@ -5588,17 +5478,12 @@ void LLPipeline::renderDebug()
}
gGL.flush();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.unbind();
- }
+ gUIProgram.unbind();
}
-static LLTrace::BlockTimerStatHandle FTM_REBUILD_POOLS("Rebuild Pools");
-
void LLPipeline::rebuildPools()
{
- LL_RECORD_BLOCK_TIME(FTM_REBUILD_POOLS);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
assertInitialized();
@@ -5942,6 +5827,7 @@ void LLPipeline::removeFromQuickLookup( LLDrawPool* poolp )
void LLPipeline::resetDrawOrders()
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
assertInitialized();
// Iterate through all of the draw pools and rebuild them.
for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter)
@@ -6261,11 +6147,6 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
LLEnvironment& environment = LLEnvironment::instance();
LLSettingsSky::ptr_t psky = environment.getCurrentSky();
- if (!LLGLSLShader::sNoFixedFunction)
- {
- gGL.syncMatrices();
- }
-
// Ambient
LLColor4 ambient = psky->getTotalAmbient();
gGL.setAmbientLightColor(ambient);
@@ -6387,21 +6268,19 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
continue;
}
- LLVector3 light_pos(light->getRenderPosition());
- LLVector4 light_pos_gl(light_pos, 1.0f);
-
- F32 light_radius = llmax(light->getLightRadius(), 0.001f);
- F32 size = light_radius * (sRenderDeferred ? 1.5f : 1.0f);
+ LLVector3 light_pos(light->getRenderPosition());
+ LLVector4 light_pos_gl(light_pos, 1.0f);
- if (size <= 0.001f)
+ F32 adjusted_radius = light->getLightRadius() * (sRenderDeferred ? 1.5f : 1.0f);
+ if (adjusted_radius <= 0.001f)
{
continue;
}
- F32 x = (3.f * (1.f + (light->getLightFalloff() * 2.0f))); // why this magic? probably trying to match a historic behavior.
- F32 linatten = x / (light_radius); // % of brightness at radius
+ F32 x = (3.f * (1.f + (light->getLightFalloff() * 2.0f))); // why this magic? probably trying to match a historic behavior.
+ F32 linatten = x / adjusted_radius; // % of brightness at radius
- mHWLightColors[cur_light] = light_color;
+ mHWLightColors[cur_light] = light_color;
LLLightState* light_state = gGL.getLight(cur_light);
light_state->setPosition(light_pos_gl);
@@ -6410,7 +6289,7 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
light_state->setConstantAttenuation(0.f);
if (sRenderDeferred)
{
- light_state->setLinearAttenuation(size);
+ light_state->setLinearAttenuation(linatten);
light_state->setQuadraticAttenuation(light->getLightFalloff(DEFERRED_LIGHT_FALLOFF) + 1.f); // get falloff to match for forward deferred rendering lights
}
else
@@ -6466,11 +6345,6 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
// prev site of forward (non-deferred) character light injection, removed by SL-13522 09/20
// Init GL state
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glDisable(GL_LIGHTING);
- }
-
for (S32 i = 0; i < 8; ++i)
{
gGL.getLight(i)->disable();
@@ -6489,13 +6363,6 @@ void LLPipeline::enableLights(U32 mask)
if (mLightMask != mask)
{
stop_glerror();
- if (!mLightMask)
- {
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glEnable(GL_LIGHTING);
- }
- }
if (mask)
{
stop_glerror();
@@ -6515,13 +6382,6 @@ void LLPipeline::enableLights(U32 mask)
}
stop_glerror();
}
- else
- {
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glDisable(GL_LIGHTING);
- }
- }
mLightMask = mask;
stop_glerror();
}
@@ -6572,11 +6432,6 @@ void LLPipeline::enableLightsPreview()
{
disableLights();
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glEnable(GL_LIGHTING);
- }
-
LLColor4 ambient = PreviewAmbientColor;
gGL.setAmbientLightColor(ambient);
@@ -7358,8 +7213,6 @@ void LLPipeline::resetVertexBuffers()
mResetVertexBuffers = true;
}
-static LLTrace::BlockTimerStatHandle FTM_RESET_VB("Reset VB");
-
void LLPipeline::doResetVertexBuffers(bool forced)
{
if (!mResetVertexBuffers)
@@ -7381,7 +7234,7 @@ void LLPipeline::doResetVertexBuffers(bool forced)
}
}
- LL_RECORD_BLOCK_TIME(FTM_RESET_VB);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
mResetVertexBuffers = false;
mCubeVB = NULL;
@@ -7421,11 +7274,6 @@ void LLPipeline::doResetVertexBuffers(bool forced)
SUBSYSTEM_CLEANUP(LLVertexBuffer);
- //delete all name pool caches
- LLGLNamePool::cleanupPools();
-
-
-
if (LLVertexBuffer::sGLCount > 0)
{
LL_WARNS() << "VBO wipe failed -- " << LLVertexBuffer::sGLCount << " buffers remaining." << LL_ENDL;
@@ -7451,32 +7299,91 @@ void LLPipeline::doResetVertexBuffers(bool forced)
LLVOPartGroup::restoreGL();
}
-void LLPipeline::renderObjects(U32 type, U32 mask, bool texture, bool batch_texture)
+void LLPipeline::renderObjects(U32 type, U32 mask, bool texture, bool batch_texture, bool rigged)
{
assertInitialized();
gGL.loadMatrix(gGLModelView);
gGLLastMatrix = NULL;
- mSimplePool->pushBatches(type, mask, texture, batch_texture);
+ if (rigged)
+ {
+ mSimplePool->pushRiggedBatches(type + 1, mask, texture, batch_texture);
+ }
+ else
+ {
+ mSimplePool->pushBatches(type, mask, texture, batch_texture);
+ }
gGL.loadMatrix(gGLModelView);
gGLLastMatrix = NULL;
}
-void LLPipeline::renderMaskedObjects(U32 type, U32 mask, bool texture, bool batch_texture)
+void LLPipeline::renderAlphaObjects(U32 mask, bool texture, bool batch_texture, bool rigged)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
+ assertInitialized();
+ gGL.loadMatrix(gGLModelView);
+ gGLLastMatrix = NULL;
+ U32 type = LLRenderPass::PASS_ALPHA;
+ LLVOAvatar* lastAvatar = nullptr;
+ U64 lastMeshId = 0;
+ for (LLCullResult::drawinfo_iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i)
+ {
+ LLDrawInfo* pparams = *i;
+ if (pparams)
+ {
+ if (rigged)
+ {
+ if (pparams->mAvatar != nullptr)
+ {
+ if (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash)
+ {
+ mSimplePool->uploadMatrixPalette(*pparams);
+ lastAvatar = pparams->mAvatar;
+ lastMeshId = pparams->mSkinInfo->mHash;
+ }
+
+ mSimplePool->pushBatch(*pparams, mask | LLVertexBuffer::MAP_WEIGHT4, texture, batch_texture);
+ }
+ }
+ else if (pparams->mAvatar == nullptr)
+ {
+ mSimplePool->pushBatch(*pparams, mask, texture, batch_texture);
+ }
+ }
+ }
+ gGL.loadMatrix(gGLModelView);
+ gGLLastMatrix = NULL;
+}
+
+void LLPipeline::renderMaskedObjects(U32 type, U32 mask, bool texture, bool batch_texture, bool rigged)
{
assertInitialized();
gGL.loadMatrix(gGLModelView);
gGLLastMatrix = NULL;
- mAlphaMaskPool->pushMaskBatches(type, mask, texture, batch_texture);
+ if (rigged)
+ {
+ mAlphaMaskPool->pushRiggedMaskBatches(type+1, mask, texture, batch_texture);
+ }
+ else
+ {
+ mAlphaMaskPool->pushMaskBatches(type, mask, texture, batch_texture);
+ }
gGL.loadMatrix(gGLModelView);
gGLLastMatrix = NULL;
}
-void LLPipeline::renderFullbrightMaskedObjects(U32 type, U32 mask, bool texture, bool batch_texture)
+void LLPipeline::renderFullbrightMaskedObjects(U32 type, U32 mask, bool texture, bool batch_texture, bool rigged)
{
assertInitialized();
gGL.loadMatrix(gGLModelView);
gGLLastMatrix = NULL;
- mFullbrightAlphaMaskPool->pushMaskBatches(type, mask, texture, batch_texture);
+ if (rigged)
+ {
+ mFullbrightAlphaMaskPool->pushRiggedMaskBatches(type+1, mask, texture, batch_texture);
+ }
+ else
+ {
+ mFullbrightAlphaMaskPool->pushMaskBatches(type, mask, texture, batch_texture);
+ }
gGL.loadMatrix(gGLModelView);
gGLLastMatrix = NULL;
}
@@ -7581,11 +7488,8 @@ void LLPipeline::renderFinalize()
if (sRenderGlow)
{
- {
- LL_RECORD_BLOCK_TIME(FTM_RENDER_BLOOM_FBO);
- mGlow[2].bindTarget();
- mGlow[2].clear();
- }
+ mGlow[2].bindTarget();
+ mGlow[2].clear();
gGlowExtractProgram.bind();
F32 minLum = llmax((F32) RenderGlowMinLuminance, 0.0f);
@@ -7651,11 +7555,8 @@ void LLPipeline::renderFinalize()
for (S32 i = 0; i < kernel; i++)
{
- {
- LL_RECORD_BLOCK_TIME(FTM_RENDER_BLOOM_FBO);
- mGlow[i % 2].bindTarget();
- mGlow[i % 2].clear();
- }
+ mGlow[i % 2].bindTarget();
+ mGlow[i % 2].clear();
if (i == 0)
{
@@ -8080,18 +7981,7 @@ void LLPipeline::renderFinalize()
LLGLDisable blend(GL_BLEND);
- if (LLGLSLShader::sNoFixedFunction)
- {
- gGlowCombineProgram.bind();
- }
- else
- {
- // tex unit 0
- gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR);
- // tex unit 1
- gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_ADD, LLTexUnit::TBS_TEX_COLOR,
- LLTexUnit::TBS_PREV_COLOR);
- }
+ gGlowCombineProgram.bind();
gGL.getTexUnit(0)->bind(&mGlow[1]);
gGL.getTexUnit(1)->bind(&mScreen);
@@ -8101,28 +7991,14 @@ void LLPipeline::renderFinalize()
buff->setBuffer(mask);
buff->drawArrays(LLRender::TRIANGLE_STRIP, 0, 3);
- if (LLGLSLShader::sNoFixedFunction)
- {
- gGlowCombineProgram.unbind();
- }
- else
- {
- gGL.getTexUnit(1)->disable();
- gGL.getTexUnit(1)->setTextureBlendType(LLTexUnit::TB_MULT);
-
- gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
- }
+ gGlowCombineProgram.unbind();
}
gGL.setSceneBlendType(LLRender::BT_ALPHA);
if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES))
{
- if (LLGLSLShader::sNoFixedFunction)
- {
- gSplatTextureRectProgram.bind();
- }
+ gSplatTextureRectProgram.bind();
gGL.setColorMask(true, false);
@@ -8148,10 +8024,7 @@ void LLPipeline::renderFinalize()
gGL.end();
gGL.flush();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gSplatTextureRectProgram.unbind();
- }
+ gSplatTextureRectProgram.unbind();
}
if (LLRenderTarget::sUseFBO)
@@ -8172,11 +8045,9 @@ void LLPipeline::renderFinalize()
LLGLState::checkTextureChannels();
}
-static LLTrace::BlockTimerStatHandle FTM_BIND_DEFERRED("Bind Deferred");
-
void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_target)
{
- LL_RECORD_BLOCK_TIME(FTM_BIND_DEFERRED);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
LLRenderTarget* deferred_target = &mDeferredScreen;
LLRenderTarget* deferred_depth_target = &mDeferredDepth;
@@ -8418,8 +8289,6 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
LLEnvironment& environment = LLEnvironment::instance();
LLSettingsSky::ptr_t sky = environment.getCurrentSky();
-
- static_cast<LLSettingsVOSky*>(sky.get())->updateShader(&shader);
}
LLColor3 pow3f(LLColor3 v, F32 f)
@@ -8438,19 +8307,9 @@ LLVector4 pow4fsrgb(LLVector4 v, F32 f)
return v;
}
-static LLTrace::BlockTimerStatHandle FTM_GI_TRACE("Trace");
-static LLTrace::BlockTimerStatHandle FTM_GI_GATHER("Gather");
-static LLTrace::BlockTimerStatHandle FTM_SUN_SHADOW("Shadow Map");
-static LLTrace::BlockTimerStatHandle FTM_SOFTEN_SHADOW("Shadow Soften");
-static LLTrace::BlockTimerStatHandle FTM_EDGE_DETECTION("Find Edges");
-static LLTrace::BlockTimerStatHandle FTM_LOCAL_LIGHTS("Local Lights");
-static LLTrace::BlockTimerStatHandle FTM_ATMOSPHERICS("Atmospherics");
-static LLTrace::BlockTimerStatHandle FTM_FULLSCREEN_LIGHTS("Fullscreen Lights");
-static LLTrace::BlockTimerStatHandle FTM_PROJECTORS("Projectors");
-static LLTrace::BlockTimerStatHandle FTM_POST("Post");
-
void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
if (!sCull)
{
return;
@@ -8461,7 +8320,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target)
LLRenderTarget *deferred_light_target = &mDeferredLight;
{
- LL_RECORD_BLOCK_TIME(FTM_RENDER_DEFERRED);
+ LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("deferred"); //LL_RECORD_BLOCK_TIME(FTM_RENDER_DEFERRED);
LLViewerCamera *camera = LLViewerCamera::getInstance();
{
LLGLDepthTest depth(GL_TRUE);
@@ -8527,7 +8386,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target)
{
deferred_light_target->bindTarget();
{ // paint shadow/SSAO light map (direct lighting lightmap)
- LL_RECORD_BLOCK_TIME(FTM_SUN_SHADOW);
+ LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("renderDeferredLighting - sun shadow");
bindDeferredShader(gDeferredSunProgram, deferred_light_target);
mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
glClearColor(1, 1, 1, 1);
@@ -8573,7 +8432,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target)
if (RenderDeferredSSAO)
{ // soften direct lighting lightmap
- LL_RECORD_BLOCK_TIME(FTM_SOFTEN_SHADOW);
+ LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("renderDeferredLighting - soften shadow");
// blur lightmap
screen_target->bindTarget();
glClearColor(1, 1, 1, 1);
@@ -8651,7 +8510,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target)
{ // apply sunlight contribution
LLGLSLShader &soften_shader = LLPipeline::sUnderWaterRender ? gDeferredSoftenWaterProgram : gDeferredSoftenProgram;
- LL_RECORD_BLOCK_TIME(FTM_ATMOSPHERICS);
+ LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("renderDeferredLighting - atmospherics");
bindDeferredShader(soften_shader);
LLEnvironment &environment = LLEnvironment::instance();
@@ -8717,6 +8576,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target)
LLVertexBuffer::unbind();
{
+ LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("renderDeferredLighting - local lights");
bindDeferredShader(gDeferredLightProgram);
if (mCubeVB.isNull())
@@ -8787,7 +8647,6 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target)
continue;
}
- LL_RECORD_BLOCK_TIME(FTM_LOCAL_LIGHTS);
gDeferredLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c);
gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s);
gDeferredLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
@@ -8823,6 +8682,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target)
if (!spot_lights.empty())
{
+ LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("renderDeferredLighting - projectors");
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
bindDeferredShader(gDeferredSpotLightProgram);
@@ -8832,7 +8692,6 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target)
for (LLDrawable::drawable_list_t::iterator iter = spot_lights.begin(); iter != spot_lights.end(); ++iter)
{
- LL_RECORD_BLOCK_TIME(FTM_PROJECTORS);
LLDrawable *drawablep = *iter;
LLVOVolume *volume = drawablep->getVOVolume();
@@ -8868,6 +8727,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target)
vert[2].set(3, 1, 0);
{
+ LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("renderDeferredLighting - fullscreen lights");
LLGLDepthTest depth(GL_FALSE);
// full screen blit
@@ -8887,7 +8747,6 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target)
while (!fullscreen_lights.empty())
{
- LL_RECORD_BLOCK_TIME(FTM_FULLSCREEN_LIGHTS);
light[count] = fullscreen_lights.front();
fullscreen_lights.pop_front();
col[count] = light_colors.front();
@@ -8919,7 +8778,6 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target)
for (LLDrawable::drawable_list_t::iterator iter = fullscreen_spot_lights.begin(); iter != fullscreen_spot_lights.end(); ++iter)
{
- LL_RECORD_BLOCK_TIME(FTM_PROJECTORS);
LLDrawable *drawablep = *iter;
LLVOVolume *volume = drawablep->getVOVolume();
LLVector3 center = drawablep->getPositionAgent();
@@ -9263,8 +9121,19 @@ inline float sgn(float a)
void LLPipeline::generateWaterReflection(LLCamera& camera_in)
{
- if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate)
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
+
+ if (!assertInitialized())
+ {
+ return;
+ }
+
+ if (LLPipeline::sWaterReflections && LLDrawPoolWater::sNeedsReflectionUpdate)
{
+ //disable occlusion culling for reflection/refraction passes (save setting to restore later)
+ S32 occlude = LLPipeline::sUseOcclusion;
+ LLPipeline::sUseOcclusion = 0;
+
bool skip_avatar_update = false;
if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson)
{
@@ -9301,26 +9170,19 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
//plane params
LLPlane plane;
LLVector3 pnorm;
- S32 water_clip = 0;
- if (!camera_is_underwater)
+
+ if (camera_is_underwater)
{
- //camera is above water, clip plane points up
- pnorm.setVec(0,0,1);
- plane.setVec(pnorm, -water_height);
- water_clip = 1;
+ //camera is below water, cull above water
+ pnorm.setVec(0, 0, 1);
}
else
{
- //camera is below water, clip plane points down
- pnorm = LLVector3(0,0,-1);
- plane.setVec(pnorm, water_height);
- water_clip = -1;
+ //camera is above water, cull below water
+ pnorm = LLVector3(0, 0, -1);
}
- S32 occlusion = LLPipeline::sUseOcclusion;
-
- //disable occlusion culling for reflection map for now
- LLPipeline::sUseOcclusion = 0;
+ plane.setVec(LLVector3(0, 0, water_height), pnorm);
if (!camera_is_underwater)
{
@@ -9419,7 +9281,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
LLGLUserClipPlane clip_plane(plane, mReflectionModelView, saved_projection);
LLGLDisable cull(GL_CULL_FACE);
- updateCull(camera, mReflectedObjects, -water_clip, &plane);
+ updateCull(camera, mReflectedObjects, &plane);
stateSort(camera, mReflectedObjects);
renderGeom(camera);
}
@@ -9437,8 +9299,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
set_current_modelview(saved_modelview);
}
- //LLPipeline::sUseOcclusion = occlusion;
-
camera.setOrigin(camera_in.getOrigin());
//render distortion map
static bool last_update = true;
@@ -9477,7 +9337,11 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
LLColor3 col = LLEnvironment::instance().getCurrentWater()->getWaterFogColor();
glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f);
- LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER1;
+ // HACK FIX -- pretend underwater camera is the world camera to fix weird visibility artifacts
+ // during distortion render (doesn't break main render because the camera is the same perspective
+ // as world camera and occlusion culling is disabled for this pass)
+ //LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER1;
+ LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
mWaterDis.bindTarget();
mWaterDis.getViewport(gGLViewport);
@@ -9486,41 +9350,47 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
mWaterDis.clear();
gGL.setColorMask(true, false);
- F32 water_dist = water_height * LLPipeline::sDistortionWaterClipPlaneMargin;
+ F32 water_dist = water_height;
//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_dist);
+ LLPlane plane;
+
+ if (camera_is_underwater)
+ {
+ //nudge clip plane below water to avoid visible holes in objects intersecting water surface
+ water_dist /= LLPipeline::sDistortionWaterClipPlaneMargin;
+ //camera is below water, clip plane points up
+ pnorm.setVec(0, 0, -1);
+ }
+ else
+ {
+ //nudge clip plane above water to avoid visible holes in objects intersecting water surface
+ water_dist *= LLPipeline::sDistortionWaterClipPlaneMargin;
+ //camera is above water, clip plane points down
+ pnorm = LLVector3(0, 0, 1);
+ }
+
+ plane.setVec(LLVector3(0, 0, water_dist), pnorm);
+
LLGLUserClipPlane clip_plane(plane, saved_modelview, saved_projection);
gGL.setColorMask(true, true);
mWaterDis.clear();
gGL.setColorMask(true, false);
- // ignore clip plane if we're underwater and viewing distortion map of objects above waterline
- if (camera_is_underwater)
- {
- clip_plane.disable();
- }
-
if (reflection_detail >= WATER_REFLECT_NONE_WATER_TRANSPARENT)
{
- updateCull(camera, mRefractedObjects, water_clip, &plane);
+ updateCull(camera, mRefractedObjects, &plane);
stateSort(camera, mRefractedObjects);
renderGeom(camera);
}
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
LLWorld::getInstance()->renderPropertyLines();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.unbind();
- }
+ gUIProgram.unbind();
mWaterDis.flush();
}
@@ -9533,7 +9403,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
gPipeline.popRenderTypeMask();
- LLPipeline::sUseOcclusion = occlusion;
LLPipeline::sUnderWaterRender = false;
LLPipeline::sReflectionRender = false;
@@ -9555,6 +9424,32 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
}
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
+
+ // restore occlusion culling
+ LLPipeline::sUseOcclusion = occlude;
+ }
+ else
+ {
+ // Initial sky pass is still needed even if water reflection is not rendering
+ bool camera_is_underwater = LLViewerCamera::getInstance()->cameraUnderWater();
+ if (!camera_is_underwater)
+ {
+ gPipeline.pushRenderTypeMask();
+ {
+ gPipeline.andRenderTypeMask(
+ LLPipeline::RENDER_TYPE_SKY,
+ LLPipeline::RENDER_TYPE_WL_SKY,
+ LLPipeline::END_RENDER_TYPES);
+
+ LLCamera camera = camera_in;
+ camera.setFar(camera_in.getFar() * 0.75f);
+
+ updateCull(camera, mSky);
+ stateSort(camera, mSky);
+ renderGeom(camera, TRUE);
+ }
+ gPipeline.popRenderTypeMask();
+ }
}
}
@@ -9635,204 +9530,212 @@ static LLTrace::BlockTimerStatHandle FTM_SHADOW_ALPHA_TREE("Alpha Tree");
static LLTrace::BlockTimerStatHandle FTM_SHADOW_ALPHA_GRASS("Alpha Grass");
static LLTrace::BlockTimerStatHandle FTM_SHADOW_FULLBRIGHT_ALPHA_MASKED("Fullbright Alpha Masked");
-void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& shadow_cam, LLCullResult &result, bool use_shader, bool use_occlusion, U32 target_width)
+void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& shadow_cam, LLCullResult& result, bool use_shader, bool use_occlusion, U32 target_width)
{
- LL_RECORD_BLOCK_TIME(FTM_SHADOW_RENDER);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; //LL_RECORD_BLOCK_TIME(FTM_SHADOW_RENDER);
- //clip out geometry on the same side of water as the camera
- S32 occlude = LLPipeline::sUseOcclusion;
- if (!use_occlusion)
- {
- LLPipeline::sUseOcclusion = 0;
- }
- LLPipeline::sShadowRender = true;
-
- static const U32 types[] = {
- LLRenderPass::PASS_SIMPLE,
- LLRenderPass::PASS_FULLBRIGHT,
- LLRenderPass::PASS_SHINY,
- LLRenderPass::PASS_BUMP,
- LLRenderPass::PASS_FULLBRIGHT_SHINY ,
- LLRenderPass::PASS_MATERIAL,
- LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE,
- LLRenderPass::PASS_SPECMAP,
- LLRenderPass::PASS_SPECMAP_EMISSIVE,
- LLRenderPass::PASS_NORMMAP,
- LLRenderPass::PASS_NORMMAP_EMISSIVE,
- LLRenderPass::PASS_NORMSPEC,
- LLRenderPass::PASS_NORMSPEC_EMISSIVE,
- };
+ //disable occlusion culling for shadow passes (save setting to restore later)
+ S32 occlude = LLPipeline::sUseOcclusion;
+ if (!use_occlusion)
+ {
+ LLPipeline::sUseOcclusion = 0;
+ }
+ LLPipeline::sShadowRender = true;
+
+ static const U32 types[] = {
+ LLRenderPass::PASS_SIMPLE,
+ LLRenderPass::PASS_FULLBRIGHT,
+ LLRenderPass::PASS_SHINY,
+ LLRenderPass::PASS_BUMP,
+ LLRenderPass::PASS_FULLBRIGHT_SHINY ,
+ LLRenderPass::PASS_MATERIAL,
+ LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE,
+ LLRenderPass::PASS_SPECMAP,
+ LLRenderPass::PASS_SPECMAP_EMISSIVE,
+ LLRenderPass::PASS_NORMMAP,
+ LLRenderPass::PASS_NORMMAP_EMISSIVE,
+ LLRenderPass::PASS_NORMSPEC,
+ LLRenderPass::PASS_NORMSPEC_EMISSIVE,
+ };
+
+ LLGLEnable cull(GL_CULL_FACE);
+
+ //enable depth clamping if available
+ LLGLEnable depth_clamp(gGLManager.mHasDepthClamp ? GL_DEPTH_CLAMP : 0);
+
+ if (use_shader)
+ {
+ gDeferredShadowCubeProgram.bind();
+ }
- LLGLEnable cull(GL_CULL_FACE);
+ LLRenderTarget& occlusion_target = mShadowOcclusion[LLViewerCamera::sCurCameraID - 1];
- //enable depth clamping if available
- LLGLEnable depth_clamp(gGLManager.mHasDepthClamp ? GL_DEPTH_CLAMP : 0);
+ occlusion_target.bindTarget();
+ updateCull(shadow_cam, result);
+ occlusion_target.flush();
- if (use_shader)
- {
- gDeferredShadowCubeProgram.bind();
- }
+ stateSort(shadow_cam, result);
- LLRenderTarget& occlusion_target = mShadowOcclusion[LLViewerCamera::sCurCameraID-1];
- occlusion_target.bindTarget();
- updateCull(shadow_cam, result);
- occlusion_target.flush();
+ //generate shadow map
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadMatrix(proj.m);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ gGL.loadMatrix(view.m);
- stateSort(shadow_cam, result);
-
-
- //generate shadow map
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.pushMatrix();
- gGL.loadMatrix(proj.m);
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- gGL.loadMatrix(view.m);
+ stop_glerror();
+ gGLLastMatrix = NULL;
- stop_glerror();
- gGLLastMatrix = NULL;
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ stop_glerror();
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- stop_glerror();
-
LLEnvironment& environment = LLEnvironment::instance();
- LLVertexBuffer::unbind();
+ LLVertexBuffer::unbind();
- {
- if (!use_shader)
- { //occlusion program is general purpose depth-only no-textures
- gOcclusionProgram.bind();
- }
- else
- {
- gDeferredShadowProgram.bind();
- gDeferredShadowProgram.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
- }
+ for (int j = 0; j < 2; ++j) // 0 -- static, 1 -- rigged
+ {
+ bool rigged = j == 1;
+ if (!use_shader)
+ { //occlusion program is general purpose depth-only no-textures
+ gOcclusionProgram.bind(rigged);
+ }
+ else
+ {
+ gDeferredShadowProgram.bind(rigged);
+ LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
+ }
- gGL.diffuseColor4f(1,1,1,1);
+ gGL.diffuseColor4f(1, 1, 1, 1);
S32 shadow_detail = gSavedSettings.getS32("RenderShadowDetail");
// if not using VSM, disable color writes
if (shadow_detail <= 2)
{
- gGL.setColorMask(false, false);
+ gGL.setColorMask(false, false);
}
-
- LL_RECORD_BLOCK_TIME(FTM_SHADOW_SIMPLE);
-
- gGL.getTexUnit(0)->disable();
- for (U32 i = 0; i < sizeof(types)/sizeof(U32); ++i)
- {
- renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE);
- }
- gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
- if (!use_shader)
- {
- gOcclusionProgram.unbind();
- }
- }
-
- if (use_shader)
- {
- LL_RECORD_BLOCK_TIME(FTM_SHADOW_GEOM);
- gDeferredShadowProgram.unbind();
- renderGeomShadow(shadow_cam);
- gDeferredShadowProgram.bind();
- gDeferredShadowProgram.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
- }
- else
- {
- LL_RECORD_BLOCK_TIME(FTM_SHADOW_GEOM);
+ LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow simple"); //LL_RECORD_BLOCK_TIME(FTM_SHADOW_SIMPLE);
- renderGeomShadow(shadow_cam);
- }
+ gGL.getTexUnit(0)->disable();
+ for (U32 i = 0; i < sizeof(types) / sizeof(U32); ++i)
+ {
+ renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE, FALSE, rigged);
+ }
+ gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
+ if (!use_shader)
+ {
+ gOcclusionProgram.unbind();
+ }
- {
- LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA);
- gDeferredShadowAlphaMaskProgram.bind();
- gDeferredShadowAlphaMaskProgram.uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width);
- gDeferredShadowAlphaMaskProgram.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
+ }
- U32 mask = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_TEXCOORD0 |
- LLVertexBuffer::MAP_COLOR |
- LLVertexBuffer::MAP_TEXTURE_INDEX;
+ if (use_shader)
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow geom"); //LL_RECORD_BLOCK_TIME(FTM_SHADOW_GEOM);
- {
- LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA_MASKED);
- renderMaskedObjects(LLRenderPass::PASS_ALPHA_MASK, mask, TRUE, TRUE);
- }
+ gDeferredShadowProgram.unbind();
+ renderGeomShadow(shadow_cam);
+ gDeferredShadowProgram.bind();
+ gDeferredShadowProgram.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
+ }
+ else
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow geom"); //LL_RECORD_BLOCK_TIME(FTM_SHADOW_GEOM);
- {
- LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA_BLEND);
- gDeferredShadowAlphaMaskProgram.setMinimumAlpha(0.598f);
- renderObjects(LLRenderPass::PASS_ALPHA, mask, TRUE, TRUE);
- }
+ renderGeomShadow(shadow_cam);
+ }
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha"); //LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA);
+ for (int i = 0; i < 2; ++i)
{
- LL_RECORD_BLOCK_TIME(FTM_SHADOW_FULLBRIGHT_ALPHA_MASKED);
- gDeferredShadowFullbrightAlphaMaskProgram.bind();
- gDeferredShadowFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width);
- gDeferredShadowFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
- renderFullbrightMaskedObjects(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, mask, TRUE, TRUE);
- }
+ bool rigged = i == 1;
- mask = mask & ~LLVertexBuffer::MAP_TEXTURE_INDEX;
+ gDeferredShadowAlphaMaskProgram.bind(rigged);
+ LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width);
+ LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
- {
- LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA_TREE);
- gDeferredTreeShadowProgram.bind();
- gDeferredTreeShadowProgram.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
- renderMaskedObjects(LLRenderPass::PASS_NORMSPEC_MASK, mask);
- renderMaskedObjects(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, mask);
- renderMaskedObjects(LLRenderPass::PASS_SPECMAP_MASK, mask);
- renderMaskedObjects(LLRenderPass::PASS_NORMMAP_MASK, mask);
+ U32 mask = LLVertexBuffer::MAP_VERTEX |
+ LLVertexBuffer::MAP_TEXCOORD0 |
+ LLVertexBuffer::MAP_COLOR |
+ LLVertexBuffer::MAP_TEXTURE_INDEX;
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha masked"); //LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA_MASKED);
+ renderMaskedObjects(LLRenderPass::PASS_ALPHA_MASK, mask, TRUE, TRUE, rigged);
+ }
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha blend"); //LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA_BLEND);
+ LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(0.598f);
+ renderAlphaObjects(mask, TRUE, TRUE, rigged);
+ }
+
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow fullbright alpha masked"); //LL_RECORD_BLOCK_TIME(FTM_SHADOW_FULLBRIGHT_ALPHA_MASKED);
+ gDeferredShadowFullbrightAlphaMaskProgram.bind(rigged);
+ LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width);
+ LLGLSLShader::sCurBoundShaderPtr->uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
+ renderFullbrightMaskedObjects(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, mask, TRUE, TRUE, rigged);
+ }
+
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha grass"); //LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA_GRASS);
+ gDeferredTreeShadowProgram.bind(rigged);
+ if (i == 0)
+ {
+ LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(0.598f);
+ renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE);
+ }
+
+ U32 no_idx_mask = mask & ~LLVertexBuffer::MAP_TEXTURE_INDEX;
+ renderMaskedObjects(LLRenderPass::PASS_NORMSPEC_MASK, no_idx_mask, true, false, rigged);
+ renderMaskedObjects(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, no_idx_mask, true, false, rigged);
+ renderMaskedObjects(LLRenderPass::PASS_SPECMAP_MASK, no_idx_mask, true, false, rigged);
+ renderMaskedObjects(LLRenderPass::PASS_NORMMAP_MASK, no_idx_mask, true, false, rigged);
+ }
}
-
- {
- LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA_GRASS);
- gDeferredTreeShadowProgram.setMinimumAlpha(0.598f);
- renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE);
- }
}
- //glCullFace(GL_BACK);
+ //glCullFace(GL_BACK);
- gDeferredShadowCubeProgram.bind();
- gGLLastMatrix = NULL;
- gGL.loadMatrix(gGLModelView);
+ gDeferredShadowCubeProgram.bind();
+ gGLLastMatrix = NULL;
+ gGL.loadMatrix(gGLModelView);
- LLRenderTarget& occlusion_source = mShadow[LLViewerCamera::sCurCameraID-1];
+ LLRenderTarget& occlusion_source = mShadow[LLViewerCamera::sCurCameraID - 1];
- doOcclusion(shadow_cam, occlusion_source, occlusion_target);
+ doOcclusion(shadow_cam, occlusion_source, occlusion_target);
- if (use_shader)
- {
- gDeferredShadowProgram.unbind();
- }
-
- gGL.setColorMask(true, true);
-
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.popMatrix();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.popMatrix();
- gGLLastMatrix = NULL;
+ if (use_shader)
+ {
+ gDeferredShadowProgram.unbind();
+ }
- LLPipeline::sUseOcclusion = occlude;
- LLPipeline::sShadowRender = false;
+ gGL.setColorMask(true, true);
+
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
+ gGLLastMatrix = NULL;
+
+ LLPipeline::sUseOcclusion = occlude;
+ LLPipeline::sShadowRender = false;
}
-static LLTrace::BlockTimerStatHandle FTM_VISIBLE_CLOUD("Visible Cloud");
bool LLPipeline::getVisiblePointCloud(LLCamera& camera, LLVector3& min, LLVector3& max, std::vector<LLVector3>& fp, LLVector3 light_dir)
{
- LL_RECORD_BLOCK_TIME(FTM_VISIBLE_CLOUD);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
//get point cloud of intersection of frust and min, max
if (getVisibleExtents(camera, min, max))
@@ -10044,10 +9947,7 @@ void LLPipeline::generateHighlight(LLCamera& camera)
gGL.setColorMask(true, true);
mHighlight.clear();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gHighlightProgram.bind();
- }
+ gHighlightProgram.bind();
gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
for (std::set<HighlightItem>::iterator iter = mHighlightSet.begin(); iter != mHighlightSet.end(); )
@@ -10089,9 +9989,6 @@ LLRenderTarget* LLPipeline::getShadowTarget(U32 i)
}
static LLTrace::BlockTimerStatHandle FTM_GEN_SUN_SHADOW("Gen Sun Shadow");
-static LLTrace::BlockTimerStatHandle FTM_GEN_SUN_SHADOW_SETUP("Sun Shadow Setup");
-static LLTrace::BlockTimerStatHandle FTM_GEN_SUN_SHADOW_RENDER_DIRECTIONAL("Render Dir");
-static LLTrace::BlockTimerStatHandle FTM_GEN_SUN_SHADOW_SPOT_SETUP("Spot Shadow Setup");
static LLTrace::BlockTimerStatHandle FTM_GEN_SUN_SHADOW_SPOT_RENDER("Spot Shadow Render");
void LLPipeline::generateSunShadow(LLCamera& camera)
@@ -10101,7 +9998,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
return;
}
- LL_RECORD_BLOCK_TIME(FTM_GEN_SUN_SHADOW);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; //LL_RECORD_BLOCK_TIME(FTM_GEN_SUN_SHADOW);
bool skip_avatar_update = false;
if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson)
@@ -10161,6 +10058,29 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
LLPipeline::RENDER_TYPE_PASS_NORMSPEC_BLEND,
LLPipeline::RENDER_TYPE_PASS_NORMSPEC_MASK,
LLPipeline::RENDER_TYPE_PASS_NORMSPEC_EMISSIVE,
+ LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_SIMPLE_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_BUMP_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_SHINY_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_SHINY_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_MATERIAL_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_MATERIAL_ALPHA_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_MATERIAL_ALPHA_MASK_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_MATERIAL_ALPHA_EMISSIVE_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_SPECMAP_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_SPECMAP_BLEND_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_SPECMAP_MASK_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_SPECMAP_EMISSIVE_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_NORMMAP_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_NORMMAP_BLEND_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_NORMMAP_MASK_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_NORMMAP_EMISSIVE_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_NORMSPEC_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_NORMSPEC_BLEND_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_NORMSPEC_MASK_RIGGED,
+ LLPipeline::RENDER_TYPE_PASS_NORMSPEC_EMISSIVE_RIGGED,
END_RENDER_TYPES);
gGL.setColorMask(false, false);
@@ -10887,17 +10807,28 @@ void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, bool textu
}
}
-static LLTrace::BlockTimerStatHandle FTM_IMPOSTOR_MARK_VISIBLE("Impostor Mark Visible");
-static LLTrace::BlockTimerStatHandle FTM_IMPOSTOR_SETUP("Impostor Setup");
-static LLTrace::BlockTimerStatHandle FTM_IMPOSTOR_BACKGROUND("Impostor Background");
-static LLTrace::BlockTimerStatHandle FTM_IMPOSTOR_ALLOCATE("Impostor Allocate");
-static LLTrace::BlockTimerStatHandle FTM_IMPOSTOR_RESIZE("Impostor Resize");
+void LLPipeline::renderRiggedGroups(LLRenderPass* pass, U32 type, U32 mask, bool texture)
+{
+ for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i)
+ {
+ LLSpatialGroup* group = *i;
+ if (!group->isDead() &&
+ (!sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) &&
+ gPipeline.hasRenderType(group->getSpatialPartition()->mDrawableType) &&
+ group->mDrawMap.find(type) != group->mDrawMap.end())
+ {
+ pass->renderRiggedGroup(group, type, mask, texture);
+ }
+ }
+}
+
+static LLTrace::BlockTimerStatHandle FTM_GENERATE_IMPOSTOR("Generate Impostor");
-void LLPipeline::generateImpostor(LLVOAvatar* avatar)
+void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar)
{
+ LL_RECORD_BLOCK_TIME(FTM_GENERATE_IMPOSTOR);
LLGLState::checkStates();
LLGLState::checkTextureChannels();
- LLGLState::checkClientArrays();
static LLCullResult result;
result.clear();
@@ -10912,11 +10843,12 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
assertInitialized();
- bool visually_muted = avatar->isVisuallyMuted();
+ // previews can't be muted or impostered
+ bool visually_muted = !preview_avatar && avatar->isVisuallyMuted();
LL_DEBUGS_ONCE("AvatarRenderPipeline") << "Avatar " << avatar->getID()
<< " is " << ( visually_muted ? "" : "not ") << "visually muted"
<< LL_ENDL;
- bool too_complex = avatar->isTooComplex();
+ bool too_complex = !preview_avatar && avatar->isTooComplex();
LL_DEBUGS_ONCE("AvatarRenderPipeline") << "Avatar " << avatar->getID()
<< " is " << ( too_complex ? "" : "not ") << "too complex"
<< LL_ENDL;
@@ -10925,37 +10857,31 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
if (visually_muted || too_complex)
{
+ // only show jelly doll geometry
andRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR,
LLPipeline::RENDER_TYPE_CONTROL_AV,
END_RENDER_TYPES);
}
else
{
- andRenderTypeMask(LLPipeline::RENDER_TYPE_ALPHA,
- LLPipeline::RENDER_TYPE_FULLBRIGHT,
- LLPipeline::RENDER_TYPE_VOLUME,
- LLPipeline::RENDER_TYPE_GLOW,
- LLPipeline::RENDER_TYPE_BUMP,
- LLPipeline::RENDER_TYPE_PASS_SIMPLE,
- LLPipeline::RENDER_TYPE_PASS_ALPHA,
- LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK,
- LLPipeline::RENDER_TYPE_PASS_BUMP,
- LLPipeline::RENDER_TYPE_PASS_POST_BUMP,
- LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT,
- LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK,
- LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_SHINY,
- LLPipeline::RENDER_TYPE_PASS_GLOW,
- LLPipeline::RENDER_TYPE_PASS_GRASS,
- LLPipeline::RENDER_TYPE_PASS_SHINY,
- LLPipeline::RENDER_TYPE_PASS_INVISIBLE,
- LLPipeline::RENDER_TYPE_PASS_INVISI_SHINY,
- LLPipeline::RENDER_TYPE_AVATAR,
- LLPipeline::RENDER_TYPE_CONTROL_AV,
- LLPipeline::RENDER_TYPE_ALPHA_MASK,
- LLPipeline::RENDER_TYPE_FULLBRIGHT_ALPHA_MASK,
- LLPipeline::RENDER_TYPE_INVISIBLE,
- LLPipeline::RENDER_TYPE_SIMPLE,
- END_RENDER_TYPES);
+ //hide world geometry
+ clearRenderTypeMask(
+ RENDER_TYPE_SKY,
+ RENDER_TYPE_WL_SKY,
+ RENDER_TYPE_GROUND,
+ RENDER_TYPE_TERRAIN,
+ RENDER_TYPE_GRASS,
+ RENDER_TYPE_CONTROL_AV, // Animesh
+ RENDER_TYPE_TREE,
+ RENDER_TYPE_VOIDWATER,
+ RENDER_TYPE_WATER,
+ RENDER_TYPE_PASS_GRASS,
+ RENDER_TYPE_HUD,
+ RENDER_TYPE_PARTICLES,
+ RENDER_TYPE_CLOUDS,
+ RENDER_TYPE_HUD_PARTICLES,
+ END_RENDER_TYPES
+ );
}
S32 occlusion = sUseOcclusion;
@@ -10969,7 +10895,6 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
LLViewerCamera* viewer_camera = LLViewerCamera::getInstance();
{
- LL_RECORD_BLOCK_TIME(FTM_IMPOSTOR_MARK_VISIBLE);
markVisible(avatar->mDrawable, *viewer_camera);
LLVOAvatar::attachment_map_t::iterator iter;
@@ -10997,8 +10922,8 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
U32 resY = 0;
U32 resX = 0;
+ if (!preview_avatar)
{
- LL_RECORD_BLOCK_TIME(FTM_IMPOSTOR_SETUP);
const LLVector4a* ext = avatar->mDrawable->getSpatialExtents();
LLVector3 pos(avatar->getRenderPosition()+avatar->getImpostorOffset());
@@ -11055,17 +10980,11 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
if (!avatar->mImpostor.isComplete())
{
- LL_RECORD_BLOCK_TIME(FTM_IMPOSTOR_ALLOCATE);
-
+ avatar->mImpostor.allocate(resX, resY, GL_RGBA, TRUE, FALSE);
if (LLPipeline::sRenderDeferred)
{
- avatar->mImpostor.allocate(resX,resY,GL_SRGB8_ALPHA8,TRUE,FALSE);
- addDeferredAttachments(avatar->mImpostor);
- }
- else
- {
- avatar->mImpostor.allocate(resX,resY,GL_RGBA,TRUE,FALSE);
+ addDeferredAttachments(avatar->mImpostor, true);
}
gGL.getTexUnit(0)->bind(&avatar->mImpostor);
@@ -11074,7 +10993,6 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
}
else if(resX != avatar->mImpostor.getWidth() || resY != avatar->mImpostor.getHeight())
{
- LL_RECORD_BLOCK_TIME(FTM_IMPOSTOR_RESIZE);
avatar->mImpostor.resize(resX,resY);
}
@@ -11088,7 +11006,20 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
LLDrawPoolAvatar::sMinimumAlpha = 0.f;
}
- if (LLPipeline::sRenderDeferred)
+ if (preview_avatar)
+ {
+ // previews don't care about imposters
+ if (LLPipeline::sRenderDeferred)
+ {
+ renderGeomDeferred(camera);
+ renderGeomPostDeferred(camera);
+ }
+ else
+ {
+ renderGeom(camera);
+ }
+ }
+ else if (LLPipeline::sRenderDeferred)
{
avatar->mImpostor.clear();
renderGeomDeferred(camera);
@@ -11136,10 +11067,10 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
LLDrawPoolAvatar::sMinimumAlpha = old_alpha;
{ //create alpha mask based on depth buffer (grey out if muted)
- LL_RECORD_BLOCK_TIME(FTM_IMPOSTOR_BACKGROUND);
if (LLPipeline::sRenderDeferred)
{
GLuint buff = GL_COLOR_ATTACHMENT0;
+ LL_PROFILER_GPU_ZONEC( "gl.DrawBuffersARB", 0x8000FF );
glDrawBuffersARB(1, &buff);
}
@@ -11168,11 +11099,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
static const F32 clip_plane = 0.99999f;
- if (LLGLSLShader::sNoFixedFunction)
- {
- gDebugProgram.bind();
- }
-
+ gDebugProgram.bind();
if (visually_muted)
{ // Visually muted avatar
@@ -11180,13 +11107,12 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
LL_DEBUGS_ONCE("AvatarRenderPipeline") << "Avatar " << avatar->getID() << " MUTED set solid color " << muted_color << LL_ENDL;
gGL.diffuseColor4fv( muted_color.mV );
}
- else
+ else if (!preview_avatar)
{ //grey muted avatar
LL_DEBUGS_ONCE("AvatarRenderPipeline") << "Avatar " << avatar->getID() << " MUTED set grey" << LL_ENDL;
gGL.diffuseColor4fv(LLColor4::pink.mV );
}
- {
gGL.begin(LLRender::QUADS);
gGL.vertex3f(-1, -1, clip_plane);
gGL.vertex3f(1, -1, clip_plane);
@@ -11194,21 +11120,19 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
gGL.vertex3f(-1, 1, clip_plane);
gGL.end();
gGL.flush();
- }
- if (LLGLSLShader::sNoFixedFunction)
- {
- gDebugProgram.unbind();
- }
+ gDebugProgram.unbind();
gGL.popMatrix();
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix();
}
- avatar->mImpostor.flush();
-
- avatar->setImpostorDim(tdim);
+ if (!preview_avatar)
+ {
+ avatar->mImpostor.flush();
+ avatar->setImpostorDim(tdim);
+ }
sUseOcclusion = occlusion;
sReflectionRender = false;
@@ -11221,14 +11145,16 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix();
- avatar->mNeedsImpostorUpdate = FALSE;
- avatar->cacheImpostorValues();
- avatar->mLastImpostorUpdateFrameTime = gFrameTimeSeconds;
+ if (!preview_avatar)
+ {
+ avatar->mNeedsImpostorUpdate = FALSE;
+ avatar->cacheImpostorValues();
+ avatar->mLastImpostorUpdateFrameTime = gFrameTimeSeconds;
+ }
LLVertexBuffer::unbind();
LLGLState::checkStates();
LLGLState::checkTextureChannels();
- LLGLState::checkClientArrays();
}
bool LLPipeline::hasRenderBatches(const U32 type) const
@@ -11256,6 +11182,16 @@ LLCullResult::sg_iterator LLPipeline::endAlphaGroups()
return sCull->endAlphaGroups();
}
+LLCullResult::sg_iterator LLPipeline::beginRiggedAlphaGroups()
+{
+ return sCull->beginRiggedAlphaGroups();
+}
+
+LLCullResult::sg_iterator LLPipeline::endRiggedAlphaGroups()
+{
+ return sCull->endRiggedAlphaGroups();
+}
+
bool LLPipeline::hasRenderType(const U32 type) const
{
// STORM-365 : LLViewerJointAttachment::setAttachmentVisibility() is setting type to 0 to actually mean "do not render"