From db270df7cc00c1e2519749831e7e98c2c10e3ee6 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 9 Nov 2018 18:31:29 +0000 Subject: Back out changes causing broken shadows and other render shenanigans. --- indra/newview/pipeline.cpp | 155 ++++++++++++++++++--------------------------- 1 file changed, 63 insertions(+), 92 deletions(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index bac6267bbd..e605f5b420 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -951,7 +951,8 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) { for (U32 i = 0; i < 4; i++) { - releaseShadowTarget(i); + mShadow[i].release(); + mShadowOcclusion[i].release(); } } @@ -989,7 +990,8 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) { for (U32 i = 4; i < 6; i++) { - releaseShadowTarget(i); + mShadow[i].release(); + mShadowOcclusion[i].release(); } } @@ -1003,7 +1005,11 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) { mDeferredLight.release(); - releaseShadowTargets(); + for (U32 i = 0; i < 6; i++) + { + mShadow[i].release(); + mShadowOcclusion[i].release(); + } mFXAABuffer.release(); mScreen.release(); mDeferredScreen.release(); //make sure to release any render targets that share a depth buffer with mDeferredScreen first @@ -1200,7 +1206,11 @@ void LLPipeline::releaseScreenBuffers() mDeferredLight.release(); mOcclusionDepth.release(); - releaseShadowTargets(); + for (U32 i = 0; i < 6; i++) + { + mShadow[i].release(); + mShadowOcclusion[i].release(); + } mInscatter.release(); } @@ -8316,24 +8326,20 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n for (U32 i = 0; i < 4; i++) { - LLRenderTarget* shadow_target = getShadowTarget(i); - if (shadow_target) - { - channel = shader.enableTexture(LLShaderMgr::DEFERRED_SHADOW0+i, LLTexUnit::TT_TEXTURE); - stop_glerror(); - if (channel > -1) - { - stop_glerror(); - gGL.getTexUnit(channel)->bind(getShadowTarget(i), TRUE); - gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); - gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); - stop_glerror(); + channel = shader.enableTexture(LLShaderMgr::DEFERRED_SHADOW0+i, LLTexUnit::TT_TEXTURE); + stop_glerror(); + if (channel > -1) + { + stop_glerror(); + gGL.getTexUnit(channel)->bind(&mShadow[i], TRUE); + gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); + gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); + stop_glerror(); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL); - stop_glerror(); - } - } + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL); + stop_glerror(); + } } for (U32 i = 4; i < 6; i++) @@ -8343,36 +8349,17 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n if (channel > -1) { stop_glerror(); - LLRenderTarget* shadow_target = getShadowTarget(i); - if (shadow_target) - { - gGL.getTexUnit(channel)->bind(shadow_target, TRUE); - gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); - gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); - stop_glerror(); + gGL.getTexUnit(channel)->bind(&mShadow[i], TRUE); + gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); + gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); + stop_glerror(); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL); - stop_glerror(); - } + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL); + stop_glerror(); } } - /*channel = shader.enableTexture(LLShaderMgr::INSCATTER_RT, LLTexUnit::TT_TEXTURE); - stop_glerror(); - if (channel > -1) - { - stop_glerror(); - gGL.getTexUnit(channel)->bind(&mInscatter, TRUE); - gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); - gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); - stop_glerror(); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_ALWAYS); - stop_glerror(); - }*/ - stop_glerror(); F32 mat[16*6]; @@ -10862,13 +10849,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera) for (S32 j = 0; j < 4; j++) { - LLRenderTarget* shadow_target = getShadowTarget(j); - if (shadow_target) - { - shadow_target->bindTarget(); - shadow_target->clear(); - shadow_target->flush(); - } + mShadow[j].bindTarget(); + mShadow[j].clear(); + mShadow[j].flush(); } } else @@ -10934,16 +10917,12 @@ void LLPipeline::generateSunShadow(LLCamera& camera) mShadowCamera[j+4] = shadow_cam; } - LLRenderTarget* shadow_target = getShadowTarget(j); - if (shadow_target) - { - shadow_target->bindTarget(); - { - LLGLDepthTest depth(GL_TRUE); - shadow_target->clear(); - } - shadow_target->flush(); - } + mShadow[j].bindTarget(); + { + LLGLDepthTest depth(GL_TRUE); + mShadow[j].clear(); + } + mShadow[j].flush(); mShadowError.mV[j] = 0.f; mShadowFOV.mV[j] = 0.f; @@ -11232,24 +11211,20 @@ void LLPipeline::generateSunShadow(LLCamera& camera) stop_glerror(); - LLRenderTarget* shadow_target = getShadowTarget(j); - - if (shadow_target) - { - shadow_target->bindTarget(); - shadow_target->getViewport(gGLViewport); - shadow_target->clear(); - - U32 target_width = shadow_target->getWidth(); + mShadow[j].bindTarget(); + mShadow[j].getViewport(gGLViewport); + mShadow[j].clear(); + + U32 target_width = mShadow[j].getWidth(); - { - static LLCullResult result[4]; - renderShadow(view[j], proj[j], shadow_cam, result[j], TRUE, TRUE, target_width); - } + { + static LLCullResult result[4]; - shadow_target->flush(); - } + renderShadow(view[j], proj[j], shadow_cam, result[j], TRUE, TRUE, target_width); + } + mShadow[j].flush(); + if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) { LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE); @@ -11382,23 +11357,19 @@ void LLPipeline::generateSunShadow(LLCamera& camera) stop_glerror(); - LLRenderTarget* shadow_target = getShadowTarget(i + 4); + mShadow[i+4].bindTarget(); + mShadow[i+4].getViewport(gGLViewport); + mShadow[i+4].clear(); - if (shadow_target) - { - shadow_target->bindTarget(); - shadow_target->getViewport(gGLViewport); - shadow_target->clear(); - - U32 target_width = shadow_target->getWidth(); + U32 target_width = mShadow[i+4].getWidth(); - static LLCullResult result[2]; - LLViewerCamera::sCurCameraID = (LLViewerCamera::eCameraID)(LLViewerCamera::CAMERA_SHADOW0 + i + 4); + static LLCullResult result[2]; - renderShadow(view[i+4], proj[i+4], shadow_cam, result[i], FALSE, FALSE, target_width); + LLViewerCamera::sCurCameraID = (LLViewerCamera::eCameraID)(LLViewerCamera::CAMERA_SHADOW0 + i + 4); - shadow_target->flush(); - } + renderShadow(view[i+4], proj[i+4], shadow_cam, result[i], FALSE, FALSE, target_width); + + mShadow[i+4].flush(); } } else -- cgit v1.2.3