From bdb53fd56d56c659941e7e63f83cefc366acef6d Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Thu, 16 Nov 2023 16:46:12 -0600 Subject: SL-20611 Make haze effect local lights -- move sky and water haze to their own passes and unify sky and water haze in forward rendering shaders. --- indra/newview/pipeline.cpp | 66 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 11 deletions(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 9266c84540..52afe16799 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -7875,7 +7875,7 @@ void LLPipeline::renderDeferredLighting() if (RenderDeferredAtmospheric) { // apply sunlight contribution - LLGLSLShader &soften_shader = LLPipeline::sUnderWaterRender ? gDeferredSoftenWaterProgram : gDeferredSoftenProgram; + LLGLSLShader &soften_shader = gDeferredSoftenProgram; LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("renderDeferredLighting - atmospherics"); LL_PROFILE_GPU_ZONE("atmospherics"); @@ -7904,7 +7904,7 @@ void LLPipeline::renderDeferredLighting() mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); } - unbindDeferredShader(LLPipeline::sUnderWaterRender ? gDeferredSoftenWaterProgram : gDeferredSoftenProgram); + unbindDeferredShader(gDeferredSoftenProgram); } static LLCachedControl local_light_count(gSavedSettings, "RenderLocalLightCount", 256); @@ -8056,7 +8056,7 @@ void LLPipeline::renderDeferredLighting() LLVector4a center; center.load3(drawablep->getPositionAgent().mV); - const F32 *c = center.getF32ptr(); + const F32* c = center.getF32ptr(); F32 s = volume->getLightRadius() * 1.5f; sVisibleLightCount++; @@ -8105,8 +8105,8 @@ void LLPipeline::renderDeferredLighting() U32 idx = count - 1; bindDeferredShader(gDeferredMultiLightProgram[idx]); gDeferredMultiLightProgram[idx].uniform1i(LLShaderMgr::MULTI_LIGHT_COUNT, count); - gDeferredMultiLightProgram[idx].uniform4fv(LLShaderMgr::MULTI_LIGHT, count, (GLfloat *) light); - gDeferredMultiLightProgram[idx].uniform4fv(LLShaderMgr::MULTI_LIGHT_COL, count, (GLfloat *) col); + gDeferredMultiLightProgram[idx].uniform4fv(LLShaderMgr::MULTI_LIGHT, count, (GLfloat*)light); + gDeferredMultiLightProgram[idx].uniform4fv(LLShaderMgr::MULTI_LIGHT_COL, count, (GLfloat*)col); gDeferredMultiLightProgram[idx].uniform1f(LLShaderMgr::MULTI_LIGHT_FAR_Z, far_z); far_z = 0.f; count = 0; @@ -8124,11 +8124,11 @@ void LLPipeline::renderDeferredLighting() for (LLDrawable::drawable_list_t::iterator iter = fullscreen_spot_lights.begin(); iter != fullscreen_spot_lights.end(); ++iter) { - LLDrawable *drawablep = *iter; - LLVOVolume *volume = drawablep->getVOVolume(); - LLVector3 center = drawablep->getPositionAgent(); - F32 * c = center.mV; - F32 light_size_final = volume->getLightRadius() * 1.5f; + LLDrawable* drawablep = *iter; + LLVOVolume* volume = drawablep->getVOVolume(); + LLVector3 center = drawablep->getPositionAgent(); + F32* c = center.mV; + F32 light_size_final = volume->getLightRadius() * 1.5f; F32 light_falloff_final = volume->getLightFalloff(DEFERRED_LIGHT_FALLOFF); sVisibleLightCount++; @@ -8154,12 +8154,56 @@ void LLPipeline::renderDeferredLighting() } + + if (RenderDeferredAtmospheric) + { + LLGLEnable blend(GL_BLEND); + gGL.blendFunc(LLRender::BF_ONE, LLRender::BF_SOURCE_ALPHA); + gGL.setColorMask(true, false); + + for (U32 i = 0; i < 2; ++i) + { + // apply haze + LLGLSLShader &haze_shader = i == 0 ? gHazeProgram : gHazeWaterProgram; + + LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("renderDeferredLighting - haze"); + LL_PROFILE_GPU_ZONE("haze"); + bindDeferredShader(haze_shader); + + static LLCachedControl ssao_scale(gSavedSettings, "RenderSSAOIrradianceScale", 0.5f); + static LLCachedControl ssao_max(gSavedSettings, "RenderSSAOIrradianceMax", 0.25f); + static LLStaticHashedString ssao_scale_str("ssao_irradiance_scale"); + static LLStaticHashedString ssao_max_str("ssao_irradiance_max"); + + haze_shader.uniform1f(ssao_scale_str, ssao_scale); + haze_shader.uniform1f(ssao_max_str, ssao_max); + + LLEnvironment &environment = LLEnvironment::instance(); + haze_shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0); + haze_shader.uniform3fv(LLShaderMgr::LIGHTNORM, 1, environment.getClampedLightNorm().mV); + + haze_shader.uniform4fv(LLShaderMgr::WATER_WATERPLANE, 1, LLDrawPoolAlpha::sWaterPlane.mV); + + { + LLGLDepthTest depth(GL_FALSE); + + // full screen blit + mScreenTriangleVB->setBuffer(); + mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); + } + + unbindDeferredShader(haze_shader); + } + + gGL.setSceneBlendType(LLRender::BT_ALPHA); + } + + gGL.setColorMask(true, true); } { // render non-deferred geometry (alpha, fullbright, glow) LLGLDisable blend(GL_BLEND); - //LLGLDisable stencil(GL_STENCIL_TEST); pushRenderTypeMask(); andRenderTypeMask(LLPipeline::RENDER_TYPE_ALPHA, -- cgit v1.2.3 From 70eda83fb08c5c4e8b0ea95868243d744c6e88e9 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Mon, 20 Nov 2023 21:25:06 +0100 Subject: SL-20563 Add 'No Post' option to Snapshot floater --- indra/newview/pipeline.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 9266c84540..64d247a202 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -211,6 +211,7 @@ extern S32 gBoxFrame; extern BOOL gDisplaySwapBuffers; extern BOOL gDebugGL; extern BOOL gCubeSnapshot; +extern BOOL gSnapshotNoPost; bool gAvatarBacklight = false; @@ -6791,7 +6792,7 @@ void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) { { LL_PROFILE_GPU_ZONE("gamma correct"); - static LLCachedControl no_post(gSavedSettings, "RenderDisablePostProcessing", false); + static LLCachedControl buildNoPost(gSavedSettings, "RenderDisablePostProcessing", false); LLGLDepthTest depth(GL_FALSE, GL_FALSE); @@ -6801,7 +6802,8 @@ void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) { LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); - LLGLSLShader& shader = no_post && gFloaterTools->isAvailable() ? gNoPostGammaCorrectProgram : // no post (no gamma, no exposure, no tonemapping) + bool no_post = gSnapshotNoPost || (buildNoPost && gFloaterTools->isAvailable()); + LLGLSLShader& shader = no_post ? gNoPostGammaCorrectProgram : // no post (no gamma, no exposure, no tonemapping) psky->getReflectionProbeAmbiance(should_auto_adjust) == 0.f ? gLegacyPostGammaCorrectProgram : gDeferredPostGammaCorrectProgram; -- cgit v1.2.3 From 68875523e09f9fe06fc4b3cd5225995bb13966c3 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Thu, 30 Nov 2023 12:01:45 -0600 Subject: SL-20611 Incorporate water haze into new post effect atmospherics goodness --- indra/newview/pipeline.cpp | 156 ++++++++++++++++++++++++++++++++------------- 1 file changed, 110 insertions(+), 46 deletions(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 52afe16799..7b1e5a55d1 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -3877,6 +3877,20 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera) LLGLEnable cull(GL_CULL_FACE); + bool done_atmospherics = LLPipeline::sRenderingHUDs; //skip atmospherics on huds + bool done_water_haze = done_atmospherics; + + // do atmospheric haze just before post water alpha + U32 atmospherics_pass = LLDrawPool::POOL_ALPHA_POST_WATER; + + if (LLPipeline::sUnderWaterRender) + { // if under water, do atmospherics just before the water pass + atmospherics_pass = LLDrawPool::POOL_WATER; + } + + // do water haze just before pre water alpha + U32 water_haze_pass = LLDrawPool::POOL_ALPHA_PRE_WATER; + calcNearbyLights(camera); setupHWLights(); @@ -3896,6 +3910,18 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera) cur_type = poolp->getType(); + if (cur_type >= atmospherics_pass && !done_atmospherics) + { // do atmospherics against depth buffer before rendering alpha + doAtmospherics(); + done_atmospherics = true; + } + + if (cur_type >= water_haze_pass && !done_water_haze) + { // do water haze against depth buffer before rendering alpha + doWaterHaze(); + done_water_haze = true; + } + pool_set_t::iterator iter2 = iter1; if (hasRenderType(poolp->getType()) && poolp->getNumPostDeferredPasses() > 0) { @@ -8153,52 +8179,6 @@ void LLPipeline::renderDeferredLighting() } } - - - if (RenderDeferredAtmospheric) - { - LLGLEnable blend(GL_BLEND); - gGL.blendFunc(LLRender::BF_ONE, LLRender::BF_SOURCE_ALPHA); - gGL.setColorMask(true, false); - - for (U32 i = 0; i < 2; ++i) - { - // apply haze - LLGLSLShader &haze_shader = i == 0 ? gHazeProgram : gHazeWaterProgram; - - LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("renderDeferredLighting - haze"); - LL_PROFILE_GPU_ZONE("haze"); - bindDeferredShader(haze_shader); - - static LLCachedControl ssao_scale(gSavedSettings, "RenderSSAOIrradianceScale", 0.5f); - static LLCachedControl ssao_max(gSavedSettings, "RenderSSAOIrradianceMax", 0.25f); - static LLStaticHashedString ssao_scale_str("ssao_irradiance_scale"); - static LLStaticHashedString ssao_max_str("ssao_irradiance_max"); - - haze_shader.uniform1f(ssao_scale_str, ssao_scale); - haze_shader.uniform1f(ssao_max_str, ssao_max); - - LLEnvironment &environment = LLEnvironment::instance(); - haze_shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0); - haze_shader.uniform3fv(LLShaderMgr::LIGHTNORM, 1, environment.getClampedLightNorm().mV); - - haze_shader.uniform4fv(LLShaderMgr::WATER_WATERPLANE, 1, LLDrawPoolAlpha::sWaterPlane.mV); - - { - LLGLDepthTest depth(GL_FALSE); - - // full screen blit - mScreenTriangleVB->setBuffer(); - mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); - } - - unbindDeferredShader(haze_shader); - } - - gGL.setSceneBlendType(LLRender::BT_ALPHA); - } - - gGL.setColorMask(true, true); } @@ -8254,6 +8234,90 @@ void LLPipeline::renderDeferredLighting() gGL.setColorMask(true, true); } +void LLPipeline::doAtmospherics() +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; + + if (RenderDeferredAtmospheric) + { + LLGLEnable blend(GL_BLEND); + gGL.blendFunc(LLRender::BF_ONE, LLRender::BF_SOURCE_ALPHA, LLRender::BF_ZERO, LLRender::BF_SOURCE_ALPHA); + + gGL.setColorMask(true, true); + + // apply haze + LLGLSLShader& haze_shader = gHazeProgram; + + LL_PROFILE_GPU_ZONE("haze"); + bindDeferredShader(haze_shader); + + LLEnvironment& environment = LLEnvironment::instance(); + haze_shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0); + haze_shader.uniform3fv(LLShaderMgr::LIGHTNORM, 1, environment.getClampedLightNorm().mV); + + haze_shader.uniform4fv(LLShaderMgr::WATER_WATERPLANE, 1, LLDrawPoolAlpha::sWaterPlane.mV); + + LLGLDepthTest depth(GL_FALSE); + + // full screen blit + mScreenTriangleVB->setBuffer(); + mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); + + unbindDeferredShader(haze_shader); + + gGL.setSceneBlendType(LLRender::BT_ALPHA); + } +} + +void LLPipeline::doWaterHaze() +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; + + if (RenderDeferredAtmospheric) + { + LLGLEnable blend(GL_BLEND); + gGL.blendFunc(LLRender::BF_ONE, LLRender::BF_SOURCE_ALPHA, LLRender::BF_ZERO, LLRender::BF_SOURCE_ALPHA); + + gGL.setColorMask(true, true); + + // apply haze + LLGLSLShader& haze_shader = gHazeWaterProgram; + + LL_PROFILE_GPU_ZONE("haze"); + bindDeferredShader(haze_shader); + + haze_shader.uniform4fv(LLShaderMgr::WATER_WATERPLANE, 1, LLDrawPoolAlpha::sWaterPlane.mV); + + static LLStaticHashedString above_water_str("above_water"); + haze_shader.uniform1i(above_water_str, sUnderWaterRender ? -1 : 1); + + if (LLPipeline::sUnderWaterRender) + { + LLGLDepthTest depth(GL_FALSE); + + // full screen blit + mScreenTriangleVB->setBuffer(); + mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); + } + else + { + //render water patches like LLDrawPoolWater does + LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_LEQUAL); + LLGLDisable cull(GL_CULL_FACE); + + gGLLastMatrix = NULL; + gGL.loadMatrix(gGLModelView); + + mWaterPool->pushFaceGeometry(); + } + + unbindDeferredShader(haze_shader); + + + gGL.setSceneBlendType(LLRender::BT_ALPHA); + } +} + void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep) { //construct frustum -- cgit v1.2.3 From c573d27e5baf23adbc14153c4d65a581f55febb4 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Fri, 1 Dec 2023 14:49:22 -0600 Subject: SL-20611 Followup -- fix for water rendering twice. Add comments around LLEventPoll hack. --- indra/newview/pipeline.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 76414b5e4e..50cd4adb73 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -2311,13 +2311,6 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result) gSky.mVOWLSkyp->mDrawable->setVisible(camera); sCull->pushDrawable(gSky.mVOWLSkyp->mDrawable); } - - bool render_water = !sReflectionRender && (hasRenderType(LLPipeline::RENDER_TYPE_WATER) || hasRenderType(LLPipeline::RENDER_TYPE_VOIDWATER)); - - if (render_water) - { - LLWorld::getInstance()->precullWaterObjects(camera, sCull, render_water); - } } void LLPipeline::markNotCulled(LLSpatialGroup* group, LLCamera& camera) -- cgit v1.2.3 From c28eb36a2c09f31f491676c8548dfa1c19277ce2 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Tue, 5 Dec 2023 19:50:25 -0600 Subject: SL-20654 Fix for box probes sometimes glitching out at the corners. Incidental fix for crash when mWaterPool is null. --- indra/newview/pipeline.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 50cd4adb73..bf4f0083ff 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8303,7 +8303,10 @@ void LLPipeline::doWaterHaze() gGLLastMatrix = NULL; gGL.loadMatrix(gGLModelView); - mWaterPool->pushFaceGeometry(); + if (mWaterPool) + { + mWaterPool->pushFaceGeometry(); + } } unbindDeferredShader(haze_shader); -- cgit v1.2.3 From a27740bbb2da04b14016de1398178df4fb970bcd Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Mon, 27 Nov 2023 17:59:16 +0100 Subject: SL-19655 BugSplat Crash: LLGLState::checkStates (2427) --- indra/newview/pipeline.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index bf4f0083ff..f8812d9750 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -3821,10 +3821,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion) poolp->endDeferredPass(i); LLVertexBuffer::unbind(); - if (gDebugGL || gDebugPipeline) - { - LLGLState::checkStates(); - } + LLGLState::checkStates(); } } else -- cgit v1.2.3 From d05b80817b4c7ada2b3934f0d8c814fc67c50c8e Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Wed, 6 Dec 2023 10:33:32 -0600 Subject: SL-20611 Followup -- fix banding in water fog (thanks, Rye!) --- indra/newview/pipeline.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index bf4f0083ff..8c3cf09098 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -789,7 +789,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) if (LLPipeline::sRenderTransparentWater) { //water reflection texture - mWaterDis.allocate(resX, resY, GL_RGBA, true); + mWaterDis.allocate(resX, resY, GL_RGBA16F, true); } if (RenderUIBuffer) -- cgit v1.2.3 From f3b87145775d3803306036d1e31fa39177f2600e Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 11 Dec 2023 15:28:25 -0600 Subject: SL-20611 Followup -- fix for artifacts on water surface from GPUs that don't like to read from a depth buffer that is bound for writing --- indra/newview/pipeline.cpp | 45 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 2e55b65c82..b24a8106cc 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -7476,7 +7476,7 @@ void LLPipeline::bindDeferredShaderFast(LLGLSLShader& shader) } } -void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_target) +void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_target, LLRenderTarget* depth_target) { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; LLRenderTarget* deferred_target = &mRT->deferredScreen; @@ -7515,7 +7515,14 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ channel = shader.enableTexture(LLShaderMgr::DEFERRED_DEPTH, deferred_target->getUsage()); if (channel > -1) { - gGL.getTexUnit(channel)->bind(deferred_target, TRUE); + if (depth_target) + { + gGL.getTexUnit(channel)->bind(depth_target, TRUE); + } + else + { + gGL.getTexUnit(channel)->bind(deferred_target, TRUE); + } stop_glerror(); } @@ -8232,16 +8239,42 @@ void LLPipeline::doAtmospherics() if (RenderDeferredAtmospheric) { + if (!sUnderWaterRender) + { + // copy depth buffer for use in haze shader (use water displacement map as temp storage) + LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); + + LLRenderTarget& src = gPipeline.mRT->screen; + LLRenderTarget& depth_src = gPipeline.mRT->deferredScreen; + LLRenderTarget& dst = gPipeline.mWaterDis; + + mRT->screen.flush(); + dst.bindTarget(); + gCopyDepthProgram.bind(); + + S32 diff_map = gCopyDepthProgram.getTextureChannel(LLShaderMgr::DIFFUSE_MAP); + S32 depth_map = gCopyDepthProgram.getTextureChannel(LLShaderMgr::DEFERRED_DEPTH); + + gGL.getTexUnit(diff_map)->bind(&src); + gGL.getTexUnit(depth_map)->bind(&depth_src, true); + + gGL.setColorMask(false, false); + gPipeline.mScreenTriangleVB->setBuffer(); + gPipeline.mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); + + dst.flush(); + mRT->screen.bindTarget(); + } + LLGLEnable blend(GL_BLEND); gGL.blendFunc(LLRender::BF_ONE, LLRender::BF_SOURCE_ALPHA, LLRender::BF_ZERO, LLRender::BF_SOURCE_ALPHA); - gGL.setColorMask(true, true); // apply haze LLGLSLShader& haze_shader = gHazeProgram; LL_PROFILE_GPU_ZONE("haze"); - bindDeferredShader(haze_shader); + bindDeferredShader(haze_shader, nullptr, sUnderWaterRender ? nullptr : &mWaterDis); LLEnvironment& environment = LLEnvironment::instance(); haze_shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0); @@ -8294,7 +8327,7 @@ void LLPipeline::doWaterHaze() else { //render water patches like LLDrawPoolWater does - LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_LEQUAL); + /*LLGLDepthTest depth(GL_FALSE); LLGLDisable cull(GL_CULL_FACE); gGLLastMatrix = NULL; @@ -8303,7 +8336,7 @@ void LLPipeline::doWaterHaze() if (mWaterPool) { mWaterPool->pushFaceGeometry(); - } + }*/ } unbindDeferredShader(haze_shader); -- cgit v1.2.3 From 4ca23735d906c69742f4bf362eb97b87831c2ece Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 11 Dec 2023 15:40:33 -0600 Subject: SL-20611 Followup -- reenable water haze --- indra/newview/pipeline.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index b24a8106cc..f448983ac2 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8327,7 +8327,7 @@ void LLPipeline::doWaterHaze() else { //render water patches like LLDrawPoolWater does - /*LLGLDepthTest depth(GL_FALSE); + LLGLDepthTest depth(GL_FALSE); LLGLDisable cull(GL_CULL_FACE); gGLLastMatrix = NULL; @@ -8336,7 +8336,7 @@ void LLPipeline::doWaterHaze() if (mWaterPool) { mWaterPool->pushFaceGeometry(); - }*/ + } } unbindDeferredShader(haze_shader); -- cgit v1.2.3 From 1f7f30aea4bb67bc9de9a6354085b7f0b0849617 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 11 Dec 2023 15:49:51 -0600 Subject: SL-20611 Brute force fix for water haze -- paid for by cycles saved by not drawing water twice, but needs a better long term solution. --- indra/newview/pipeline.cpp | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f448983ac2..adad22d0a8 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -787,10 +787,8 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) resY /= res_mod; } - if (LLPipeline::sRenderTransparentWater) - { //water reflection texture - mWaterDis.allocate(resX, resY, GL_RGBA16F, true); - } + //water reflection texture (always needed as scratch space whether or not transparent water is enabled) + mWaterDis.allocate(resX, resY, GL_RGBA16F, true); if (RenderUIBuffer) { @@ -8239,7 +8237,6 @@ void LLPipeline::doAtmospherics() if (RenderDeferredAtmospheric) { - if (!sUnderWaterRender) { // copy depth buffer for use in haze shader (use water displacement map as temp storage) LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); @@ -8274,7 +8271,7 @@ void LLPipeline::doAtmospherics() LLGLSLShader& haze_shader = gHazeProgram; LL_PROFILE_GPU_ZONE("haze"); - bindDeferredShader(haze_shader, nullptr, sUnderWaterRender ? nullptr : &mWaterDis); + bindDeferredShader(haze_shader, nullptr, &mWaterDis); LLEnvironment& environment = LLEnvironment::instance(); haze_shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0); @@ -8300,6 +8297,32 @@ void LLPipeline::doWaterHaze() if (RenderDeferredAtmospheric) { + // copy depth buffer for use in haze shader (use water displacement map as temp storage) + { + LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); + + LLRenderTarget& src = gPipeline.mRT->screen; + LLRenderTarget& depth_src = gPipeline.mRT->deferredScreen; + LLRenderTarget& dst = gPipeline.mWaterDis; + + mRT->screen.flush(); + dst.bindTarget(); + gCopyDepthProgram.bind(); + + S32 diff_map = gCopyDepthProgram.getTextureChannel(LLShaderMgr::DIFFUSE_MAP); + S32 depth_map = gCopyDepthProgram.getTextureChannel(LLShaderMgr::DEFERRED_DEPTH); + + gGL.getTexUnit(diff_map)->bind(&src); + gGL.getTexUnit(depth_map)->bind(&depth_src, true); + + gGL.setColorMask(false, false); + gPipeline.mScreenTriangleVB->setBuffer(); + gPipeline.mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); + + dst.flush(); + mRT->screen.bindTarget(); + } + LLGLEnable blend(GL_BLEND); gGL.blendFunc(LLRender::BF_ONE, LLRender::BF_SOURCE_ALPHA, LLRender::BF_ZERO, LLRender::BF_SOURCE_ALPHA); @@ -8309,7 +8332,7 @@ void LLPipeline::doWaterHaze() LLGLSLShader& haze_shader = gHazeWaterProgram; LL_PROFILE_GPU_ZONE("haze"); - bindDeferredShader(haze_shader); + bindDeferredShader(haze_shader, nullptr, &mWaterDis); haze_shader.uniform4fv(LLShaderMgr::WATER_WATERPLANE, 1, LLDrawPoolAlpha::sWaterPlane.mV); -- cgit v1.2.3 From 60196f6ab3697c5b6cff6b2c856449d94d56ddee Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Wed, 13 Dec 2023 12:47:04 -0600 Subject: SL-20611 Followup -- fix for impostors being invisible. --- indra/newview/pipeline.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index adad22d0a8..3a1edb0d00 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8235,6 +8235,11 @@ void LLPipeline::doAtmospherics() { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; + if (sImpostorRender) + { // do not attempt atmospherics on impostors + return; + } + if (RenderDeferredAtmospheric) { { @@ -8294,6 +8299,10 @@ void LLPipeline::doAtmospherics() void LLPipeline::doWaterHaze() { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; + if (sImpostorRender) + { // do not attempt water haze on impostors + return; + } if (RenderDeferredAtmospheric) { -- cgit v1.2.3 From f43e4c6253e14309ceffbe215a7f03b49b7215e8 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 19 Dec 2023 10:20:37 -0600 Subject: SL-20611 Followup -- fix for water haze artifacts on fullbright objects above water. --- indra/newview/pipeline.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 3a1edb0d00..f740fa60be 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8359,7 +8359,7 @@ void LLPipeline::doWaterHaze() else { //render water patches like LLDrawPoolWater does - LLGLDepthTest depth(GL_FALSE); + LLGLDepthTest depth(GL_TRUE, GL_FALSE); LLGLDisable cull(GL_CULL_FACE); gGLLastMatrix = NULL; -- cgit v1.2.3