summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-10-19 17:41:02 -0500
committerDave Parks <davep@lindenlab.com>2011-10-19 17:41:02 -0500
commit250ab43e4e70ccd9218d32c5dcbde35599c9735b (patch)
tree7556da6f559475774d630f4266de00f602e43f21 /indra/newview
parentf19f43c74606e1f158cdabe9e783f9c82386b7b7 (diff)
SH-2571 Add shader driven render for low detail terrain.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewer.cpp5
-rw-r--r--indra/newview/lldrawpoolterrain.cpp69
-rwxr-xr-xindra/newview/llfloaterpreference.cpp12
3 files changed, 51 insertions, 35 deletions
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<LLCheckBoxCtrl>("WindLightUseAtmosShaders");