summaryrefslogtreecommitdiff
path: root/indra/newview/pipeline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r--indra/newview/pipeline.cpp58
1 files changed, 52 insertions, 6 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 7a5443825d..7b72d7f987 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -849,6 +849,13 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
mSceneMap.allocate(resX, resY, GL_RGB, true);
}
+ mPostMap.allocate(resX, resY, GL_RGBA);
+
+ mExposureMap.allocate(1, 1, GL_R16F);
+ mExposureMap.bindTarget();
+ mExposureMap.clear();
+ mExposureMap.flush();
+
//HACK make screenbuffer allocations start failing after 30 seconds
if (gSavedSettings.getBOOL("SimulateFBOFailure"))
{
@@ -1079,6 +1086,10 @@ void LLPipeline::releaseGLBuffers()
mSceneMap.release();
+ mExposureMap.release();
+
+ mPostMap.release();
+
for (U32 i = 0; i < 3; i++)
{
mGlow[i].release();
@@ -7393,7 +7404,36 @@ void LLPipeline::renderFinalize()
dst.flush();
}
- screenTarget()->bindTarget();
+ // exposure sample
+ {
+ LL_PROFILE_GPU_ZONE("exposure sample");
+ mExposureMap.bindTarget();
+
+ LLGLDepthTest depth(GL_FALSE, GL_FALSE);
+ LLGLEnable blend(GL_BLEND);
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
+
+ gExposureProgram.bind();
+
+ S32 channel = 0;
+ channel = gExposureProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, screenTarget()->getUsage());
+ if (channel > -1)
+ {
+ screenTarget()->bindTexture(0, channel, LLTexUnit::TFO_POINT);
+ }
+
+ static LLStaticHashedString dt("dt");
+ gExposureProgram.uniform1f(dt, gFrameIntervalSeconds);
+
+ mScreenTriangleVB->setBuffer();
+ mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+
+ gGL.getTexUnit(channel)->unbind(screenTarget()->getUsage());
+ gExposureProgram.unbind();
+ mExposureMap.flush();
+ }
+
+ mPostMap.bindTarget();
// gamma correct lighting
{
@@ -7420,6 +7460,12 @@ void LLPipeline::renderFinalize()
mGlow[1].bindTexture(0, channel, LLTexUnit::TFO_BILINEAR);
}
+ channel = gDeferredPostGammaCorrectProgram.enableTexture(LLShaderMgr::EXPOSURE_MAP, mExposureMap.getUsage());
+ if (channel > -1)
+ {
+ mExposureMap.bindTexture(0, channel);
+ }
+
gDeferredPostGammaCorrectProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, screenTarget()->getWidth(), screenTarget()->getHeight());
static LLCachedControl<F32> exposure(gSavedSettings, "RenderExposure", 1.f);
@@ -7437,7 +7483,7 @@ void LLPipeline::renderFinalize()
gDeferredPostGammaCorrectProgram.unbind();
}
- screenTarget()->flush();
+ mPostMap.flush();
LLVertexBuffer::unbind();
}
@@ -7466,10 +7512,10 @@ void LLPipeline::renderFinalize()
shader->bind();
shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, width, height);
- channel = shader->enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, screenTarget()->getUsage());
+ channel = shader->enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mPostMap.getUsage());
if (channel > -1)
{
- screenTarget()->bindTexture(0, channel);
+ mPostMap.bindTexture(0, channel);
}
{
@@ -7480,7 +7526,7 @@ void LLPipeline::renderFinalize()
gGL.flush();
- shader->disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, screenTarget()->getUsage());
+ shader->disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mPostMap.getUsage());
shader->unbind();
mRT->fxaaBuffer.flush();
@@ -7535,7 +7581,7 @@ void LLPipeline::renderFinalize()
S32 screen_channel = shader->getTextureChannel(LLShaderMgr::DEFERRED_DIFFUSE);
S32 depth_channel = shader->getTextureChannel(LLShaderMgr::DEFERRED_DEPTH);
- gGL.getTexUnit(screen_channel)->bind(screenTarget());
+ gGL.getTexUnit(screen_channel)->bind(&mPostMap);
gGL.getTexUnit(depth_channel)->bind(&mRT->deferredScreen, true);
gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;