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.cpp217
1 files changed, 53 insertions, 164 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 325d01ff1b..388dee00db 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -55,7 +55,6 @@
#include "lldrawable.h"
#include "lldrawpoolalpha.h"
#include "lldrawpoolavatar.h"
-#include "lldrawpoolground.h"
#include "lldrawpoolbump.h"
#include "lldrawpooltree.h"
#include "lldrawpoolwater.h"
@@ -86,7 +85,6 @@
#include "llviewerwindow.h" // For getSpinAxis
#include "llvoavatarself.h"
#include "llvocache.h"
-#include "llvoground.h"
#include "llvosky.h"
#include "llvowlsky.h"
#include "llvotree.h"
@@ -430,7 +428,6 @@ void LLPipeline::init()
getPool(LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK);
getPool(LLDrawPool::POOL_GRASS);
getPool(LLDrawPool::POOL_FULLBRIGHT);
- getPool(LLDrawPool::POOL_INVISIBLE);
getPool(LLDrawPool::POOL_BUMP);
getPool(LLDrawPool::POOL_MATERIALS);
getPool(LLDrawPool::POOL_GLOW);
@@ -459,12 +456,6 @@ void LLPipeline::init()
else
{
setAllRenderTypes(); // By default, all rendering types start enabled
- // Don't turn on ground when this is set
- // Mac Books with intel 950s need this
- if(!gSavedSettings.getBOOL("RenderGround"))
- {
- toggleRenderType(RENDER_TYPE_GROUND);
- }
}
// make sure RenderPerformanceTest persists (hackity hack hack)
@@ -649,14 +640,10 @@ void LLPipeline::cleanup()
mTerrainPool = NULL;
delete mWaterPool;
mWaterPool = NULL;
- delete mGroundPool;
- mGroundPool = NULL;
delete mSimplePool;
mSimplePool = NULL;
delete mFullbrightPool;
mFullbrightPool = NULL;
- delete mInvisiblePool;
- mInvisiblePool = NULL;
delete mGlowPool;
mGlowPool = NULL;
delete mBumpPool;
@@ -832,6 +819,11 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
resY /= res_mod;
}
+ if (LLPipeline::sRenderTransparentWater)
+ { //water reflection texture
+ mWaterDis.allocate(resX, resY, GL_RGBA, true);
+ }
+
if (RenderUIBuffer)
{
if (!mRT->uiScreen.allocate(resX,resY, GL_RGBA))
@@ -1112,7 +1104,6 @@ void LLPipeline::releaseGLBuffers()
releaseLUTBuffers();
- mWaterRef.release();
mWaterDis.release();
mBake.release();
@@ -1186,12 +1177,6 @@ void LLPipeline::createGLBuffers()
stop_glerror();
assertInitialized();
- if (LLPipeline::sRenderTransparentWater)
- { //water reflection texture
- U32 res = (U32) llmax(gSavedSettings.getS32("RenderWaterRefResolution"), 512);
- mWaterDis.allocate(res,res,GL_RGBA,true);
- }
-
// Use FBO for bake tex
mBake.allocate(512, 512, GL_RGBA, true); // SL-12781 Build > Upload > Model; 3D Preview
@@ -1356,14 +1341,12 @@ bool LLPipeline::shadersLoaded()
bool LLPipeline::canUseWindLightShaders() const
{
- return (gWLSkyProgram.mProgramObject != 0 &&
- LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_WINDLIGHT) > 1);
+ return true;
}
bool LLPipeline::canUseWindLightShadersOnObjects() const
{
- return (canUseWindLightShaders()
- && LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0);
+ return true;
}
bool LLPipeline::canUseAntiAliasing() const
@@ -1518,10 +1501,6 @@ LLDrawPool *LLPipeline::findPool(const U32 type, LLViewerTexture *tex0)
poolp = mFullbrightPool;
break;
- case LLDrawPool::POOL_INVISIBLE:
- poolp = mInvisiblePool;
- break;
-
case LLDrawPool::POOL_GLOW:
poolp = mGlowPool;
break;
@@ -1559,10 +1538,6 @@ LLDrawPool *LLPipeline::findPool(const U32 type, LLViewerTexture *tex0)
poolp = mWaterPool;
break;
- case LLDrawPool::POOL_GROUND:
- poolp = mGroundPool;
- break;
-
case LLDrawPool::POOL_WL_SKY:
poolp = mWLSkyPool;
break;
@@ -2297,7 +2272,6 @@ bool LLPipeline::getVisibleExtents(LLCamera& camera, LLVector3& min, LLVector3&
}
LLViewerCamera::sCurCameraID = saved_camera_id;
-
return res;
}
@@ -2452,64 +2426,6 @@ void LLPipeline::markOccluder(LLSpatialGroup* group)
}
}
-void LLPipeline::downsampleDepthBuffer(LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space)
-{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
- LL_PROFILE_GPU_ZONE("downsampleDepthBuffer");
-
- LLGLSLShader* last_shader = LLGLSLShader::sCurBoundShaderPtr;
-
- LLGLSLShader* shader = NULL;
-
- if (scratch_space)
- {
-#if 0 // TODO -- restore occlusion culling functionality
- GLint bits = 0;
- bits = GL_DEPTH_BUFFER_BIT;
- scratch_space->copyContents(source,
- 0, 0, source.getWidth(), source.getHeight(),
- 0, 0, scratch_space->getWidth(), scratch_space->getHeight(), bits, GL_NEAREST);
-#endif
- }
-
- dest.bindTarget();
- dest.clear(GL_DEPTH_BUFFER_BIT);
-
- if (source.getUsage() == LLTexUnit::TT_TEXTURE)
- {
- shader = &gDownsampleDepthRectProgram;
- shader->bind();
- shader->uniform2f(sDelta, 1.f, 1.f);
- shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, source.getWidth(), source.getHeight());
- }
- else
- {
- shader = &gDownsampleDepthProgram;
- shader->bind();
- shader->uniform2f(sDelta, 1.f/source.getWidth(), 1.f/source.getHeight());
- shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, 1.f, 1.f);
- }
-
- gGL.getTexUnit(0)->bind(scratch_space ? scratch_space : &source, TRUE);
-
- {
- LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
- mScreenTriangleVB->setBuffer();
- mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
- }
-
- dest.flush();
-
- if (last_shader)
- {
- last_shader->bind();
- }
- else
- {
- shader->unbind();
- }
-}
-
void LLPipeline::doOcclusion(LLCamera& camera)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
@@ -2521,14 +2437,8 @@ void LLPipeline::doOcclusion(LLCamera& camera)
{
LLVertexBuffer::unbind();
- if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION))
- {
- gGL.setColorMask(true, false, false, false);
- }
- else
- {
- gGL.setColorMask(false, false);
- }
+ gGL.setColorMask(false, false);
+
LLGLDisable blend(GL_BLEND);
LLGLDisable test(GL_ALPHA_TEST);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -3168,7 +3078,6 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
if (hasAnyRenderType(LLPipeline::RENDER_TYPE_AVATAR,
LLPipeline::RENDER_TYPE_CONTROL_AV,
- LLPipeline::RENDER_TYPE_GROUND,
LLPipeline::RENDER_TYPE_TERRAIN,
LLPipeline::RENDER_TYPE_TREE,
LLPipeline::RENDER_TYPE_SKY,
@@ -4018,6 +3927,8 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion)
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_GEOMETRY);
LL_PROFILE_GPU_ZONE("renderGeomDeferred");
+ llassert(!sRenderingHUDs);
+
if (gUseWireframe)
{
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
@@ -4044,7 +3955,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion)
bool occlude = LLPipeline::sUseOcclusion > 1 && do_occlusion;
- setupHWLights(nullptr);
+ setupHWLights();
{
LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred pools");
@@ -4171,7 +4082,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0);
calcNearbyLights(camera);
- setupHWLights(NULL);
+ setupHWLights();
gGL.setSceneBlendType(LLRender::BT_ALPHA);
gGL.setColorMask(true, false);
@@ -5164,18 +5075,6 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp )
}
break;
- case LLDrawPool::POOL_INVISIBLE:
- if (mInvisiblePool)
- {
- llassert(0);
- LL_WARNS() << "Ignoring duplicate simple pool." << LL_ENDL;
- }
- else
- {
- mInvisiblePool = (LLRenderPass*) new_poolp;
- }
- break;
-
case LLDrawPool::POOL_GLOW:
if (mGlowPool)
{
@@ -5269,18 +5168,6 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp )
}
break;
- case LLDrawPool::POOL_GROUND:
- if( mGroundPool )
- {
- llassert(0);
- LL_WARNS() << "LLPipeline::addPool(): Ignoring duplicate Ground Pool" << LL_ENDL;
- }
- else
- {
- mGroundPool = new_poolp;
- }
- break;
-
case LLDrawPool::POOL_WL_SKY:
if( mWLSkyPool )
{
@@ -5350,11 +5237,6 @@ void LLPipeline::removeFromQuickLookup( LLDrawPool* poolp )
mFullbrightPool = NULL;
break;
- case LLDrawPool::POOL_INVISIBLE:
- llassert(mInvisiblePool == poolp);
- mInvisiblePool = NULL;
- break;
-
case LLDrawPool::POOL_WL_SKY:
llassert(mWLSkyPool == poolp);
mWLSkyPool = NULL;
@@ -5421,11 +5303,6 @@ void LLPipeline::removeFromQuickLookup( LLDrawPool* poolp )
mWaterPool = NULL;
break;
- case LLDrawPool::POOL_GROUND:
- llassert( poolp == mGroundPool );
- mGroundPool = NULL;
- break;
-
case LLDrawPool::POOL_GLTF_PBR:
llassert( poolp == mPBROpaquePool );
mPBROpaquePool = NULL;
@@ -5574,7 +5451,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
assertInitialized();
- if (LLPipeline::sReflectionRender || gCubeSnapshot)
+ if (LLPipeline::sReflectionRender || gCubeSnapshot || LLPipeline::sRenderingHUDs)
{
return;
}
@@ -5755,11 +5632,16 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)
}
}
-void LLPipeline::setupHWLights(LLDrawPool* pool)
+void LLPipeline::setupHWLights()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
assertInitialized();
+ if (LLPipeline::sRenderingHUDs)
+ {
+ return;
+ }
+
LLEnvironment& environment = LLEnvironment::instance();
LLSettingsSky::ptr_t psky = environment.getCurrentSky();
@@ -8116,6 +7998,8 @@ void LLPipeline::renderDeferredLighting()
return;
}
+ llassert(!sRenderingHUDs);
+
static LLCachedControl<F32> ambiance_scale(gSavedSettings, "RenderReflectionProbeAmbianceScale", 8.f);
F32 light_scale = 1.f;
@@ -8149,7 +8033,7 @@ void LLPipeline::renderDeferredLighting()
glh::matrix4f mat = copy_matrix(gGLModelView);
- setupHWLights(NULL); // to set mSun/MoonDir;
+ setupHWLights(); // to set mSun/MoonDir;
glh::vec4f tc(mSunDir.mV);
mat.mult_matrix_vec(tc);
@@ -8557,6 +8441,7 @@ void LLPipeline::renderDeferredLighting()
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,
@@ -8566,6 +8451,7 @@ void LLPipeline::renderDeferredLighting()
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,
@@ -9354,6 +9240,24 @@ LLRenderTarget* LLPipeline::getSpotShadowTarget(U32 i)
static LLTrace::BlockTimerStatHandle FTM_GEN_SUN_SHADOW("Gen Sun Shadow");
static LLTrace::BlockTimerStatHandle FTM_GEN_SUN_SHADOW_SPOT_RENDER("Spot Shadow Render");
+// helper class for disabling occlusion culling for the current stack frame
+class LLDisableOcclusionCulling
+{
+public:
+ S32 mUseOcclusion;
+
+ LLDisableOcclusionCulling()
+ {
+ mUseOcclusion = LLPipeline::sUseOcclusion;
+ LLPipeline::sUseOcclusion = 0;
+ }
+
+ ~LLDisableOcclusionCulling()
+ {
+ LLPipeline::sUseOcclusion = mUseOcclusion;
+ }
+};
+
void LLPipeline::generateSunShadow(LLCamera& camera)
{
if (!sRenderDeferred || RenderShadowDetail <= 0)
@@ -9364,6 +9268,8 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; //LL_RECORD_BLOCK_TIME(FTM_GEN_SUN_SHADOW);
LL_PROFILE_GPU_ZONE("generateSunShadow");
+ LLDisableOcclusionCulling no_occlusion;
+
bool skip_avatar_update = false;
if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson)
{
@@ -9529,7 +9435,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
if (fp.empty())
{
- if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA))
+ if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
{
mShadowCamera[0] = main_camera;
mShadowExtents[0][0] = min;
@@ -9597,7 +9503,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
F32 dist[] = { near_clip, mSunClipPlanes.mV[0], mSunClipPlanes.mV[1], mSunClipPlanes.mV[2], mSunClipPlanes.mV[3] };
if (mSunDiffuse == LLColor4::black)
- { //sun diffuse is totally shadows don't matter
+ { //sun diffuse is totally black shadows don't matter
LLGLDepthTest depth(GL_TRUE);
for (S32 j = 0; j < 4; j++)
@@ -9609,23 +9515,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
}
else
{
- /*if (gCubeSnapshot)
- {
- // do one shadow split for cube snapshots, clear the rest
- mSunClipPlanes.set(64.f, 64.f, 64.f);
- dist[1] = dist[2] = dist[3] = dist[4] = 64.f;
- for (S32 j = 1; j < 4; j++)
- {
- mRT->shadow[j].bindTarget();
- mRT->shadow[j].clear();
- mRT->shadow[j].flush();
- }
- }*/
-
- //for (S32 j = 0; j < (gCubeSnapshot ? 1 : 4); j++)
for (S32 j = 0; j < 4; j++)
{
- if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA))
+ if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
{
mShadowFrustPoints[j].clear();
}
@@ -9667,7 +9559,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
shadow_cam.calcAgentFrustumPlanes(frust);
shadow_cam.mFrustumCornerDist = 0.f;
- if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
+ if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
{
mShadowCamera[j] = shadow_cam;
}
@@ -9677,7 +9569,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
if (!gPipeline.getVisiblePointCloud(shadow_cam, min, max, fp, lightDir))
{
//no possible shadow receivers
- if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
+ if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
{
mShadowExtents[j][0] = LLVector3();
mShadowExtents[j][1] = LLVector3();
@@ -9697,7 +9589,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
continue;
}
- if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
+ if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
{
mShadowExtents[j][0] = min;
mShadowExtents[j][1] = max;
@@ -9924,7 +9816,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
eye = LLVector3(origin_agent.v);
- if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
+ if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
{
mShadowFrustOrigin[j] = eye;
}
@@ -9987,7 +9879,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
mRT->shadow[j].flush();
- if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
+ if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
{
mShadowCamera[j+4] = shadow_cam;
}
@@ -10121,8 +10013,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE);
- stop_glerror();
-
//
mSpotShadow[i].bindTarget();
@@ -10255,7 +10145,6 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar)
clearRenderTypeMask(
RENDER_TYPE_SKY,
RENDER_TYPE_WL_SKY,
- RENDER_TYPE_GROUND,
RENDER_TYPE_TERRAIN,
RENDER_TYPE_GRASS,
RENDER_TYPE_CONTROL_AV, // Animesh