diff options
Diffstat (limited to 'indra/newview/lldrawpoolwater.cpp')
-rw-r--r-- | indra/newview/lldrawpoolwater.cpp | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 576024ead3..0b9bca06db 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -117,16 +117,33 @@ S32 LLDrawPoolWater::getNumPasses() return 0; } +S32 LLDrawPoolWater::getNumPostDeferredPasses() +{ + return 1; +} + void LLDrawPoolWater::beginPostDeferredPass(S32 pass) { - beginRenderPass(pass); - deferred_render = TRUE; + // copy framebuffer contents so far to a texture to be used for + // reflections and refractions + LLRenderTarget& src = gPipeline.mRT->screen; + LLRenderTarget& dst = gPipeline.mWaterDis; + 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); } -void LLDrawPoolWater::endPostDeferredPass(S32 pass) +void LLDrawPoolWater::renderPostDeferred(S32 pass) { - endRenderPass(pass); - deferred_render = FALSE; + renderWater(); +} + + +S32 LLDrawPoolWater::getNumDeferredPasses() +{ + return 0; } //=============================== @@ -152,6 +169,7 @@ void LLDrawPoolWater::renderDeferred(S32 pass) void LLDrawPoolWater::render(S32 pass) { +#if 0 LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_WATER); if (mDrawFace.empty() || LLDrawable::getCurrentFrame() <= 1) { @@ -323,11 +341,13 @@ void LLDrawPoolWater::render(S32 pass) glStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFF); renderReflection(refl_face); } +#endif } // for low end hardware void LLDrawPoolWater::renderOpaqueLegacyWater() { +#if 0 LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; LLVOSky *voskyp = gSky.mVOSkyp; @@ -432,11 +452,13 @@ void LLDrawPoolWater::renderOpaqueLegacyWater() } gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); +#endif } void LLDrawPoolWater::renderReflection(LLFace* face) { +#if 0 LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; LLVOSky *voskyp = gSky.mVOSkyp; @@ -462,6 +484,7 @@ void LLDrawPoolWater::renderReflection(LLFace* face) LLOverrideFaceColor override(this, LLColor4(face->getFaceColor().mV)); face->renderIndexed(); +#endif } void LLDrawPoolWater::renderWater() @@ -535,7 +558,8 @@ void LLDrawPoolWater::renderWater() shader = deferred_render ? &gDeferredWaterProgram : &gWaterProgram; } } - shader->bind(); + + gPipeline.bindDeferredShader(*shader); // bind textures for water rendering S32 reftex = shader->enableTexture(LLShaderMgr::WATER_REFTEX); @@ -576,6 +600,8 @@ void LLDrawPoolWater::renderWater() // bind reflection texture from RenderTarget S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX); + S32 screenDepth = shader->enableTexture(LLShaderMgr::WATER_SCREENDEPTH); + F32 screenRes[] = {1.f / gGLViewport[2], 1.f / gGLViewport[3]}; S32 diffTex = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP); @@ -602,6 +628,11 @@ void LLDrawPoolWater::renderWater() gGL.getTexUnit(screentex)->bind(&gPipeline.mWaterDis); } + if (screenDepth > -1) + { + gGL.getTexUnit(screenDepth)->bind(&gPipeline.mWaterDis, true); + } + if (mShaderLevel == 1) { fog_color.mV[VW] = log(fog_density) / log(2); @@ -683,7 +714,8 @@ void LLDrawPoolWater::renderWater() shader->disableTexture(LLShaderMgr::WATER_SCREENDEPTH); // clean up - shader->unbind(); + gPipeline.unbindDeferredShader(*shader); + gGL.getTexUnit(bumpTex)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(bumpTex2)->unbind(LLTexUnit::TT_TEXTURE); } |