diff options
Diffstat (limited to 'indra/newview/pipeline.cpp')
| -rw-r--r-- | indra/newview/pipeline.cpp | 190 |
1 files changed, 83 insertions, 107 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 388dee00db..b5b5d9ef7f 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -354,7 +354,7 @@ bool addDeferredAttachments(LLRenderTarget& target, bool for_impostor = false) bool valid = true && target.addColorAttachment(GL_RGBA) // frag-data[1] specular OR PBR ORM && target.addColorAttachment(GL_RGBA16F) // frag_data[2] normal+z+fogmask, See: class1\deferred\materialF.glsl & softenlight - && target.addColorAttachment(GL_RGBA); // frag_data[3] PBR emissive + && target.addColorAttachment(GL_RGB16); // frag_data[3] PBR emissive return valid; } @@ -432,6 +432,7 @@ void LLPipeline::init() getPool(LLDrawPool::POOL_MATERIALS); getPool(LLDrawPool::POOL_GLOW); getPool(LLDrawPool::POOL_GLTF_PBR); + getPool(LLDrawPool::POOL_GLTF_PBR_ALPHA_MASK); resetFrameStats(); @@ -680,8 +681,6 @@ void LLPipeline::destroyGL() resetDrawOrders(); - resetVertexBuffers(); - releaseGLBuffers(); if (mMeshDirtyQueryObject) @@ -801,7 +800,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) gCubeSnapshot = TRUE; mReflectionMapManager.initReflectionMaps(); mRT = &mAuxillaryRT; - U32 res = mReflectionMapManager.mProbeResolution * 2; //multiply by 2 because probes will be super sampled + U32 res = mReflectionMapManager.mProbeResolution * 4; //multiply by 4 because probes will be 16x super sampled allocateScreenBuffer(res, res, samples); mRT = &mMainRT; gCubeSnapshot = FALSE; @@ -1545,6 +1544,9 @@ LLDrawPool *LLPipeline::findPool(const U32 type, LLViewerTexture *tex0) case LLDrawPool::POOL_GLTF_PBR: poolp = mPBROpaquePool; break; + case LLDrawPool::POOL_GLTF_PBR_ALPHA_MASK: + poolp = mPBRAlphaMaskPool; + break; default: llassert(0); @@ -2282,7 +2284,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result) LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; //LL_RECORD_BLOCK_TIME(FTM_CULL); LL_PROFILE_GPU_ZONE("updateCull"); // should always be zero GPU time, but drop a timer to flush stuff out - bool water_clip = !sRenderTransparentWater; + bool water_clip = !sRenderTransparentWater && !sRenderingHUDs; if (water_clip) { @@ -2432,6 +2434,26 @@ void LLPipeline::doOcclusion(LLCamera& camera) LL_PROFILE_GPU_ZONE("doOcclusion"); llassert(!gCubeSnapshot); + if (sReflectionProbesEnabled && sUseOcclusion > 1 && !LLPipeline::sShadowRender && !gCubeSnapshot) + { + gGL.setColorMask(false, false); + LLGLDepthTest depth(GL_TRUE, GL_FALSE); + LLGLDisable cull(GL_CULL_FACE); + + gOcclusionCubeProgram.bind(); + + if (mCubeVB.isNull()) + { //cube VB will be used for issuing occlusion queries + mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX); + } + mCubeVB->setBuffer(); + + mReflectionMapManager.doOcclusion(); + gOcclusionCubeProgram.unbind(); + + gGL.setColorMask(true, true); + } + if (LLPipeline::sUseOcclusion > 1 && !LLSpatialPartition::sTeleportRequested && (sCull->hasOcclusionGroups() || LLVOCachePartition::sNeedsOcclusionCheck)) { @@ -4687,7 +4709,7 @@ void LLPipeline::renderDebug() mReflectionMapManager.renderDebug(); } - if (gSavedSettings.getBOOL("RenderReflectionProbeVolumes")) + if (gSavedSettings.getBOOL("RenderReflectionProbeVolumes") && !hud_only) { LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("probe debug display"); @@ -4740,7 +4762,7 @@ void LLPipeline::renderDebug() } } - if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) + if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !hud_only) { LLVertexBuffer::unbind(); @@ -5192,6 +5214,19 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) } break; + case LLDrawPool::POOL_GLTF_PBR_ALPHA_MASK: + if (mPBRAlphaMaskPool) + { + llassert(0); + LL_WARNS() << "LLPipeline::addPool(): Ignoring duplicate PBR Alpha Mask Pool" << LL_ENDL; + } + else + { + mPBRAlphaMaskPool = new_poolp; + } + break; + + default: llassert(0); LL_WARNS() << "Invalid Pool Type in LLPipeline::addPool()" << LL_ENDL; @@ -5308,6 +5343,11 @@ void LLPipeline::removeFromQuickLookup( LLDrawPool* poolp ) mPBROpaquePool = NULL; break; + case LLDrawPool::POOL_GLTF_PBR_ALPHA_MASK: + llassert(poolp == mPBRAlphaMaskPool); + mPBRAlphaMaskPool = NULL; + break; + default: llassert(0); LL_WARNS() << "Invalid Pool Type in LLPipeline::removeFromQuickLookup() type=" << poolp->getType() << LL_ENDL; @@ -6711,88 +6751,6 @@ void LLPipeline::resetVertexBuffers(LLDrawable* drawable) } } -void LLPipeline::resetVertexBuffers() -{ - mResetVertexBuffers = true; -} - -void LLPipeline::doResetVertexBuffers(bool forced) -{ - if (!mResetVertexBuffers) - { - return; - } - if(!forced && LLSpatialPartition::sTeleportRequested) - { - if(gAgent.getTeleportState() != LLAgent::TELEPORT_NONE) - { - return; //wait for teleporting to finish - } - else - { - //teleporting aborted - LLSpatialPartition::sTeleportRequested = FALSE; - mResetVertexBuffers = false; - return; - } - } - - LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; - mResetVertexBuffers = false; - - mCubeVB = NULL; - mDeferredVB = NULL; - - 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++) - { - LLSpatialPartition* part = region->getSpatialPartition(i); - if (part) - { - part->resetVertexBuffers(); - } - } - } - if(LLSpatialPartition::sTeleportRequested) - { - LLSpatialPartition::sTeleportRequested = FALSE; - - LLWorld::getInstance()->clearAllVisibleObjects(); - clearRebuildDrawables(); - } - - resetDrawOrders(); - - gSky.resetVertexBuffers(); - - LLVOPartGroup::destroyGL(); - - if ( LLPathingLib::getInstance() ) - { - LLPathingLib::getInstance()->cleanupVBOManager(); - } - LLVOPartGroup::destroyGL(); - gGL.resetVertexBuffer(); - - LLVertexBuffer::unbind(); - - updateRenderBump(); - - sBakeSunlight = gSavedSettings.getBOOL("RenderBakeSunlight"); - sNoAlpha = gSavedSettings.getBOOL("RenderNoAlpha"); - LLPipeline::sTextureBindTest = gSavedSettings.getBOOL("RenderDebugTextureBind"); - - gGL.initVertexBuffer(); - - mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK); - mDeferredVB->allocateBuffer(8, 0); - - LLVOPartGroup::restoreGL(); -} - void LLPipeline::renderObjects(U32 type, bool texture, bool batch_texture, bool rigged) { assertInitialized(); @@ -7533,9 +7491,13 @@ void LLPipeline::renderFinalize() gDeferredPostGammaCorrectProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, screenTarget()->getWidth(), screenTarget()->getHeight()); - F32 gamma = gSavedSettings.getF32("RenderDeferredDisplayGamma"); + static LLCachedControl<F32> exposure(gSavedSettings, "RenderExposure", 1.f); + + F32 e = llclamp(exposure(), 0.5f, 4.f); + + static LLStaticHashedString s_exposure("exposure"); - gDeferredPostGammaCorrectProgram.uniform1f(LLShaderMgr::DISPLAY_GAMMA, (gamma > 0.1f) ? 1.0f / gamma : (1.0f / 2.2f)); + gDeferredPostGammaCorrectProgram.uniform1f(s_exposure, e); mScreenTriangleVB->setBuffer(); mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); @@ -7779,18 +7741,6 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ stop_glerror(); } - channel = shader.enableTexture(LLShaderMgr::SCENE_MAP); - if (channel > -1) - { - gGL.getTexUnit(channel)->bind(&mSceneMap); - } - - channel = shader.enableTexture(LLShaderMgr::SCENE_DEPTH); - if (channel > -1) - { - gGL.getTexUnit(channel)->bind(&mSceneMap, true); - } - if (shader.getUniformLocation(LLShaderMgr::VIEWPORT) != -1) { shader.uniform4f(LLShaderMgr::VIEWPORT, (F32) gGLViewport[0], @@ -8572,10 +8522,13 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep) shader.uniform1f(LLShaderMgr::PROJECTOR_SHADOW_FADE, 1.f); } - //if (!gCubeSnapshot) + // make sure we're not already targeting the same spot light with both shadow maps + llassert(mTargetShadowSpotLight[0] != mTargetShadowSpotLight[1] || mTargetShadowSpotLight[0].isNull()); + + if (!gCubeSnapshot) { LLDrawable* potential = drawablep; - //determine if this is a good light for casting shadows + //determine if this light is higher priority than one of the existing spot shadows F32 m_pri = volume->getSpotLightPriority(); for (U32 i = 0; i < 2; i++) @@ -8584,7 +8537,7 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep) if (mTargetShadowSpotLight[i].notNull()) { - pri = mTargetShadowSpotLight[i]->getVOVolume()->getSpotLightPriority(); + pri = mTargetShadowSpotLight[i]->getVOVolume()->getSpotLightPriority(); } if (m_pri > pri) @@ -8597,6 +8550,9 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep) } } + // make sure we didn't end up targeting the same spot light with both shadow maps + llassert(mTargetShadowSpotLight[0] != mTargetShadowSpotLight[1] || mTargetShadowSpotLight[0].isNull()); + LLViewerTexture* img = volume->getLightTexture(); if (img == NULL) @@ -8717,6 +8673,21 @@ void LLPipeline::bindReflectionProbes(LLGLSLShader& shader) setEnvMat(shader); } + + // reflection probe shaders generally sample the scene map as well for SSR + channel = shader.enableTexture(LLShaderMgr::SCENE_MAP); + if (channel > -1) + { + gGL.getTexUnit(channel)->bind(&mSceneMap); + } + + channel = shader.enableTexture(LLShaderMgr::SCENE_DEPTH); + if (channel > -1) + { + gGL.getTexUnit(channel)->bind(&mSceneMap, true); + } + + } void LLPipeline::unbindReflectionProbes(LLGLSLShader& shader) @@ -9886,7 +9857,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera) } } - //hack to disable projector shadows bool gen_shadow = RenderShadowDetail > 1; @@ -9898,6 +9868,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera) F32 fade_amt = gFrameIntervalSeconds.value() * llmax(LLTrace::get_frame_recording().getLastRecording().getSum(*velocity_stat) / LLTrace::get_frame_recording().getLastRecording().getDuration().value(), 1.0); + // should never happen + llassert(mTargetShadowSpotLight[0] != mTargetShadowSpotLight[1] || mTargetShadowSpotLight[0].isNull()); + //update shadow targets for (U32 i = 0; i < 2; i++) { //for each current shadow @@ -9928,6 +9901,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera) } } + // this should never happen + llassert(mShadowSpotLight[0] != mShadowSpotLight[1] || mShadowSpotLight[0].isNull()); + for (S32 i = 0; i < 2; i++) { set_current_modelview(saved_view); |
