summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpoolwater.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2023-01-09 18:12:54 -0600
committerDave Parks <davep@lindenlab.com>2023-01-09 18:12:54 -0600
commita2d17d3c1e5a62f10ab3922b6b12f909f1cd4682 (patch)
tree1010a8f928b2e25bd06cff12b83c9b8be39cd9b0 /indra/newview/lldrawpoolwater.cpp
parenta710bf9067bd4c4217b9febc0ad277a1636ec882 (diff)
SL-18869 Optimizations -- Decruftify LLRenderTarget, use a shader to copy color/depth instead of glCopyTexSubImage or glBlitFrameBuffer
Diffstat (limited to 'indra/newview/lldrawpoolwater.cpp')
-rw-r--r--indra/newview/lldrawpoolwater.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index 77da29061d..c2fe52683b 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -133,11 +133,28 @@ void LLDrawPoolWater::beginPostDeferredPass(S32 pass)
// reflections and refractions
LLRenderTarget& src = gPipeline.mRT->screen;
LLRenderTarget& dst = gPipeline.mWaterDis;
+
+#if 0
dst.copyContents(src,
0, 0, src.getWidth(), src.getHeight(),
0, 0, dst.getWidth(), dst.getHeight(),
GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT,
GL_NEAREST);
+#else
+ dst.bindTarget();
+ gCopyDepthProgram.bind();
+
+ S32 diff_map = gCopyDepthProgram.enableTexture(LLShaderMgr::DIFFUSE_MAP);
+ S32 depth_map = gCopyDepthProgram.enableTexture(LLShaderMgr::DEFERRED_DEPTH);
+
+ gGL.getTexUnit(diff_map)->bind(&src);
+ gGL.getTexUnit(depth_map)->bind(&src, true);
+
+ gPipeline.mScreenTriangleVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+ gPipeline.mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+
+ dst.flush();
+#endif
}
}