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.cpp729
1 files changed, 369 insertions, 360 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index fef1128a1f..84b83357b2 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -1,28 +1,28 @@
/**
-* @file pipeline.cpp
-* @brief Rendering pipeline.
-*
-* $LicenseInfo:firstyear=2005&license=viewerlgpl$
-* Second Life Viewer Source Code
-* Copyright (C) 2010, Linden Research, Inc.
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation;
-* version 2.1 of the License only.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
-* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
-* $/LicenseInfo$
-*/
+ * @file pipeline.cpp
+ * @brief Rendering pipeline.
+ *
+ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
#include "llviewerprecompiledheaders.h"
@@ -1587,7 +1587,7 @@ void LLPipeline::restoreGL()
if (part)
{
part->restoreGL();
- }
+ }
}
}
}
@@ -2123,7 +2123,7 @@ 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(); )
+ iter != moved_list.end(); )
{
LLDrawable::drawable_vector_t::iterator curiter = iter++;
LLDrawable *drawablep = *curiter;
@@ -2789,7 +2789,7 @@ void LLPipeline::clearRebuildGroups()
mGroupQ1Locked = true;
// Iterate through all drawables on the priority build queue,
for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ1.begin();
- iter != mGroupQ1.end(); ++iter)
+ iter != mGroupQ1.end(); ++iter)
{
LLSpatialGroup* group = *iter;
@@ -2817,7 +2817,7 @@ void LLPipeline::clearRebuildDrawables()
{
// Clear all drawables on the priority build queue,
for (LLDrawable::drawable_list_t::iterator iter = mBuildQ1.begin();
- iter != mBuildQ1.end(); ++iter)
+ iter != mBuildQ1.end(); ++iter)
{
LLDrawable* drawablep = *iter;
if (drawablep && !drawablep->isDead())
@@ -2829,7 +2829,7 @@ void LLPipeline::clearRebuildDrawables()
//clear all moving bridges
for (LLDrawable::drawable_vector_t::iterator iter = mMovedBridge.begin();
- iter != mMovedBridge.end(); ++iter)
+ iter != mMovedBridge.end(); ++iter)
{
LLDrawable *drawablep = *iter;
drawablep->clearState(LLDrawable::EARLY_MOVE | LLDrawable::MOVE_UNDAMPED | LLDrawable::ON_MOVE_LIST | LLDrawable::ANIMATED_CHILD);
@@ -2838,7 +2838,7 @@ void LLPipeline::clearRebuildDrawables()
//clear all moving drawables
for (LLDrawable::drawable_vector_t::iterator iter = mMovedList.begin();
- iter != mMovedList.end(); ++iter)
+ iter != mMovedList.end(); ++iter)
{
LLDrawable *drawablep = *iter;
drawablep->clearState(LLDrawable::EARLY_MOVE | LLDrawable::MOVE_UNDAMPED | LLDrawable::ON_MOVE_LIST | LLDrawable::ANIMATED_CHILD);
@@ -2867,7 +2867,7 @@ void LLPipeline::rebuildPriorityGroups()
mGroupQ1Locked = true;
// Iterate through all drawables on the priority build queue,
for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ1.begin();
- iter != mGroupQ1.end(); ++iter)
+ iter != mGroupQ1.end(); ++iter)
{
LLSpatialGroup* group = *iter;
group->rebuildGeom();
@@ -2899,7 +2899,7 @@ void LLPipeline::updateGeom(F32 max_dtime)
// Iterate through all drawables on the priority build queue,
for (LLDrawable::drawable_list_t::iterator iter = mBuildQ1.begin();
- iter != mBuildQ1.end();)
+ iter != mBuildQ1.end();)
{
LLDrawable::drawable_list_t::iterator curiter = iter++;
LLDrawable* drawablep = *curiter;
@@ -2949,8 +2949,8 @@ void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera)
LLVOAvatar* av = vobj->asAvatar();
if (av &&
((!sImpostorRender && av->isImpostor()) //ignore impostor flag during impostor pass
- || av->isInMuteList()
- || (LLVOAvatar::AOA_JELLYDOLL == av->getOverallAppearance() && !av->needsImpostorUpdate()) ))
+ || av->isInMuteList()
+ || (LLVOAvatar::AOA_JELLYDOLL == av->getOverallAppearance() && !av->needsImpostorUpdate()) ))
{
return;
}
@@ -3167,13 +3167,13 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
LL_PROFILE_GPU_ZONE("stateSort");
if (hasAnyRenderType(LLPipeline::RENDER_TYPE_AVATAR,
- LLPipeline::RENDER_TYPE_CONTROL_AV,
- LLPipeline::RENDER_TYPE_TERRAIN,
- LLPipeline::RENDER_TYPE_TREE,
- LLPipeline::RENDER_TYPE_SKY,
- LLPipeline::RENDER_TYPE_VOIDWATER,
- LLPipeline::RENDER_TYPE_WATER,
- LLPipeline::END_RENDER_TYPES))
+ LLPipeline::RENDER_TYPE_CONTROL_AV,
+ LLPipeline::RENDER_TYPE_TERRAIN,
+ LLPipeline::RENDER_TYPE_TREE,
+ LLPipeline::RENDER_TYPE_SKY,
+ LLPipeline::RENDER_TYPE_VOIDWATER,
+ LLPipeline::RENDER_TYPE_WATER,
+ LLPipeline::END_RENDER_TYPES))
{
//clear faces from face pools
gPipeline.resetDrawOrders();
@@ -3271,7 +3271,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
{
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)
+ iter != sCull->endVisibleList(); ++iter)
{
LLDrawable *drawablep = *iter;
if (!drawablep->isDead())
@@ -3406,8 +3406,8 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera)
void forAllDrawables(LLCullResult::sg_iterator begin,
- LLCullResult::sg_iterator end,
- void (*func)(LLDrawable*))
+ LLCullResult::sg_iterator end,
+ void (*func)(LLDrawable*))
{
for (LLCullResult::sg_iterator i = begin; i != end; ++i)
{
@@ -3470,7 +3470,7 @@ void renderScriptedTouchBeacons(LLDrawable *drawablep)
if (gPipeline.sRenderBeacons)
{
gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f),
- LLPipeline::DebugBeaconLineWidth);
+ LLPipeline::DebugBeaconLineWidth);
}
if (gPipeline.sRenderHighlight)
@@ -3500,7 +3500,7 @@ void renderPhysicalBeacons(LLDrawable *drawablep)
if (gPipeline.sRenderBeacons)
{
gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(0.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f),
- LLPipeline::DebugBeaconLineWidth);
+ LLPipeline::DebugBeaconLineWidth);
}
if (gPipeline.sRenderHighlight)
@@ -3541,7 +3541,7 @@ void renderMOAPBeacons(LLDrawable *drawablep)
if (gPipeline.sRenderBeacons)
{
gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 1.f, 1.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f),
- LLPipeline::DebugBeaconLineWidth);
+ LLPipeline::DebugBeaconLineWidth);
}
if (gPipeline.sRenderHighlight)
@@ -3570,7 +3570,7 @@ void renderParticleBeacons(LLDrawable *drawablep)
{
LLColor4 light_blue(0.5f, 0.5f, 1.f, 0.5f);
gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", light_blue, LLColor4(1.f, 1.f, 1.f, 0.5f),
- LLPipeline::DebugBeaconLineWidth);
+ LLPipeline::DebugBeaconLineWidth);
}
if (gPipeline.sRenderHighlight)
@@ -3655,7 +3655,7 @@ void LLPipeline::postSort(LLCamera &camera)
if ((sUseOcclusion && group->isOcclusionState(LLSpatialGroup::OCCLUDED)) ||
(RenderAutoHideSurfaceAreaLimit > 0.f &&
- group->mSurfaceArea > RenderAutoHideSurfaceAreaLimit * llmax(group->mObjectBoxSize, 10.f)))
+ group->mSurfaceArea > RenderAutoHideSurfaceAreaLimit * llmax(group->mObjectBoxSize, 10.f)))
{
continue;
}
@@ -3897,7 +3897,6 @@ void render_hud_elements()
gGL.color4f(1, 1, 1, 1);
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
-
if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
{
gViewerWindow->renderSelections(false, false, false); // For HUD version in render_ui_3d()
@@ -4623,7 +4622,6 @@ void LLPipeline::renderDebug()
LLGLDisable cull(i >= 2 ? GL_CULL_FACE : 0);
gGL.flush();
-
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
//get rid of some z-fighting
@@ -5639,8 +5637,8 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)
LLDrawable* drawable = light->drawable;
const LLViewerObject *vobj = light->drawable->getVObj();
if(vobj && vobj->getAvatar()
- && (vobj->getAvatar()->isTooComplex() || vobj->getAvatar()->isInMuteList() || vobj->getAvatar()->isTooSlow())
- )
+ && (vobj->getAvatar()->isTooComplex() || vobj->getAvatar()->isInMuteList() || vobj->getAvatar()->isTooSlow())
+ )
{
drawable->clearState(LLDrawable::NEARBY_LIGHT);
continue;
@@ -5701,7 +5699,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)
// FIND NEW LIGHTS THAT ARE IN RANGE
light_set_t new_nearby_lights;
for (LLDrawable::ordered_drawable_set_t::iterator iter = mLights.begin();
- iter != mLights.end(); ++iter)
+ iter != mLights.end(); ++iter)
{
LLDrawable* drawable = *iter;
LLVOVolume* light = drawable->getVOVolume();
@@ -5739,7 +5737,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)
// INSERT ANY NEW LIGHTS
for (light_set_t::iterator iter = new_nearby_lights.begin();
- iter != new_nearby_lights.end(); iter++)
+ iter != new_nearby_lights.end(); iter++)
{
const Light* light = &(*iter);
if (LLPipeline::sRenderDeferred || mNearbyLights.size() < (U32)MAX_LOCAL_LIGHTS)
@@ -5781,7 +5779,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)
//mark nearby lights not-removable.
for (light_set_t::iterator iter = mNearbyLights.begin();
- iter != mNearbyLights.end(); iter++)
+ iter != mNearbyLights.end(); iter++)
{
const Light* light = &(*iter);
((LLViewerOctreeEntryData*) light->drawable)->setVisible();
@@ -5888,7 +5886,7 @@ void LLPipeline::setupHWLights()
if (local_light_count >= 1)
{
for (light_set_t::iterator iter = mNearbyLights.begin();
- iter != mNearbyLights.end(); ++iter)
+ iter != mNearbyLights.end(); ++iter)
{
LLDrawable* drawable = iter->drawable;
LLVOVolume* light = drawable->getVOVolume();
@@ -6732,7 +6730,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector4a& start,
!drawable->getVObj()->isAttachment() ||
delta.getLength3().getF32() > ATTACHMENT_OVERRIDE_DIST)
{ //avatar overrides if previously hit drawable is not an attachment or
- //attachment is far enough away from detected intersection
+ //attachment is far enough away from detected intersection
drawable = hit;
local_end = position;
}
@@ -6802,12 +6800,12 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector4a& start,
}
LLViewerObject* LLPipeline::lineSegmentIntersectInHUD(const LLVector4a& start, const LLVector4a& end,
- bool pick_transparent,
- S32* face_hit,
- LLVector4a* intersection, // return the intersection point
- LLVector2* tex_coord, // return the texture coordinates of the intersection point
- LLVector4a* normal, // return the surface normal at the intersection point
- LLVector4a* tangent // return the surface tangent at the intersection point
+ bool pick_transparent,
+ S32* face_hit,
+ LLVector4a* intersection, // return the intersection point
+ LLVector2* tex_coord, // return the texture coordinates of the intersection point
+ LLVector4a* normal, // return the surface normal at the intersection point
+ LLVector4a* tangent // return the surface tangent at the intersection point
)
{
LLDrawable* drawable = NULL;
@@ -7437,8 +7435,8 @@ void LLPipeline::generateGlow(LLRenderTarget* src)
gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
}
gGlowExtractProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES,
- (GLfloat)mGlow[2].getWidth(),
- (GLfloat)mGlow[2].getHeight());
+ (GLfloat)mGlow[2].getWidth(),
+ (GLfloat)mGlow[2].getHeight());
}
{
@@ -7562,90 +7560,95 @@ bool LLPipeline::applyCAS(LLRenderTarget* src, LLRenderTarget* dst)
bool LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst)
{
- llassert(!gCubeSnapshot);
- bool multisample = RenderFSAAType == 1 && gFXAAProgram[0].isComplete() && mFXAAMap.isComplete();
+ {
+ llassert(!gCubeSnapshot);
+ bool multisample = RenderFSAAType == 1 && gFXAAProgram[0].isComplete() && mFXAAMap.isComplete();
- if(!multisample) return false;
+ if(!multisample) return false;
- LL_PROFILE_GPU_ZONE("aa");
- S32 width = dst->getWidth();
- S32 height = dst->getHeight();
+ {
+ LL_PROFILE_GPU_ZONE("aa");
+ S32 width = dst->getWidth();
+ S32 height = dst->getHeight();
+ //LL_WARNS() << "dst width=" << width << LL_ENDL;
- // bake out texture2D with RGBL for FXAA shader
- mFXAAMap.bindTarget("applyFXAA", 1);
- mFXAAMap.clear(GL_COLOR_BUFFER_BIT);
+ // bake out texture2D with RGBL for FXAA shader
+ mFXAAMap.bindTarget("applyFXAA", 1);
+ mFXAAMap.clear(GL_COLOR_BUFFER_BIT);
- LLGLSLShader* shader = &gGlowCombineFXAAProgram;
- shader->bind();
+ LLGLSLShader* shader = &gGlowCombineFXAAProgram;
+ shader->bind();
- S32 channel = shader->enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage());
- if (channel > -1)
- {
- src->bindTexture(0, channel, LLTexUnit::TFO_BILINEAR);
- }
+ S32 channel = shader->enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage());
+ if (channel > -1)
+ {
+ src->bindTexture(0, channel, LLTexUnit::TFO_BILINEAR);
+ }
- {
- LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS);
- renderTriangle();
- }
+ {
+ LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS);
+ renderTriangle();
+ }
- shader->disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage());
- shader->unbind();
+ shader->disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage());
+ shader->unbind();
- mFXAAMap.flush();
+ mFXAAMap.flush();
- dst->bindTarget("applyFXAA", 1);
- dst->clear();
+ dst->bindTarget("applyFXAA", 1);
+ dst->clear();
- static LLCachedControl<U32> aa_quality(gSavedSettings, "RenderFSAASamples", 0U);
- U32 fsaa_quality = std::clamp(aa_quality(), 0U, 3U);
+ static LLCachedControl<U32> aa_quality(gSavedSettings, "RenderFSAASamples", 0U);
+ U32 fsaa_quality = std::clamp(aa_quality(), 0U, 3U);
- shader = &gFXAAProgram[fsaa_quality];
- shader->bind();
+ shader = &gFXAAProgram[fsaa_quality];
+ shader->bind();
- channel = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP, mFXAAMap.getUsage());
- if (channel > -1)
- {
- mFXAAMap.bindTexture(0, channel, LLTexUnit::TFO_BILINEAR);
- }
+ channel = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP, mFXAAMap.getUsage());
+ if (channel > -1)
+ {
+ mFXAAMap.bindTexture(0, channel, LLTexUnit::TFO_BILINEAR);
+ }
- /*
- gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
- gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
- gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
- gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
+/*
+ gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
+ gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
+ gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
+ gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
- glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
+ glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
*/
- F32 scale_x = (F32)width / mFXAAMap.getWidth();
- F32 scale_y = (F32)height / mFXAAMap.getHeight();
+ F32 scale_x = (F32)width / mFXAAMap.getWidth();
+ F32 scale_y = (F32)height / mFXAAMap.getHeight();
- //LL_WARNS() << "vp width=" << gGLViewport[2] << " scale=" << scale_x << LL_ENDL;
+ //LL_WARNS() << "vp width=" << gGLViewport[2] << " scale=" << scale_x << LL_ENDL;
- shader->uniform2f(LLShaderMgr::FXAA_TC_SCALE, scale_x, scale_y);
- shader->uniform2f(LLShaderMgr::FXAA_RCP_SCREEN_RES, 1.f / width * scale_x, 1.f / height * scale_y);
- shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT, -0.5f / width * scale_x, -0.5f / height * scale_y,
- 0.5f / width * scale_x, 0.5f / height * scale_y);
- shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT2, -2.f / width * scale_x, -2.f / height * scale_y,
- 2.f / width * scale_x, 2.f / height * scale_y);
+ shader->uniform2f(LLShaderMgr::FXAA_TC_SCALE, scale_x, scale_y);
+ shader->uniform2f(LLShaderMgr::FXAA_RCP_SCREEN_RES, 1.f / width * scale_x, 1.f / height * scale_y);
+ shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT, -0.5f / width * scale_x, -0.5f / height * scale_y,
+ 0.5f / width * scale_x, 0.5f / height * scale_y);
+ shader->uniform4f(LLShaderMgr::FXAA_RCP_FRAME_OPT2, -2.f / width * scale_x, -2.f / height * scale_y,
+ 2.f / width * scale_x, 2.f / height * scale_y);
- {
- LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS);
- S32 depth_channel = shader->getTextureChannel(LLShaderMgr::DEFERRED_DEPTH);
- gGL.getTexUnit(depth_channel)->bind(&mRT->deferredScreen, true);
+ {
+ LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS);
+ S32 depth_channel = shader->getTextureChannel(LLShaderMgr::DEFERRED_DEPTH);
+ gGL.getTexUnit(depth_channel)->bind(&mRT->deferredScreen, true);
- renderTriangle();
- }
+ renderTriangle();
+ }
- if (channel > -1)
- {
- shader->unbindTexture(channel);
- }
+ if (channel > -1)
+ {
+ shader->unbindTexture(channel);
+ }
- shader->unbind();
- dst->flush();
+ shader->unbind();
+ dst->flush();
+ }
+ }
return true;
}
@@ -7763,10 +7766,8 @@ void LLPipeline::generateSMAABuffers(LLRenderTarget* src)
//{
// glStencilFunc(GL_ALWAYS, 0, 0xFF);
//}
-
blend_weights_shader.unbind();
dest.flush();
-
gGL.getTexUnit(edge_tex_channel)->unbindFast(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(area_tex_channel)->unbindFast(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(search_tex_channel)->unbindFast(LLTexUnit::TT_TEXTURE);
@@ -7788,55 +7789,57 @@ bool LLPipeline::applySMAA(LLRenderTarget* src, LLRenderTarget* dst)
if(!multisample) return false;
- LL_PROFILE_GPU_ZONE("aa");
-
+ {
+ LL_PROFILE_GPU_ZONE("aa");
+ generateSMAABuffers(src);
- static LLCachedControl<U32> aa_quality(gSavedSettings, "RenderFSAASamples", 0U);
- U32 fsaa_quality = std::clamp(aa_quality(), 0U, 3U);
+ static LLCachedControl<U32> aa_quality(gSavedSettings, "RenderFSAASamples", 0U);
+ U32 fsaa_quality = std::clamp(aa_quality(), 0U, 3U);
- S32 width = src->getWidth();
- S32 height = src->getHeight();
+ S32 width = src->getWidth();
+ S32 height = src->getHeight();
- float rt_metrics[] = { 1.f / width, 1.f / height, (float)width, (float)height };
+ float rt_metrics[] = { 1.f / width, 1.f / height, (float)width, (float)height };
- LLGLDepthTest depth(GL_FALSE, GL_FALSE);
+ LLGLDepthTest depth(GL_FALSE, GL_FALSE);
- static LLCachedControl<bool> use_sample(gSavedSettings, "RenderSMAAUseSample", false);
- //static LLCachedControl<bool> use_stencil(gSavedSettings, "RenderSMAAUseStencil", true);
+ static LLCachedControl<bool> use_sample(gSavedSettings, "RenderSMAAUseSample", false);
+ //static LLCachedControl<bool> use_stencil(gSavedSettings, "RenderSMAAUseStencil", true);
- {
- //LLGLDisable stencil(GL_STENCIL_TEST);
+ {
+ //LLGLDisable stencil(GL_STENCIL_TEST);
- // Bind setup:
- LLRenderTarget* bound_target = dst;
- LLGLSLShader& blend_shader = gSMAANeighborhoodBlendProgram[fsaa_quality];
+ // Bind setup:
+ LLRenderTarget* bound_target = dst;
+ LLGLSLShader& blend_shader = gSMAANeighborhoodBlendProgram[fsaa_quality];
- bound_target->bindTarget("applySMAA", 1);
- bound_target->clear(GL_COLOR_BUFFER_BIT);
+ bound_target->bindTarget("applySMAA", 1);
+ bound_target->clear(GL_COLOR_BUFFER_BIT);
- blend_shader.bind();
- blend_shader.uniform4fv(sSmaaRTMetrics, 1, rt_metrics);
+ blend_shader.bind();
+ blend_shader.uniform4fv(sSmaaRTMetrics, 1, rt_metrics);
- S32 diffuse_channel = blend_shader.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE);
- if(diffuse_channel > -1)
- {
- src->bindTexture(0, diffuse_channel, LLTexUnit::TFO_BILINEAR);
- gGL.getTexUnit(diffuse_channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
- }
+ S32 diffuse_channel = blend_shader.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE);
+ if(diffuse_channel > -1)
+ {
+ src->bindTexture(0, diffuse_channel, LLTexUnit::TFO_BILINEAR);
+ gGL.getTexUnit(diffuse_channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
+ }
- S32 blend_channel = blend_shader.enableTexture(LLShaderMgr::SMAA_BLEND_TEX);
- if (blend_channel > -1)
- {
- mSMAABlendBuffer.bindTexture(0, blend_channel, LLTexUnit::TFO_BILINEAR);
- }
+ S32 blend_channel = blend_shader.enableTexture(LLShaderMgr::SMAA_BLEND_TEX);
+ if (blend_channel > -1)
+ {
+ mSMAABlendBuffer.bindTexture(0, blend_channel, LLTexUnit::TFO_BILINEAR);
+ }
- renderTriangle();
+ renderTriangle();
- bound_target->flush();
- blend_shader.unbind();
- gGL.getTexUnit(diffuse_channel)->unbindFast(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(blend_channel)->unbindFast(LLTexUnit::TT_TEXTURE);
+ bound_target->flush();
+ blend_shader.unbind();
+ gGL.getTexUnit(diffuse_channel)->unbindFast(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(blend_channel)->unbindFast(LLTexUnit::TT_TEXTURE);
+ }
}
LOG_GLERROR("LLPipeline::applySMAA()");
@@ -7845,6 +7848,7 @@ bool LLPipeline::applySMAA(LLRenderTarget* src, LLRenderTarget* dst)
void LLPipeline::copyRenderTarget(LLRenderTarget* src, LLRenderTarget* dst)
{
+
LL_PROFILE_GPU_ZONE("copyRenderTarget");
dst->bindTarget("copyRenderTarget", 1);
dst->clear(GL_COLOR_BUFFER_BIT);
@@ -7867,6 +7871,7 @@ void LLPipeline::combineGlow(LLRenderTarget* src, LLRenderTarget* dst)
dst->bindTarget("combineGlow", 1);
{
+
gGlowCombineProgram.bind();
gGlowCombineProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src);
@@ -7881,188 +7886,190 @@ void LLPipeline::combineGlow(LLRenderTarget* src, LLRenderTarget* dst)
bool LLPipeline::renderDoF(LLRenderTarget* src, LLRenderTarget* dst)
{
- bool dof_enabled =
+ {
+ bool dof_enabled =
(RenderDepthOfFieldInEditMode || !LLToolMgr::getInstance()->inBuildMode()) &&
RenderDepthOfField &&
!gCubeSnapshot;
if(!dof_enabled) return false;
- gViewerWindow->setup3DViewport();
+ gViewerWindow->setup3DViewport();
- if (dof_enabled)
- {
- LL_PROFILE_GPU_ZONE("dof");
- LLGLDisable blend(GL_BLEND);
+ if (dof_enabled)
+ {
+ LL_PROFILE_GPU_ZONE("dof");
+ LLGLDisable blend(GL_BLEND);
- // depth of field focal plane calculations
- static F32 current_distance = 16.f;
- static F32 start_distance = 16.f;
- static F32 transition_time = 1.f;
+ // depth of field focal plane calculations
+ static F32 current_distance = 16.f;
+ static F32 start_distance = 16.f;
+ static F32 transition_time = 1.f;
- LLVector3 focus_point;
+ LLVector3 focus_point;
- LLViewerObject* obj = LLViewerMediaFocus::getInstance()->getFocusedObject();
- if (obj && obj->mDrawable && obj->isSelected())
- { // focus on selected media object
- S32 face_idx = LLViewerMediaFocus::getInstance()->getFocusedFace();
- if (obj && obj->mDrawable)
- {
- LLFace* face = obj->mDrawable->getFace(face_idx);
- if (face)
+ LLViewerObject* obj = LLViewerMediaFocus::getInstance()->getFocusedObject();
+ if (obj && obj->mDrawable && obj->isSelected())
+ { // focus on selected media object
+ S32 face_idx = LLViewerMediaFocus::getInstance()->getFocusedFace();
+ if (obj && obj->mDrawable)
{
- focus_point = face->getPositionAgent();
+ LLFace* face = obj->mDrawable->getFace(face_idx);
+ if (face)
+ {
+ focus_point = face->getPositionAgent();
+ }
}
}
- }
- if (focus_point.isExactlyZero())
- {
- if (LLViewerJoystick::getInstance()->getOverrideCamera())
- { // focus on point under cursor
- focus_point.set(gDebugRaycastIntersection.getF32ptr());
- }
- else if (gAgentCamera.cameraMouselook())
- { // focus on point under mouselook crosshairs
- LLVector4a result;
- result.clear();
+ if (focus_point.isExactlyZero())
+ {
+ if (LLViewerJoystick::getInstance()->getOverrideCamera())
+ { // focus on point under cursor
+ focus_point.set(gDebugRaycastIntersection.getF32ptr());
+ }
+ else if (gAgentCamera.cameraMouselook())
+ { // focus on point under mouselook crosshairs
+ LLVector4a result;
+ result.clear();
- gViewerWindow->cursorIntersect(-1, -1, 512.f, nullptr, -1, false, false, true, true, nullptr, nullptr, nullptr, &result);
+ gViewerWindow->cursorIntersect(-1, -1, 512.f, nullptr, -1, false, false, true, true, nullptr, nullptr, nullptr, &result);
- focus_point.set(result.getF32ptr());
- }
- else
- {
- // focus on alt-zoom target
- LLViewerRegion* region = gAgent.getRegion();
- if (region)
+ focus_point.set(result.getF32ptr());
+ }
+ else
{
- focus_point = LLVector3(gAgentCamera.getFocusGlobal() - region->getOriginGlobal());
+ // focus on alt-zoom target
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region)
+ {
+ focus_point = LLVector3(gAgentCamera.getFocusGlobal() - region->getOriginGlobal());
+ }
}
}
- }
- LLVector3 eye = LLViewerCamera::getInstance()->getOrigin();
- F32 target_distance = 16.f;
- if (!focus_point.isExactlyZero())
- {
- target_distance = LLViewerCamera::getInstance()->getAtAxis() * (focus_point - eye);
- }
+ LLVector3 eye = LLViewerCamera::getInstance()->getOrigin();
+ F32 target_distance = 16.f;
+ if (!focus_point.isExactlyZero())
+ {
+ target_distance = LLViewerCamera::getInstance()->getAtAxis() * (focus_point - eye);
+ }
- if (transition_time >= 1.f && fabsf(current_distance - target_distance) / current_distance > 0.01f)
- { // large shift happened, interpolate smoothly to new target distance
- transition_time = 0.f;
- start_distance = current_distance;
- }
- else if (transition_time < 1.f)
- { // currently in a transition, continue interpolating
- transition_time += 1.f / CameraFocusTransitionTime * gFrameIntervalSeconds.value();
- transition_time = llmin(transition_time, 1.f);
+ if (transition_time >= 1.f && fabsf(current_distance - target_distance) / current_distance > 0.01f)
+ { // large shift happened, interpolate smoothly to new target distance
+ transition_time = 0.f;
+ start_distance = current_distance;
+ }
+ else if (transition_time < 1.f)
+ { // currently in a transition, continue interpolating
+ transition_time += 1.f / CameraFocusTransitionTime * gFrameIntervalSeconds.value();
+ transition_time = llmin(transition_time, 1.f);
- F32 t = cosf(transition_time * F_PI + F_PI) * 0.5f + 0.5f;
- current_distance = start_distance + (target_distance - start_distance) * t;
- }
- else
- { // small or no change, just snap to target distance
- current_distance = target_distance;
- }
+ F32 t = cosf(transition_time * F_PI + F_PI) * 0.5f + 0.5f;
+ current_distance = start_distance + (target_distance - start_distance) * t;
+ }
+ else
+ { // small or no change, just snap to target distance
+ current_distance = target_distance;
+ }
- // convert to mm
- F32 subject_distance = current_distance * 1000.f;
- F32 fnumber = CameraFNumber;
- F32 default_focal_length = CameraFocalLength;
+ // convert to mm
+ F32 subject_distance = current_distance * 1000.f;
+ F32 fnumber = CameraFNumber;
+ F32 default_focal_length = CameraFocalLength;
- F32 fov = LLViewerCamera::getInstance()->getView();
+ F32 fov = LLViewerCamera::getInstance()->getView();
- const F32 default_fov = CameraFieldOfView * F_PI / 180.f;
+ const F32 default_fov = CameraFieldOfView * F_PI / 180.f;
- // F32 aspect_ratio = (F32) mRT->screen.getWidth()/(F32)mRT->screen.getHeight();
+ // F32 aspect_ratio = (F32) mRT->screen.getWidth()/(F32)mRT->screen.getHeight();
- F32 dv = 2.f * default_focal_length * tanf(default_fov / 2.f);
+ F32 dv = 2.f * default_focal_length * tanf(default_fov / 2.f);
- F32 focal_length = dv / (2 * tanf(fov / 2.f));
+ F32 focal_length = dv / (2 * tanf(fov / 2.f));
- // F32 tan_pixel_angle = tanf(LLDrawable::sCurPixelAngle);
+ // F32 tan_pixel_angle = tanf(LLDrawable::sCurPixelAngle);
- // from wikipedia -- c = |s2-s1|/s2 * f^2/(N(S1-f))
- // where N = fnumber
- // s2 = dot distance
- // s1 = subject distance
- // f = focal length
- //
+ // from wikipedia -- c = |s2-s1|/s2 * f^2/(N(S1-f))
+ // where N = fnumber
+ // s2 = dot distance
+ // s1 = subject distance
+ // f = focal length
+ //
- F32 blur_constant = focal_length * focal_length / (fnumber * (subject_distance - focal_length));
- blur_constant /= 1000.f; // convert to meters for shader
- F32 magnification = focal_length / (subject_distance - focal_length);
+ F32 blur_constant = focal_length * focal_length / (fnumber * (subject_distance - focal_length));
+ blur_constant /= 1000.f; // convert to meters for shader
+ F32 magnification = focal_length / (subject_distance - focal_length);
- { // build diffuse+bloom+CoF
- mRT->deferredLight.bindTarget("renderDOF", 1);
+ { // build diffuse+bloom+CoF
+ mRT->deferredLight.bindTarget("renderDOF", 1);
- gDeferredCoFProgram.bind();
+ gDeferredCoFProgram.bind();
- gDeferredCoFProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, LLTexUnit::TFO_POINT);
- gDeferredCoFProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true);
+ gDeferredCoFProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, LLTexUnit::TFO_POINT);
+ gDeferredCoFProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true);
- gDeferredCoFProgram.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff);
- gDeferredCoFProgram.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff);
- gDeferredCoFProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)dst->getWidth(), (GLfloat)dst->getHeight());
- gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_FOCAL_DISTANCE, -subject_distance / 1000.f);
- gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_BLUR_CONSTANT, blur_constant);
- gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_TAN_PIXEL_ANGLE, tanf(1.f / LLDrawable::sCurPixelAngle));
- gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_MAGNIFICATION, magnification);
- gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
- gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
+ gDeferredCoFProgram.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff);
+ gDeferredCoFProgram.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff);
+ gDeferredCoFProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)dst->getWidth(), (GLfloat)dst->getHeight());
+ gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_FOCAL_DISTANCE, -subject_distance / 1000.f);
+ gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_BLUR_CONSTANT, blur_constant);
+ gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_TAN_PIXEL_ANGLE, tanf(1.f / LLDrawable::sCurPixelAngle));
+ gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_MAGNIFICATION, magnification);
+ gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
+ gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
- renderTriangle();
+ renderTriangle();
- gDeferredCoFProgram.unbind();
- mRT->deferredLight.flush();
- }
+ gDeferredCoFProgram.unbind();
+ mRT->deferredLight.flush();
+ }
- U32 dof_width = (U32)(mRT->screen.getWidth() * CameraDoFResScale);
- U32 dof_height = (U32)(mRT->screen.getHeight() * CameraDoFResScale);
+ U32 dof_width = (U32)(mRT->screen.getWidth() * CameraDoFResScale);
+ U32 dof_height = (U32)(mRT->screen.getHeight() * CameraDoFResScale);
- { // perform DoF sampling at half-res (preserve alpha channel)
- src->bindTarget("DoF sampling", 1);
- glViewport(0, 0, dof_width, dof_height);
+ { // perform DoF sampling at half-res (preserve alpha channel)
+ src->bindTarget("DoF sampling", 1);
+ glViewport(0, 0, dof_width, dof_height);
- gGL.setColorMask(true, false);
+ gGL.setColorMask(true, false);
- gDeferredPostProgram.bind();
- gDeferredPostProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, &mRT->deferredLight, LLTexUnit::TFO_POINT);
+ gDeferredPostProgram.bind();
+ gDeferredPostProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, &mRT->deferredLight, LLTexUnit::TFO_POINT);
- gDeferredPostProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)dst->getWidth(), (GLfloat)dst->getHeight());
- gDeferredPostProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
- gDeferredPostProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
+ gDeferredPostProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)dst->getWidth(), (GLfloat)dst->getHeight());
+ gDeferredPostProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
+ gDeferredPostProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
- renderTriangle();
+ renderTriangle();
- gDeferredPostProgram.unbind();
+ gDeferredPostProgram.unbind();
- src->flush();
- gGL.setColorMask(true, true);
- }
+ src->flush();
+ gGL.setColorMask(true, true);
+ }
- { // combine result based on alpha
+ { // combine result based on alpha
- dst->bindTarget("DoF combine", 1);
- glViewport(0, 0, dst->getWidth(), dst->getHeight());
+ dst->bindTarget("DoF combine", 1);
+ glViewport(0, 0, dst->getWidth(), dst->getHeight());
- gDeferredDoFCombineProgram.bind();
- gDeferredDoFCombineProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, LLTexUnit::TFO_POINT);
- gDeferredDoFCombineProgram.bindTexture(LLShaderMgr::DEFERRED_LIGHT, &mRT->deferredLight, LLTexUnit::TFO_POINT);
+ gDeferredDoFCombineProgram.bind();
+ gDeferredDoFCombineProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, LLTexUnit::TFO_POINT);
+ gDeferredDoFCombineProgram.bindTexture(LLShaderMgr::DEFERRED_LIGHT, &mRT->deferredLight, LLTexUnit::TFO_POINT);
- gDeferredDoFCombineProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)dst->getWidth(), (GLfloat)dst->getHeight());
- gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
- gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
- gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_WIDTH, (dof_width - 1) / (F32)src->getWidth());
- gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_HEIGHT, (dof_height - 1) / (F32)src->getHeight());
+ gDeferredDoFCombineProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)dst->getWidth(), (GLfloat)dst->getHeight());
+ gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
+ gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
+ gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_WIDTH, (dof_width - 1) / (F32)src->getWidth());
+ gDeferredDoFCombineProgram.uniform1f(LLShaderMgr::DOF_HEIGHT, (dof_height - 1) / (F32)src->getHeight());
- renderTriangle();
+ renderTriangle();
- gDeferredDoFCombineProgram.unbind();
- dst->flush();
+ gDeferredDoFCombineProgram.unbind();
+ dst->flush();
+ }
}
}
@@ -8376,8 +8383,8 @@ void LLPipeline::renderFinalize()
/*if (LLRenderTarget::sUseFBO && !gCubeSnapshot)
{ // copy depth buffer from mRT->screen to framebuffer
LLRenderTarget::copyContentsToFramebuffer(mRT->screen, 0, 0, mRT->screen.getWidth(), mRT->screen.getHeight(), 0, 0,
- mRT->screen.getWidth(), mRT->screen.getHeight(),
- GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_NEAREST);
+ mRT->screen.getWidth(), mRT->screen.getHeight(),
+ GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_NEAREST);
}*/
LLVertexBuffer::unbind();
@@ -8583,8 +8590,8 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
F32* m = gGLModelView;
F32 mat[] = { m[0], m[1], m[2],
- m[4], m[5], m[6],
- m[8], m[9], m[10] };
+ m[4], m[5], m[6],
+ m[8], m[9], m[10] };
shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, true, mat);
}
@@ -8778,8 +8785,8 @@ void LLPipeline::renderDeferredLighting()
glClearColor(0, 0, 0, 0);
sun_shader.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES,
- (GLfloat)deferred_light_target->getWidth(),
- (GLfloat)deferred_light_target->getHeight());
+ (GLfloat)deferred_light_target->getWidth(),
+ (GLfloat)deferred_light_target->getHeight());
{
LLGLDisable blend(GL_BLEND);
@@ -8858,8 +8865,7 @@ void LLPipeline::renderDeferredLighting()
screen_target->clear(GL_COLOR_BUFFER_BIT);
if (RenderDeferredAtmospheric)
- {
- // apply sunlight contribution
+ { // apply sunlight contribution
LLGLSLShader &soften_shader = gDeferredSoftenProgram;
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("renderDeferredLighting - atmospherics");
@@ -9156,35 +9162,35 @@ void LLPipeline::renderDeferredLighting()
pushRenderTypeMask();
andRenderTypeMask(LLPipeline::RENDER_TYPE_ALPHA,
- LLPipeline::RENDER_TYPE_ALPHA_PRE_WATER,
- LLPipeline::RENDER_TYPE_ALPHA_POST_WATER,
- LLPipeline::RENDER_TYPE_FULLBRIGHT,
- LLPipeline::RENDER_TYPE_VOLUME,
- LLPipeline::RENDER_TYPE_GLOW,
- LLPipeline::RENDER_TYPE_BUMP,
- LLPipeline::RENDER_TYPE_GLTF_PBR,
- 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_GLTF_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_TERRAIN,
- LLPipeline::RENDER_TYPE_WATER,
- LLPipeline::RENDER_TYPE_WATEREXCLUSION,
- END_RENDER_TYPES);
+ LLPipeline::RENDER_TYPE_ALPHA_PRE_WATER,
+ LLPipeline::RENDER_TYPE_ALPHA_POST_WATER,
+ LLPipeline::RENDER_TYPE_FULLBRIGHT,
+ LLPipeline::RENDER_TYPE_VOLUME,
+ LLPipeline::RENDER_TYPE_GLOW,
+ LLPipeline::RENDER_TYPE_BUMP,
+ LLPipeline::RENDER_TYPE_GLTF_PBR,
+ 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_GLTF_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_TERRAIN,
+ LLPipeline::RENDER_TYPE_WATER,
+ LLPipeline::RENDER_TYPE_WATEREXCLUSION,
+ END_RENDER_TYPES);
renderGeomPostDeferred(*LLViewerCamera::getInstance());
popRenderTypeMask();
@@ -9292,7 +9298,6 @@ void LLPipeline::doWaterHaze()
LLRenderTarget& dst = gPipeline.mWaterDis;
mRT->screen.flush();
-
dst.bindTarget("water haze copy depth", 1);
gCopyDepthProgram.bind();
@@ -9351,6 +9356,7 @@ void LLPipeline::doWaterHaze()
unbindDeferredShader(haze_shader);
+
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
@@ -9593,7 +9599,6 @@ void LLPipeline::bindReflectionProbes(LLGLSLShader& shader)
S32 channel = shader.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY);
bool bound = false;
-
if (channel > -1 && mReflectionMapManager.mTexture.notNull())
{
mReflectionMapManager.mTexture->bind(channel);
@@ -9631,32 +9636,34 @@ void LLPipeline::bindReflectionProbes(LLGLSLShader& shader)
//{
//LL_WARNS() << "binding SSR to reflection maps" << LL_ENDL;
- channel = shader.enableTexture(LLShaderMgr::SCENE_MAP);
- if (channel > -1)
- {
- gGL.getTexUnit(channel)->bind(&mSceneMap);
- }
+ channel = shader.enableTexture(LLShaderMgr::SCENE_MAP);
+ if (channel > -1)
+ {
+ gGL.getTexUnit(channel)->bind(&mSceneMap);
+ }
- shader.uniform1f(LLShaderMgr::DEFERRED_SSR_ITR_COUNT, (GLfloat)RenderScreenSpaceReflectionIterations);
- shader.uniform1f(LLShaderMgr::DEFERRED_SSR_DIST_BIAS, RenderScreenSpaceReflectionDistanceBias);
- shader.uniform1f(LLShaderMgr::DEFERRED_SSR_RAY_STEP, RenderScreenSpaceReflectionRayStep);
- shader.uniform1f(LLShaderMgr::DEFERRED_SSR_GLOSSY_SAMPLES, (GLfloat)RenderScreenSpaceReflectionGlossySamples);
- shader.uniform1f(LLShaderMgr::DEFERRED_SSR_REJECT_BIAS, RenderScreenSpaceReflectionDepthRejectBias);
- mPoissonOffset++;
- if (mPoissonOffset > 128 - RenderScreenSpaceReflectionGlossySamples)
- mPoissonOffset = 0;
+ shader.uniform1f(LLShaderMgr::DEFERRED_SSR_ITR_COUNT, (GLfloat)RenderScreenSpaceReflectionIterations);
+ shader.uniform1f(LLShaderMgr::DEFERRED_SSR_DIST_BIAS, RenderScreenSpaceReflectionDistanceBias);
+ shader.uniform1f(LLShaderMgr::DEFERRED_SSR_RAY_STEP, RenderScreenSpaceReflectionRayStep);
+ shader.uniform1f(LLShaderMgr::DEFERRED_SSR_GLOSSY_SAMPLES, (GLfloat)RenderScreenSpaceReflectionGlossySamples);
+ shader.uniform1f(LLShaderMgr::DEFERRED_SSR_REJECT_BIAS, RenderScreenSpaceReflectionDepthRejectBias);
+ mPoissonOffset++;
- shader.uniform1f(LLShaderMgr::DEFERRED_SSR_NOISE_SINE, (GLfloat)mPoissonOffset);
- shader.uniform1f(LLShaderMgr::DEFERRED_SSR_ADAPTIVE_STEP_MULT, RenderScreenSpaceReflectionAdaptiveStepMultiplier);
+ if (mPoissonOffset > 128 - RenderScreenSpaceReflectionGlossySamples)
+ mPoissonOffset = 0;
- channel = shader.enableTexture(LLShaderMgr::SCENE_DEPTH);
- if (channel > -1)
- {
- gGL.getTexUnit(channel)->bind(&mSceneMap, true);
- }
+ shader.uniform1f(LLShaderMgr::DEFERRED_SSR_NOISE_SINE, (GLfloat)mPoissonOffset);
+ shader.uniform1f(LLShaderMgr::DEFERRED_SSR_ADAPTIVE_STEP_MULT, RenderScreenSpaceReflectionAdaptiveStepMultiplier);
+
+ channel = shader.enableTexture(LLShaderMgr::SCENE_DEPTH);
+ if (channel > -1)
+ {
+ gGL.getTexUnit(channel)->bind(&mSceneMap, true);
+ }
//}
+
LOG_GLERROR("bindReflectionProbes() end");
}
@@ -9798,6 +9805,7 @@ void LLPipeline::renderShadow(const glm::mat4& view, const glm::mat4& proj, LLCa
}
};
+
LLVertexBuffer::unbind();
for (int j = 0; j < 2; ++j) // 0 -- static, 1 -- rigged
{
@@ -10396,6 +10404,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
LLVector3 split_exp = RenderShadowSplitExponent;
F32 da = 1.f-llmax( fabsf(lightDir*up), fabsf(lightDir*camera.getLeftAxis()) );
da = powf(da, split_exp.mV[2]);
+
F32 sxp = split_exp.mV[1] + (split_exp.mV[0]-split_exp.mV[1])*da;
for (U32 i = 0; i < splits; ++i)
@@ -11113,12 +11122,12 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool
// previews can't be muted or impostered
bool visually_muted = !for_profile && !preview_avatar && avatar->isVisuallyMuted();
LL_DEBUGS_ONCE("AvatarRenderPipeline") << "Avatar " << avatar->getID()
- << " is " << ( visually_muted ? "" : "not ") << "visually muted"
- << LL_ENDL;
+ << " is " << ( visually_muted ? "" : "not ") << "visually muted"
+ << LL_ENDL;
bool too_complex = !for_profile && !preview_avatar && avatar->isTooComplex();
LL_DEBUGS_ONCE("AvatarRenderPipeline") << "Avatar " << avatar->getID()
- << " is " << ( too_complex ? "" : "not ") << "too complex"
- << LL_ENDL;
+ << " is " << ( too_complex ? "" : "not ") << "too complex"
+ << LL_ENDL;
pushRenderTypeMask();
@@ -11148,7 +11157,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool
RENDER_TYPE_CLOUDS,
RENDER_TYPE_HUD_PARTICLES,
END_RENDER_TYPES
- );
+ );
}
if (specific_attachment && specific_attachment->isHUDAttachment())
@@ -11740,7 +11749,7 @@ void LLPipeline::hideDrawable( LLDrawable *pDrawable )
//hide the children
LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren();
for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++ )
+ iter != child_list.end(); iter++ )
{
LLViewerObject* child = *iter;
LLDrawable* drawable = child->mDrawable;
@@ -11758,7 +11767,7 @@ void LLPipeline::unhideDrawable( LLDrawable *pDrawable )
//restore children
LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren();
for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
- iter != child_list.end(); iter++)
+ iter != child_list.end(); iter++)
{
LLViewerObject* child = *iter;
LLDrawable* drawable = child->mDrawable;