summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl3
-rw-r--r--indra/newview/pipeline.cpp43
3 files changed, 31 insertions, 18 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
index 1b868aee8d..004190dbd9 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
@@ -34,6 +34,7 @@ out vec4 frag_color;
#endif
uniform sampler2D diffuseRect;
+uniform sampler2D depthMap;
uniform vec2 screen_res;
VARYING vec2 vary_fragcoord;
@@ -43,5 +44,7 @@ void main()
vec4 diff = texture2D(diffuseRect, vary_fragcoord.xy);
frag_color = diff;
+
+ gl_FragDepth = texture(depthMap, vary_fragcoord.xy).r;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
index 3b25a5df16..e578bb6fc5 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
@@ -30,7 +30,6 @@
out vec4 frag_color;
uniform sampler2D diffuseRect;
-uniform sampler2D depthMap;
uniform sampler2D emissiveRect;
in vec2 tc;
@@ -38,6 +37,4 @@ in vec2 tc;
void main()
{
frag_color = texture2D(diffuseRect, tc) + texture2D(emissiveRect, tc);
-
- gl_FragDepth = texture(depthMap, tc).r;
}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 3e9a1bb353..f7882b98ba 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -7239,6 +7239,13 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst) {
mRT->fxaaBuffer.bindTexture(0, channel, LLTexUnit::TFO_BILINEAR);
}
+ gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
+ gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
+ gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
+ gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
+
+ glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
+
F32 scale_x = (F32)width / mRT->fxaaBuffer.getWidth();
F32 scale_y = (F32)height / mRT->fxaaBuffer.getHeight();
shader->uniform2f(LLShaderMgr::FXAA_TC_SCALE, scale_x, scale_y);
@@ -7273,14 +7280,10 @@ void LLPipeline::copyRenderTarget(LLRenderTarget* src, LLRenderTarget* dst) {
gDeferredPostNoDoFProgram.bind();
- S32 channel = gDeferredPostNoDoFProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage());
- if (channel > -1)
- {
- src->bindTexture(0, channel, LLTexUnit::TFO_BILINEAR);
- }
+ gDeferredPostNoDoFProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src);
+ gDeferredPostNoDoFProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true);
{
- LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS);
mScreenTriangleVB->setBuffer();
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
}
@@ -7296,12 +7299,10 @@ void LLPipeline::combineGlow(LLRenderTarget* src, LLRenderTarget* dst) {
dst->bindTarget();
{
- LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS);
gGlowCombineProgram.bind();
gGlowCombineProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src);
- gGlowCombineProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true);
gGlowCombineProgram.bindTexture(LLShaderMgr::DEFERRED_EMISSIVE, &mGlow[1]);
mScreenTriangleVB->setBuffer();
@@ -7455,6 +7456,7 @@ void LLPipeline::renderDoF(LLRenderTarget* src, LLRenderTarget* dst) {
{ // perform DoF sampling at half-res (preserve alpha channel)
src->bindTarget();
glViewport(0, 0, dof_width, dof_height);
+
gGL.setColorMask(true, false);
gDeferredPostProgram.bind();
@@ -7476,7 +7478,16 @@ void LLPipeline::renderDoF(LLRenderTarget* src, LLRenderTarget* dst) {
{ // combine result based on alpha
dst->bindTarget();
- glViewport(0, 0, dst->getWidth(), dst->getHeight());
+ if (RenderFSAASamples > 1 && mRT->fxaaBuffer.isComplete()) {
+ glViewport(0, 0, dst->getWidth(), dst->getHeight());
+ }
+ else {
+ gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
+ gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
+ gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
+ gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
+ glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
+ }
gDeferredDoFCombineProgram.bind();
gDeferredDoFCombineProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, LLTexUnit::TFO_POINT);
@@ -7542,21 +7553,23 @@ void LLPipeline::renderFinalize()
combineGlow(&mPostMap, &mRT->screen);
+ gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
+ gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
+ gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
+ gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
+ glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
+
renderDoF(&mRT->screen, &mPostMap);
applyFXAA(&mPostMap, &mRT->screen);
-
// Present the screen target.
gDeferredPostNoDoFProgram.bind();
// Whatever is last in the above post processing chain should _always_ be rendered directly here. If not, expect problems.
- S32 channel = gDeferredPostNoDoFProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mRT->screen.getUsage());
- if (channel > -1)
- {
- mRT->screen.bindTexture(0, channel, LLTexUnit::TFO_BILINEAR);
- }
+ gDeferredPostNoDoFProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, &mRT->screen);
+ gDeferredPostNoDoFProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true);
{
LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS);