summaryrefslogtreecommitdiff
path: root/indra/newview/pipeline.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-08-27 01:30:31 -0500
committerDave Parks <davep@lindenlab.com>2011-08-27 01:30:31 -0500
commit7ee10ae1def26708fa44c25355982aa56195d5f9 (patch)
treede1f7b1741c6733915128c89b54d5cdcbf45421e /indra/newview/pipeline.cpp
parentc8b8b153f14b65fa7d833d787df6c03539eb85a8 (diff)
SH-2242 Remove old multisample shaders and make FXAA turn itself off when FSAA is disabled.
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r--indra/newview/pipeline.cpp43
1 files changed, 30 insertions, 13 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 8d5bc22e6f..d9fa4881e7 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -592,11 +592,6 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY)
{
U32 samples = gGLManager.getNumFBOFSAASamples(gSavedSettings.getU32("RenderFSAASamples"));
- if (gGLManager.mIsATI)
- { //ATI doesn't like the way we use multisample texture
- samples = 0;
- }
-
//try to allocate screen buffers at requested resolution and samples
// - on failure, shrink number of samples and try again
// - if not multisampled, shrink resolution and try again (favor X resolution over Y)
@@ -673,7 +668,14 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
if (!addDeferredAttachments(mDeferredScreen)) return false;
if (!mScreen.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
- if (!mFXAABuffer.allocate(nhpo2(resX), nhpo2(resY), GL_RGBA, FALSE, FALSE, LLTexUnit::TT_TEXTURE, FALSE, samples)) return false;
+ if (samples > 0)
+ {
+ if (!mFXAABuffer.allocate(nhpo2(resX), nhpo2(resY), GL_RGBA, FALSE, FALSE, LLTexUnit::TT_TEXTURE, FALSE, samples)) return false;
+ }
+ else
+ {
+ mFXAABuffer.release();
+ }
#if LL_DARWIN
// As of OS X 10.6.7, Apple doesn't support multiple color formats in a single FBO
@@ -6322,6 +6324,9 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
if (LLPipeline::sRenderDeferred)
{
bool dof_enabled = !LLViewerCamera::getInstance()->cameraUnderWater();
+ bool multisample = gSavedSettings.getU32("RenderFSAASamples") > 1;
+
+ if (multisample)
{
//bake out texture2D with RGBL for FXAA shader
mFXAABuffer.bindTarget();
@@ -6344,8 +6349,9 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
gGlowCombineFXAAProgram.unbind();
mFXAABuffer.flush();
- gViewerWindow->setup3DViewport();
}
+
+ gViewerWindow->setup3DViewport();
LLGLSLShader* shader = &gDeferredPostProgram;
if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_DEFERRED) > 2)
@@ -6358,8 +6364,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
shader = &gDeferredPostNoDoFProgram;
dof_enabled = false;
}
-
-
+
LLGLDisable blend(GL_BLEND);
bindDeferredShader(*shader);
@@ -6485,12 +6490,24 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
shader->uniform1f("magnification", magnification);
}
- S32 channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP, mFXAABuffer.getUsage());
- if (channel > -1)
+ if (multisample)
{
- mFXAABuffer.bindTexture(0, channel);
- gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
+ 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)
+ {
+ mScreen.bindTexture(0, channel);
+ }
+ }
+
gGL.begin(LLRender::TRIANGLE_STRIP);
gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);