summaryrefslogtreecommitdiff
path: root/indra/newview/pipeline.cpp
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-11-09 18:31:29 +0000
committerGraham Linden <graham@lindenlab.com>2018-11-09 18:31:29 +0000
commitdb270df7cc00c1e2519749831e7e98c2c10e3ee6 (patch)
tree7638f00884b1b2ec7ee4d08159ddcb967db9a928 /indra/newview/pipeline.cpp
parent2929998982f37221a58b9fa8037748a2e905f4b1 (diff)
Back out changes causing broken shadows and other render shenanigans.
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r--indra/newview/pipeline.cpp155
1 files changed, 63 insertions, 92 deletions
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