diff options
Diffstat (limited to 'indra/newview/pipeline.cpp')
| -rw-r--r-- | indra/newview/pipeline.cpp | 337 |
1 files changed, 223 insertions, 114 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index fb04722864..8b0890a367 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -228,8 +228,8 @@ const F32 ALPHA_BLEND_CUTOFF = 0.598f; const F32 DEFERRED_LIGHT_FALLOFF = 0.5f; const U32 DEFERRED_VB_MASK = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1; -const U32 SHADOWS_RESX = 1024; -const U32 SHADOWS_RESY = 768; +const U32 SHADOWS_RESX = 512; +const U32 SHADOWS_RESY = 512; extern S32 gBoxFrame; extern bool gDisplaySwapBuffers; @@ -350,6 +350,9 @@ void validate_framebuffer_object(); bool addDeferredAttachments(LLRenderTarget& target, bool for_impostor = false) { U32 orm = GL_RGBA8; +/* + U32 norm = GL_RGBA16; +*/ U32 norm = GL_RGBA16F; U32 emissive = GL_RGB16F; @@ -360,7 +363,10 @@ bool addDeferredAttachments(LLRenderTarget& target, bool for_impostor = false) bool hdr = has_hdr() && gGLManager.mGLVersion > 4.05f; - if (!hdr || MPColorPrecision != 2) norm = GL_RGB10_A2; + if (!hdr || MPColorPrecision != 2) + { + norm = GL_RGB10_A2; + } if (!hdr || (!MPHDRDisplay && MPColorPrecision == 1)) emissive = GL_RGB8; bool valid = true; @@ -430,6 +436,8 @@ void LLPipeline::init() sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights"); sRenderAttachedParticles = gSavedSettings.getBOOL("RenderAttachedParticles"); + mReflectionMapManager.refreshSettings(); + mInitialized = true; LOG_GLERROR("LLPipeline::init()"); @@ -880,7 +888,7 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY, U32 type_) GLuint screenFormat = GL_RGBA16F; if(!hdr && !mHDRDisplay && MPColorPrecision == 1) screenFormat = GL_RGB8; - if (!mRT->screen.allocate(resX, resY, screenFormat)) return false; + if (!mRT->screen.allocate(resX, resY, GL_RGBA16F)) return false; mRT->deferredScreen.shareDepthBuffer(mRT->screen); @@ -912,7 +920,7 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY, U32 type_) if (RenderFSAAType > 0) { GLuint AAFormat = GL_RGBA8; - if(mHDRDisplay && MPColorPrecision == 2) + if(mHDRDisplay && MPColorPrecision != 1) { AAFormat = GL_RGBA16F; } @@ -929,7 +937,7 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY, U32 type_) mSMAABlendBuffer.release(); } - mDummyRT.allocate(8, 8, GL_RGBA8, false); + //mDummyRT.allocate(8, 8, GL_RGBA8, false); //water reflection texture (always needed as scratch space whether or not transparent water is enabled) mWaterDis.allocate(resX, resY, screenFormat, true); @@ -945,6 +953,10 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY, U32 type_) mSceneMap.release(); } +/* + mPostPingMap.allocate(resX, resY, GL_RGBA); + mPostPongMap.allocate(resX, resY, GL_RGBA); +*/ if((hdr && MPColorPrecision == 2) || mHDRDisplay) { mPostMaps[0].allocate(resX, resY, screenFormat); @@ -1228,7 +1240,7 @@ void LLPipeline::releaseGLBuffers() mSMAASearchMap = 0; } - mDummyRT.release(); + //mDummyRT.release(); releaseLUTBuffers(); @@ -1238,6 +1250,10 @@ void LLPipeline::releaseGLBuffers() mWaterExclusionMask.release(); +/* + mPostPingMap.release(); + mPostPongMap.release(); +*/ mPostMaps[0].release(); mPostMaps[1].release(); @@ -4174,6 +4190,84 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion) } } +// Render the geometry for the attached huds +// This fixes the slow down due to attached huds +void LLPipeline::renderGeomPostDeferredOnlyHud(LLCamera& camera) +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; + LL_PROFILE_GPU_ZONE("renderGeomPostDeferred"); + LL_RECORD_BLOCK_TIME(FTM_RENDER_DEFERRED); + + U32 cur_type = 0; + + LLGLEnable cull(GL_CULL_FACE); + + gGL.setSceneBlendType(LLRender::BT_ALPHA); + gGL.setColorMask(true, false); + + pool_set_t::iterator iter1 = mPools.begin(); + + while ( iter1 != mPools.end() ) + { + LLDrawPool *poolp = *iter1; + + cur_type = poolp->getType(); + + pool_set_t::iterator iter2 = iter1; + if (hasRenderType(poolp->getType()) && poolp->getNumPostDeferredPasses() > 0) + { + LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred poolrender"); + + gGLLastMatrix = NULL; + gGL.loadMatrix(gGLModelView); + + for( S32 i = 0; i < poolp->getNumPostDeferredPasses(); i++ ) + { + LLVertexBuffer::unbind(); + poolp->beginPostDeferredPass(i); + for (iter2 = iter1; iter2 != mPools.end(); iter2++) + { + LLDrawPool *p = *iter2; + if (p->getType() != cur_type) + { + break; + } + + p->renderPostDeferred(i); + } + poolp->endPostDeferredPass(i); + LLVertexBuffer::unbind(); + + if (gDebugGL || gDebugPipeline) + { + LLGLState::checkStates(GL_FALSE); + } + } + } + else + { + // Skip all pools of this type + for (iter2 = iter1; iter2 != mPools.end(); iter2++) + { + LLDrawPool *p = *iter2; + if (p->getType() != cur_type) + { + break; + } + } + } + iter1 = iter2; + LOG_GLERROR("after pools"); + } + + gGLLastMatrix = NULL; + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.loadMatrix(gGLModelView); + + LOG_GLERROR("LLPipeline::renderGeomPostDeferredOnlyHud()"); +} + + // Render all of our geometry that's required after our deferred pass. // This is gonna be stuff like alpha, water, etc. void LLPipeline::renderGeomPostDeferred(LLCamera& camera) @@ -4209,8 +4303,11 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera) // do water haze just before pre water alpha U32 water_haze_pass = LLDrawPool::POOL_ALPHA_PRE_WATER; + if(!done_atmospherics) + { calcNearbyLights(camera); setupHWLights(); + } gGL.setSceneBlendType(LLRender::BT_ALPHA); gGL.setColorMask(true, false); @@ -7158,9 +7255,6 @@ void LLPipeline::generateLuminance(LLRenderTarget* src, LLRenderTarget* dst) renderTriangle(); - gLuminanceProgram.unbindTexture(LLShaderMgr::DEFERRED_DIFFUSE); - gLuminanceProgram.unbindTexture(LLShaderMgr::DEFERRED_EMISSIVE); - gLuminanceProgram.unbindTexture(LLShaderMgr::NORMAL_MAP); gLuminanceProgram.unbind(); dst->flush(); @@ -7276,11 +7370,11 @@ void LLPipeline::generateExposure(LLRenderTarget* src, LLRenderTarget* dst, bool if (use_history) { - //gGL.getTexUnit(channel)->unbind(mLastExposure.getUsage()); + gGL.getTexUnit(channel)->unbind(mLastExposure.getUsage()); } - shader->unbindTexture(LLShaderMgr::DEFERRED_DIFFUSE); - shader->unbindTexture(LLShaderMgr::EXPOSURE_MAP); + //shader->unbindTexture(LLShaderMgr::DEFERRED_DIFFUSE); + //shader->unbindTexture(LLShaderMgr::EXPOSURE_MAP); shader->unbind(); dst->flush(); } @@ -7290,13 +7384,15 @@ void LLPipeline::generateExposure(LLRenderTarget* src, LLRenderTarget* dst, bool extern LLPointer<LLImageGL> gEXRImage; -void LLPipeline::tonemap(LLRenderTarget* src, LLRenderTarget* dst) +void LLPipeline::tonemap(LLRenderTarget* src, LLRenderTarget* dst, bool gamma_correct) { +/* + LL_PROFILE_GPU_ZONE("tonemap"); +*/ + dst->bindTarget("tonemap", 1); // gamma correct lighting { - LL_PROFILE_GPU_ZONE("tonemap"); - static LLCachedControl<bool> buildNoPost(gSavedSettings, "RenderDisablePostProcessing", false); LLGLDepthTest depth(GL_FALSE, GL_FALSE); @@ -7308,17 +7404,33 @@ void LLPipeline::tonemap(LLRenderTarget* src, LLRenderTarget* dst) LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); bool no_post = gSnapshotNoPost || psky->getReflectionProbeAmbiance(should_auto_adjust) == 0.f || (buildNoPost && gFloaterTools && gFloaterTools->isAvailable()); - LLGLSLShader& shader = no_post ? gNoPostTonemapProgram : gDeferredPostTonemapProgram; + LLGLSLShader* shader = nullptr; + if(gamma_correct) + { + bool legacy_gamma = psky->getReflectionProbeAmbiance(should_auto_adjust) == 0.f; + if(legacy_gamma) + { + shader = no_post ? &gNoPostTonemapLegacyGammaCorrectProgram : &gDeferredPostTonemapLegacyGammaCorrectProgram; + } + else + { + shader = no_post ? &gNoPostTonemapGammaCorrectProgram : &gDeferredPostTonemapGammaCorrectProgram; + } + } + else + { + shader = no_post ? &gNoPostTonemapProgram : &gDeferredPostTonemapProgram; + } - shader.bind(); + shader->bind(); //S32 channel = 0; - shader.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, false, LLTexUnit::TFO_POINT); + shader->bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, false, LLTexUnit::TFO_POINT); - shader.bindTexture(LLShaderMgr::EXPOSURE_MAP, &mExposureMap); + shader->bindTexture(LLShaderMgr::EXPOSURE_MAP, &mExposureMap); - shader.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)src->getWidth(), (GLfloat)src->getHeight()); + shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)src->getWidth(), (GLfloat)src->getHeight()); static LLCachedControl<F32> exposure(gSavedSettings, "RenderExposure", 1.f); @@ -7328,17 +7440,18 @@ void LLPipeline::tonemap(LLRenderTarget* src, LLRenderTarget* dst) static LLStaticHashedString tonemap_mix("tonemap_mix"); static LLStaticHashedString tonemap_type("tonemap_type"); - shader.uniform1f(s_exposure, e); + shader->uniform1f(s_exposure, e); static LLCachedControl<U32> tonemap_type_setting(gSavedSettings, "RenderTonemapType", 0U); - shader.uniform1i(tonemap_type, tonemap_type_setting); - shader.uniform1f(tonemap_mix, psky->getTonemapMix(should_auto_adjust())); + shader->uniform1i(tonemap_type, tonemap_type_setting); + shader->uniform1f(tonemap_mix, psky->getTonemapMix(should_auto_adjust())); renderTriangle(); - shader.unbindTexture(LLShaderMgr::DEFERRED_DIFFUSE); - shader.unbindTexture(LLShaderMgr::EXPOSURE_MAP); - shader.unbind(); +/* + gGL.getTexUnit(channel)->unbind(src->getUsage()); +*/ + shader->unbind(); } dst->flush(); LOG_GLERROR("LLPipeline::tonemap()"); @@ -7348,8 +7461,17 @@ void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) { LLGLDepthTest depth(GL_FALSE, GL_FALSE); +/* + LL_PROFILE_GPU_ZONE("gamma correct"); + + dst->bindTarget(); +*/ // gamma correct lighting { +/* + LLGLDepthTest depth(GL_FALSE, GL_FALSE); +*/ + LL_PROFILE_GPU_ZONE("gamma correct"); dst->bindTarget("gammaCorrect", 1); @@ -7362,7 +7484,6 @@ void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) LLGLSLShader& shader = psky->getReflectionProbeAmbiance(should_auto_adjust) == 0.f ? gLegacyPostGammaCorrectProgram : gDeferredPostGammaCorrectProgram; - static LLCachedControl<F32> mp_hdr_boost(gSavedSettings, "MPHDRBoost", false); static LLCachedControl<F32> mp_hdr_gamma(gSavedSettings, "MPHDRGamma", false); if(mHDRDisplay) shader = gHDRGammaCorrectProgram; @@ -7379,7 +7500,7 @@ void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) renderTriangle(); - shader.unbindTexture(LLShaderMgr::DEFERRED_DIFFUSE); + //shader.unbindTexture(LLShaderMgr::DEFERRED_DIFFUSE); shader.unbind(); dst->flush(); @@ -7417,11 +7538,15 @@ void LLPipeline::copyScreenSpaceReflections(LLRenderTarget* src, LLRenderTarget* void LLPipeline::generateGlow(LLRenderTarget* src) { + LL_PROFILE_GPU_ZONE("glow generate"); if (sRenderGlow) { LL_PROFILE_GPU_ZONE("glow"); LL_RECORD_BLOCK_TIME(FTM_RENDER_GLOW); +/* + mGlow[2].bindTarget(); +*/ mGlow[2].bindTarget("mGlow[2]", 1); mGlow[2].clear(); @@ -7463,7 +7588,7 @@ void LLPipeline::generateGlow(LLRenderTarget* src) gPipeline.enableLightsFullbright(); renderTriangle(); - gGlowExtractProgram.unbindTexture(LLShaderMgr::DIFFUSE_MAP); + //gGlowExtractProgram.unbindTexture(LLShaderMgr::DIFFUSE_MAP); gGlowExtractProgram.unbindTexture(LLShaderMgr::GLOW_NOISE_MAP); gGlowExtractProgram.unbind(); mGlow[2].flush(); @@ -7528,13 +7653,19 @@ void LLPipeline::generateGlow(LLRenderTarget* src) bool LLPipeline::applyCAS(LLRenderTarget* src, LLRenderTarget* dst) { - static LLCachedControl<F32> cas_sharpness(gSavedSettings, "RenderCASSharpness", 0.4f); - if (cas_sharpness == 0.0f || !gCASProgram.isComplete()) - { - return false; - } + LL_PROFILE_GPU_ZONE("cas"); + + static LLCachedControl<F32> cas_sharpness(gSavedSettings, "RenderCASSharpness", 0.0f); LLGLSLShader* sharpen_shader = &gCASProgram; + static LLCachedControl<bool> should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", false); + + LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); + bool legacy_gamma = psky->getReflectionProbeAmbiance(should_auto_adjust) == 0.f; + if(legacy_gamma) + { + sharpen_shader = &gCASLegacyGammaProgram; + } // Bind setup: dst->bindTarget("applyCAS", 1); @@ -7562,7 +7693,7 @@ bool LLPipeline::applyCAS(LLRenderTarget* src, LLRenderTarget* dst) S32 channel = sharpen_shader->bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, false, LLTexUnit::TFO_POINT); renderTriangle(); - sharpen_shader->unbindTexture(channel); + //sharpen_shader->unbindTexture(channel); sharpen_shader->unbind(); dst->flush(); @@ -7597,21 +7728,17 @@ bool LLPipeline::generateFXAABuffer(LLRenderTarget* src) renderTriangle(); } - shader->disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage()); + //shader->disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage()); shader->unbind(); mFXAAMap.flush(); - LLGLDepthTest depth(GL_FALSE, GL_FALSE); - mDummyRT.bindTarget("dummy",1); - mDummyRT.clear(GL_COLOR_BUFFER_BIT); - mDummyRT.flush(); - return true; } bool LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst) { + LL_PROFILE_GPU_ZONE("FXAA"); { llassert(!gCubeSnapshot); bool multisample = RenderFSAAType == 1 && gFXAAProgram[0].isComplete() && mFXAAMap.isComplete(); @@ -7711,7 +7838,7 @@ bool LLPipeline::generateSMAABuffers(LLRenderTarget* src) // Present everything. if (multisample) { - LL_PROFILE_GPU_ZONE("aa"); + LL_PROFILE_GPU_ZONE("SMAA Edge"); static LLCachedControl<U32> aa_quality(gSavedSettings, "RenderFSAASamples", 0U); U32 fsaa_quality = std::clamp(aa_quality(), 0U, 3U); @@ -7752,6 +7879,7 @@ bool LLPipeline::generateSMAABuffers(LLRenderTarget* src) gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); } + gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); } renderTriangle(); @@ -7811,6 +7939,7 @@ bool LLPipeline::generateSMAABuffers(LLRenderTarget* src) bool LLPipeline::applySMAA(LLRenderTarget* src, LLRenderTarget* dst) { + LL_PROFILE_GPU_ZONE("SMAA"); llassert(!gCubeSnapshot); bool multisample = false; @@ -7823,7 +7952,6 @@ bool LLPipeline::applySMAA(LLRenderTarget* src, LLRenderTarget* dst) if(!multisample) return false; { - LL_PROFILE_GPU_ZONE("aa"); static LLCachedControl<U32> aa_quality(gSavedSettings, "RenderFSAASamples", 0U); U32 fsaa_quality = std::clamp(aa_quality(), 0U, 3U); @@ -7892,8 +8020,12 @@ void LLPipeline::copyRenderTarget(LLRenderTarget* src, LLRenderTarget* dst) void LLPipeline::combineGlow(LLRenderTarget* src, LLRenderTarget* dst) { - // Go ahead and do our glow combine here in our destination. We blit this later into the front buffer. + LL_PROFILE_GPU_ZONE("glow combine"); +/* + // Go ahead and do our glow combine here in our destination. We blit this later into the front buffer. + dst->bindTarget(); +*/ dst->bindTarget("combineGlow", 1); { @@ -7912,6 +8044,7 @@ void LLPipeline::combineGlow(LLRenderTarget* src, LLRenderTarget* dst) bool LLPipeline::renderDoF(LLRenderTarget* src, LLRenderTarget* dst) { + LL_PROFILE_GPU_ZONE("dof"); { bool dof_enabled = (RenderDepthOfFieldInEditMode || !LLToolMgr::getInstance()->inBuildMode()) && @@ -7924,7 +8057,6 @@ bool LLPipeline::renderDoF(LLRenderTarget* src, LLRenderTarget* dst) if (dof_enabled) { - LL_PROFILE_GPU_ZONE("dof"); LLGLDisable blend(GL_BLEND); // depth of field focal plane calculations @@ -8231,86 +8363,51 @@ void LLPipeline::renderFinalize() LL_RECORD_BLOCK_TIME(FTM_RENDER_BLOOM); LL_PROFILE_GPU_ZONE("renderFinalize"); -#if LL_DARWIN - //gGL.debugTexUnits(); - - // Aims to fix the slowdowns in the post processing - for (S32 i = 0; i < 16; i++) - { - if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) - { - gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType()); - gGL.getTexUnit(i)->disable(); - } - } -#endif - gGL.color4f(1, 1, 1, 1); LLGLDepthTest depth(GL_FALSE); LLGLDisable blend(GL_BLEND); LLGLDisable cull(GL_CULL_FACE); - 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]); - gGL.setColorMask(true, true); glClearColor(0, 0, 0, 0); static LLCachedControl<bool> has_hdr(gSavedSettings, "RenderHDREnabled", true); bool hdr = gGLManager.mGLVersion > 4.05f && has_hdr(); - U16 activeRT = 0; + bool apply_cas = false; + static LLCachedControl<F32> cas_sharpness(gSavedSettings, "RenderCASSharpness", 0.0f); + if (cas_sharpness > 0.0f && gCASProgram.isComplete() && gCASLegacyGammaProgram.isComplete() && !mHDRDisplay) apply_cas = true; - LLRenderTarget* postHDRBuffer = &mRT->screen; + U16 activeRT = 0; - if (hdr) + if (hdr && !mHDRDisplay) { - if(generateFXAABuffer(postHDRBuffer)); - else generateSMAABuffers(postHDRBuffer); - copyScreenSpaceReflections(&mRT->screen, &mSceneMap); - if(!mHDRDisplay) - { generateLuminance(&mRT->screen, &mLuminanceMap); - generateExposure(&mLuminanceMap, &mExposureMap); - tonemap(&mRT->screen, &mRT->deferredLight); - postHDRBuffer = &mRT->deferredLight; - } - } - - gammaCorrect(postHDRBuffer, &mPostMaps[1 - activeRT]); - activeRT = 1 - activeRT; - - generateGlow(&mPostMaps[activeRT]); - - if(!hdr) - { - if(generateFXAABuffer(postHDRBuffer)) - { - } - else if(generateSMAABuffers(postHDRBuffer)) + if (apply_cas) { + tonemap(&mRT->screen, &mRT->deferredLight, false); + applyCAS(&mRT->deferredLight, &mPostMaps[activeRT]); } else { + tonemap(&mRT->screen, &mPostMaps[activeRT], true); } } - - if(applyFXAA(&mPostMaps[activeRT], &mPostMaps[1 - activeRT])) - { - activeRT = 1 - activeRT; - } - else if(applySMAA(&mPostMaps[activeRT], &mPostMaps[1 - activeRT])) + else { - activeRT = 1 - activeRT; + if(mHDRDisplay) copyScreenSpaceReflections(&mRT->screen, &mSceneMap); + gammaCorrect(&mRT->screen, &mPostMaps[activeRT]); } + generateFXAABuffer(&mRT->screen); + generateSMAABuffers(&mRT->screen); + + generateGlow(&mPostMaps[activeRT]); + if(hdr) { if(renderBloom(&mPostMaps[activeRT], &mPostMaps[1 - activeRT])) @@ -8319,19 +8416,27 @@ void LLPipeline::renderFinalize() } } + LLVertexBuffer::unbind(); + + 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]); + combineGlow(&mPostMaps[activeRT], &mPostMaps[1 - activeRT]); activeRT = 1 - activeRT; - if(!mHDRDisplay) + if(renderDoF(&mPostMaps[activeRT], &mPostMaps[1 - activeRT])) { - //CAS breaks the hdr colors for now. - if(applyCAS(&mPostMaps[activeRT], &mPostMaps[1 - activeRT])) - { - activeRT = 1 - activeRT; - } + activeRT = 1 - activeRT; } - if(renderDoF(&mPostMaps[activeRT], &mPostMaps[1 - activeRT])) + if(applyFXAA(&mPostMaps[activeRT], &mPostMaps[1 - activeRT])) + { + activeRT = 1 - activeRT; + } + else if(applySMAA(&mPostMaps[activeRT], &mPostMaps[1 - activeRT])) { activeRT = 1 - activeRT; } @@ -8421,7 +8526,7 @@ void LLPipeline::renderFinalize() gDeferredPostNoDoFNoiseProgram.unbindTexture(LLShaderMgr::DEFERRED_DEPTH); gDeferredPostNoDoFNoiseProgram.unbind(); - gGL.flush(); + //gGL.flush(); gGL.setSceneBlendType(LLRender::BT_ALPHA); @@ -8480,15 +8585,18 @@ void LLPipeline::bindShadowMaps(LLGLSLShader& shader) LOG_GLERROR("bindShadowMaps() 2"); - for (U32 i = 4; i < 6; i++) + if(RenderShadowDetail > 1) { - S32 channel = shader.enableTexture(LLShaderMgr::DEFERRED_SHADOW0 + i); - if (channel > -1) + for (U32 i = 4; i < 6; i++) { - LLRenderTarget* shadow_target = getSpotShadowTarget(i - 4); - if (shadow_target) + S32 channel = shader.enableTexture(LLShaderMgr::DEFERRED_SHADOW0 + i); + if (channel > -1) { - gGL.getTexUnit(channel)->bind(shadow_target, true); + LLRenderTarget* shadow_target = getSpotShadowTarget(i - 4); + if (shadow_target) + { + gGL.getTexUnit(channel)->bind(shadow_target, true); + } } } } @@ -8820,7 +8928,7 @@ void LLPipeline::renderDeferredLighting() tc_moon = mat * tc_moon; mTransformedMoonDir.set(tc_moon); - if ((RenderDeferredSSAO && !gCubeSnapshot) || (RenderShadowDetail > 0 && RenderShadowDetail < 4)) + if ((RenderDeferredSSAO && !gCubeSnapshot) || (!gCubeSnapshot && RenderShadowDetail > 0 && RenderShadowDetail < 4)) { LL_PROFILE_GPU_ZONE("sun program"); deferred_light_target->bindTarget("sun_shader", 1); @@ -9828,11 +9936,12 @@ void LLPipeline::renderShadow(const glm::mat4& view, const glm::mat4& proj, LLCa LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_LESS); + //static LLCachedControl<bool> sShadowAlternative(gSavedSettings, "MPShadowAlternative", false); + updateCull(shadow_cam, result); stateSort(shadow_cam, result); - //generate shadow map gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); gGL.loadMatrix(glm::value_ptr(proj)); |
