diff options
author | Dave Parks <davep@lindenlab.com> | 2011-09-29 23:03:20 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-09-29 23:03:20 -0500 |
commit | eadb745c593900ce50d3e081b365a073f21cb421 (patch) | |
tree | 38ace9451572959f9f2c7bd6e3d59ef74d8d0aa5 /indra/newview/pipeline.cpp | |
parent | 754ce2be40ed53e8f925c21879305c9749adeb0d (diff) |
SH-2465 Move FXAA to its own pass independent of DoF (also removes the need to reload shaders when toggling FSAA on and off)
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r-- | indra/newview/pipeline.cpp | 57 |
1 files changed, 34 insertions, 23 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 2bbb2edc1a..db9675650a 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6358,8 +6358,39 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) gGL.vertex2f(3,-1); gGL.end(); + gGL.flush(); + gGlowCombineFXAAProgram.unbind(); mFXAABuffer.flush(); + + mScreen.bindTarget(); + LLGLSLShader* shader = &gFXAAProgram; + shader->bind(); + + S32 channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP, mFXAABuffer.getUsage()); + if (channel > -1) + { + mFXAABuffer.bindTexture(0, channel); + gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); + } + + + F32 scale_x = (F32) width/mFXAABuffer.getWidth(); + F32 scale_y = (F32) height/mFXAABuffer.getHeight(); + shader->uniform2f("tc_scale", scale_x, scale_y); + shader->uniform2f("rcp_screen_res", 1.f/width*scale_x, 1.f/height*scale_y); + shader->uniform4f("rcp_frame_opt", -0.5f/width*scale_x, -0.5f/height*scale_y, 0.5f/width*scale_x, 0.5f/height*scale_y); + shader->uniform4f("rcp_frame_opt2", -2.f/width*scale_x, -2.f/height*scale_y, 2.f/width*scale_x, 2.f/height*scale_y); + + gGL.begin(LLRender::TRIANGLE_STRIP); + gGL.vertex2f(-1,-1); + gGL.vertex2f(-1,3); + gGL.vertex2f(3,-1); + gGL.end(); + + gGL.flush(); + mScreen.flush(); + shader->unbind(); } gViewerWindow->setup3DViewport(); @@ -6382,13 +6413,6 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) S32 width = mScreen.getWidth(); S32 height = mScreen.getHeight(); - F32 scale_x = (F32) width/mFXAABuffer.getWidth(); - F32 scale_y = (F32) height/mFXAABuffer.getHeight(); - shader->uniform2f("tc_scale", scale_x, scale_y); - shader->uniform2f("rcp_screen_res", 1.f/width*scale_x, 1.f/height*scale_y); - shader->uniform4f("rcp_frame_opt", -0.5f/width*scale_x, -0.5f/height*scale_y, 0.5f/width*scale_x, 0.5f/height*scale_y); - shader->uniform4f("rcp_frame_opt2", -2.f/width*scale_x, -2.f/height*scale_y, 2.f/width*scale_x, 2.f/height*scale_y); - if (dof_enabled) { //depth of field focal plane calculations @@ -6501,24 +6525,11 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) shader->uniform1f("magnification", magnification); } - if (multisample) - { - S32 channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP, mFXAABuffer.getUsage()); - if (channel > -1) - { - mFXAABuffer.bindTexture(0, channel); - gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); - } - } - else + S32 channel = shader->enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage()); + if (channel > -1) { - S32 channel = shader->enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage()); - if (channel > -1) - { - mScreen.bindTexture(0, channel); - } + mScreen.bindTexture(0, channel); } - gGL.begin(LLRender::TRIANGLE_STRIP); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); |