From 250ab43e4e70ccd9218d32c5dcbde35599c9735b Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 19 Oct 2011 17:41:02 -0500 Subject: SH-2571 Add shader driven render for low detail terrain. --- indra/newview/llappviewer.cpp | 5 +-- indra/newview/lldrawpoolterrain.cpp | 69 ++++++++++++++++++++++++----------- indra/newview/llfloaterpreference.cpp | 12 +----- 3 files changed, 51 insertions(+), 35 deletions(-) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 31a2ff33f2..2ef55e8a49 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -773,10 +773,7 @@ bool LLAppViewer::init() LLViewerAssetStatsFF::init(); } - // init main thread's local data pool before initializing the threads - Nyx - LLThreadLocalData::init(); - - initThreads(); + initThreads(); LL_INFOS("InitInfo") << "Threads initialized." << LL_ENDL ; // Initialize settings early so that the defaults for ignorable dialogs are diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index d503d935d0..e14d0c5f9d 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -122,14 +122,7 @@ U32 LLDrawPoolTerrain::getVertexDataMask() void LLDrawPoolTerrain::prerender() { mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT); - if (mVertexShaderLevel > 0) - { - sDetailMode = 1; - } - else - { - sDetailMode = gSavedSettings.getS32("RenderTerrainDetail"); - } + sDetailMode = gSavedSettings.getS32("RenderTerrainDetail"); } void LLDrawPoolTerrain::beginRenderPass( S32 pass ) @@ -137,9 +130,24 @@ void LLDrawPoolTerrain::beginRenderPass( S32 pass ) LLFastTimer t(FTM_RENDER_TERRAIN); LLFacePool::beginRenderPass(pass); - sShader = LLPipeline::sUnderWaterRender ? - &gTerrainWaterProgram : - &gTerrainProgram; + if (sDetailMode > 0) + { + sShader = LLPipeline::sUnderWaterRender ? + &gTerrainWaterProgram : + &gTerrainProgram; + } + else + { + if (LLPipeline::sUnderWaterRender) + { + sShader = &gObjectSimpleNonIndexedTexGenWaterProgram; + } + else + { + sShader = &gObjectSimpleNonIndexedTexGenProgram; + } + } + if (mVertexShaderLevel > 1 && sShader->mShaderLevel > 0) { @@ -200,7 +208,15 @@ void LLDrawPoolTerrain::render(S32 pass) if (mVertexShaderLevel > 1 && sShader->mShaderLevel > 0) { gPipeline.enableLightsDynamic(); - renderFullShader(); + + if (sDetailMode > 0) + { + renderFullShader(); + } + else + { + renderSimple(); + } } else { @@ -827,13 +843,21 @@ void LLDrawPoolTerrain::renderSimple() tp0.setVec(tscale, 0.f, 0.0f, -1.f*(origin_agent.mV[0]/256.f)); tp1.setVec(0.f, tscale, 0.0f, -1.f*(origin_agent.mV[1]/256.f)); - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_GEN_T); - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); - glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - + if (LLGLSLShader::sNoFixedFunction) + { + sShader->uniform4fv("object_plane_s", 1, tp0.mV); + sShader->uniform4fv("object_plane_t", 1, tp1.mV); + } + else + { + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_GEN_T); + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); + glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); + } + gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR); drawLoop(); @@ -843,8 +867,11 @@ void LLDrawPoolTerrain::renderSimple() gGL.getTexUnit(0)->activate(); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - glDisable(GL_TEXTURE_GEN_S); - glDisable(GL_TEXTURE_GEN_T); + if (!LLGLSLShader::sNoFixedFunction) + { + glDisable(GL_TEXTURE_GEN_S); + glDisable(GL_TEXTURE_GEN_T); + } gGL.matrixMode(LLRender::MM_TEXTURE); gGL.loadIdentity(); gGL.matrixMode(LLRender::MM_MODELVIEW); diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 7f6d0155e2..92c4214fdb 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1039,16 +1039,8 @@ void LLFloaterPreference::refreshEnabledState() BOOL shaders = gGLManager.mGLVersion >= 2.f; - if (shaders) - { - mRadioTerrainDetail->setValue(1); - mRadioTerrainDetail->setEnabled(FALSE); - } - else - { - mRadioTerrainDetail->setEnabled(TRUE); - } - + mRadioTerrainDetail->setEnabled(TRUE); + // WindLight LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); -- cgit v1.2.3