summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorEric Tulla <tulla@lindenlab.com>2008-06-30 17:57:00 +0000
committerEric Tulla <tulla@lindenlab.com>2008-06-30 17:57:00 +0000
commit939a506569433db7bff96c12200f03b3f85f40de (patch)
treec9f308949400b0a4ce00c82a6a33f2868e31a1d1 /indra/newview
parent1a14cd34a9a4e6f51c445d477aaeeef0322d5853 (diff)
Merging in file-move-merge ( QAR-649 )
Result of "svn merge -r 90669:90786 $tulla/file-move-merge ." Be careful of future merges involving changes to any of these moved files as SVN usually does the wrong thing: newview/llglslshader.* -> llrender/llglslshader.*, llrender/llshadermgr.*, newview/llviewershadermgr.* (gets split into 3 separate files) newview/llpostprocess.* -> llrender/llpostprocess.* newview/llrendersphere.* -> llrender/llrendersphere.* newview/llcubemap.* -> llrender/llcubemap.* llwindow/llgl.* -> llrender/llgl.* llwindow/llglstates.h -> llrender/llglstates.h llwindow/llgltypes.h -> llrender/llgltypes.h llwindow/llglheaders.h -> llrender/llglheaders.h
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/CMakeLists.txt10
-rw-r--r--indra/newview/llappviewer.cpp6
-rw-r--r--indra/newview/lldrawpoolalpha.cpp4
-rw-r--r--indra/newview/lldrawpoolavatar.cpp44
-rw-r--r--indra/newview/lldrawpoolbump.cpp30
-rw-r--r--indra/newview/lldrawpoolground.cpp4
-rw-r--r--indra/newview/lldrawpoolsimple.cpp10
-rw-r--r--indra/newview/lldrawpoolsky.cpp4
-rw-r--r--indra/newview/lldrawpoolterrain.cpp24
-rw-r--r--indra/newview/lldrawpooltree.cpp4
-rw-r--r--indra/newview/lldrawpoolwater.cpp52
-rw-r--r--indra/newview/llhudrender.cpp1
-rw-r--r--indra/newview/llviewercamera.cpp12
-rw-r--r--indra/newview/llviewercamera.h7
-rw-r--r--indra/newview/llviewercontrol.cpp4
-rw-r--r--indra/newview/llviewerdisplay.cpp3
-rw-r--r--indra/newview/llviewerjointmesh.cpp4
-rw-r--r--indra/newview/llviewershadermgr.cpp1094
-rw-r--r--indra/newview/llviewershadermgr.h313
-rw-r--r--indra/newview/llvoavatar.cpp10
-rw-r--r--indra/newview/llvosky.cpp4
-rw-r--r--indra/newview/llwaterparammanager.cpp16
-rw-r--r--indra/newview/llwaterparamset.h2
-rw-r--r--indra/newview/llwlparammanager.cpp16
-rw-r--r--indra/newview/llwlparamset.h2
-rw-r--r--indra/newview/pipeline.cpp26
26 files changed, 1547 insertions, 159 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index a1515abf9d..46fb6a6246 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -85,7 +85,6 @@ set(viewer_SOURCE_FILES
llconfirmationmanager.cpp
llconsole.cpp
llcontainerview.cpp
- llcubemap.cpp
llcurrencyuimanager.cpp
llcylinder.cpp
lldebugmessagebox.cpp
@@ -196,7 +195,6 @@ set(viewer_SOURCE_FILES
llgesturemgr.cpp
llgivemoney.cpp
llglsandbox.cpp
- llglslshader.cpp
llgroupmgr.cpp
llgroupnotify.cpp
llhoverview.cpp
@@ -285,7 +283,6 @@ set(viewer_SOURCE_FILES
llpatchvertexarray.cpp
llpolymesh.cpp
llpolymorph.cpp
- llpostprocess.cpp
llprefschat.cpp
llprefsim.cpp
llprefsvoice.cpp
@@ -299,7 +296,6 @@ set(viewer_SOURCE_FILES
llpreviewtexture.cpp
llprogressview.cpp
llregionposition.cpp
- llrendersphere.cpp
llremoteparcelrequest.cpp
llsavedsettingsglue.cpp
llselectmgr.cpp
@@ -385,6 +381,7 @@ set(viewer_SOURCE_FILES
llviewerpartsim.cpp
llviewerpartsource.cpp
llviewerregion.cpp
+ llviewershadermgr.cpp
llviewerstats.cpp
llviewertexteditor.cpp
llviewertextureanim.cpp
@@ -475,7 +472,6 @@ set(viewer_HEADER_FILES
llconfirmationmanager.h
llconsole.h
llcontainerview.h
- llcubemap.h
llcurrencyuimanager.h
llcylinder.h
lldebugmessagebox.h
@@ -586,7 +582,6 @@ set(viewer_HEADER_FILES
llgenepool.h
llgesturemgr.h
llgivemoney.h
- llglslshader.h
llgroupmgr.h
llgroupnotify.h
llhoverview.h
@@ -674,7 +669,6 @@ set(viewer_HEADER_FILES
llpanelweb.h
llparcelselection.h
llpatchvertexarray.h
- llpostprocess.h
llpolymesh.h
llpolymorph.h
llprefschat.h
@@ -691,7 +685,6 @@ set(viewer_HEADER_FILES
llprogressview.h
llregionposition.h
llremoteparcelrequest.h
- llrendersphere.h
llresourcedata.h
llsavedsettingsglue.h
llselectmgr.h
@@ -778,6 +771,7 @@ set(viewer_HEADER_FILES
llviewerpartsource.h
llviewerprecompiledheaders.h
llviewerregion.h
+ llviewershadermgr.h
llviewerstats.h
llviewertexteditor.h
llviewertextureanim.h
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index c040dae469..30634a3f2c 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -408,7 +408,7 @@ bool handleCrashSubmitBehaviorChanged(const LLSD& newvalue)
else if(gSavedSettings.getBOOL("WatchdogEnabled") == TRUE)
{
// Don't re-enable the watchdog when we change the setting; this may get called before it's started
-// LLWatchdog::getInstance()->init();
+// LLWatchdog::getInstance()->init();
}
return true;
}
@@ -459,6 +459,8 @@ static void settings_to_globals()
gMiniMapScale = gSavedSettings.getF32("MiniMapScale");
gHandleKeysAsync = gSavedSettings.getBOOL("AsyncKeyboard");
LLHoverView::sShowHoverTips = gSavedSettings.getBOOL("ShowHoverTips");
+
+ LLCubeMap::sUseCubeMaps = LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap");
}
static void settings_modify()
@@ -2225,7 +2227,7 @@ void LLAppViewer::writeSystemInfo()
gDebugInfo["RAMInfo"]["Physical"] = (LLSD::Integer)(gSysMemory.getPhysicalMemoryKB());
gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer)(gMemoryAllocated>>10); // MB -> KB
gDebugInfo["OSInfo"] = getOSInfo().getOSStringSimple();
-
+
// The user is not logged on yet, but record the current grid choice login url
// which may have been the intended grid. This can b
gDebugInfo["GridName"] = LLViewerLogin::getInstance()->getGridLabel();
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index fe2c2041ae..e7c8903561 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -49,7 +49,7 @@
#include "llviewerobjectlist.h" // For debugging
#include "llviewerwindow.h"
#include "pipeline.h"
-#include "llglslshader.h"
+#include "llviewershadermgr.h"
#include "llviewerregion.h"
#include "lldrawpoolwater.h"
#include "llspatialpartition.h"
@@ -72,7 +72,7 @@ LLDrawPoolAlpha::~LLDrawPoolAlpha()
void LLDrawPoolAlpha::prerender()
{
- mVertexShaderLevel = LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_OBJECT);
+ mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);
}
void LLDrawPoolAlpha::beginRenderPass(S32 pass)
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index 04a7cfd8a0..422c0dc9a8 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -45,7 +45,7 @@
#include "llviewerregion.h"
#include "noise.h"
#include "pipeline.h"
-#include "llglslshader.h"
+#include "llviewershadermgr.h"
#include "llappviewer.h"
static U32 sDataMask = LLDrawPoolAvatar::VERTEX_DATA_MASK;
@@ -107,12 +107,12 @@ BOOL gRenderAvatar = TRUE;
S32 LLDrawPoolAvatar::getVertexShaderLevel() const
{
return sShaderLevel;
- //return (S32) LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_AVATAR);
+ //return (S32) LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_AVATAR);
}
void LLDrawPoolAvatar::prerender()
{
- mVertexShaderLevel = LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_AVATAR);
+ mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_AVATAR);
sShaderLevel = mVertexShaderLevel;
if (sShaderLevel > 0)
@@ -289,16 +289,16 @@ void LLDrawPoolAvatar::beginSkinned()
sVertexProgram->bind();
if (sShaderLevel >= SHADER_LEVEL_CLOTH)
{
- enable_cloth_weights(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_CLOTHING]);
+ enable_cloth_weights(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_CLOTHING]);
}
- enable_vertex_weighting(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_WEIGHT]);
+ enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
if (sShaderLevel >= SHADER_LEVEL_BUMP)
{
- enable_binormals(sVertexProgram->mAttribute[LLShaderMgr::BINORMAL]);
+ enable_binormals(sVertexProgram->mAttribute[LLViewerShaderMgr::BINORMAL]);
}
- sVertexProgram->enableTexture(LLShaderMgr::BUMP_MAP);
+ sVertexProgram->enableTexture(LLViewerShaderMgr::BUMP_MAP);
gGL.getTexUnit(0)->activate();
}
else
@@ -318,16 +318,16 @@ void LLDrawPoolAvatar::endSkinned()
if (sShaderLevel > 0)
{
sRenderingSkinned = FALSE;
- sVertexProgram->disableTexture(LLShaderMgr::BUMP_MAP);
+ sVertexProgram->disableTexture(LLViewerShaderMgr::BUMP_MAP);
gGL.getTexUnit(0)->activate();
- disable_vertex_weighting(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_WEIGHT]);
+ disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
if (sShaderLevel >= SHADER_LEVEL_BUMP)
{
- disable_binormals(sVertexProgram->mAttribute[LLShaderMgr::BINORMAL]);
+ disable_binormals(sVertexProgram->mAttribute[LLViewerShaderMgr::BINORMAL]);
}
if ((sShaderLevel >= SHADER_LEVEL_CLOTH))
{
- disable_cloth_weights(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_CLOTHING]);
+ disable_cloth_weights(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_CLOTHING]);
}
sVertexProgram->unbind();
@@ -466,7 +466,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
if (sShaderLevel > 0)
{
- gAvatarMatrixParam = sVertexProgram->mUniform[LLShaderMgr::AVATAR_MATRIX];
+ gAvatarMatrixParam = sVertexProgram->mUniform[LLViewerShaderMgr::AVATAR_MATRIX];
}
if ((sShaderLevel >= SHADER_LEVEL_CLOTH))
@@ -482,16 +482,16 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
wind = wind * rot_mat;
wind.mV[VW] = avatarp->mWindVec.mV[VW];
- sVertexProgram->vertexAttrib4fv(LLShaderMgr::AVATAR_WIND, wind.mV);
+ sVertexProgram->vertexAttrib4fv(LLViewerShaderMgr::AVATAR_WIND, wind.mV);
F32 phase = -1.f * (avatarp->mRipplePhase);
F32 freq = 7.f + (noise1(avatarp->mRipplePhase) * 2.f);
LLVector4 sin_params(freq, freq, freq, phase);
- sVertexProgram->vertexAttrib4fv(LLShaderMgr::AVATAR_SINWAVE, sin_params.mV);
+ sVertexProgram->vertexAttrib4fv(LLViewerShaderMgr::AVATAR_SINWAVE, sin_params.mV);
LLVector4 gravity(0.f, 0.f, -CLOTHING_GRAVITY_EFFECT, 0.f);
gravity = gravity * rot_mat;
- sVertexProgram->vertexAttrib4fv(LLShaderMgr::AVATAR_GRAVITY, gravity.mV);
+ sVertexProgram->vertexAttrib4fv(LLViewerShaderMgr::AVATAR_GRAVITY, gravity.mV);
}
if( !single_avatar || (avatarp == single_avatar) )
@@ -611,7 +611,7 @@ void LLDrawPoolAvatar::renderForSelect()
sVertexProgram = &gAvatarPickProgram;
if (sShaderLevel > 0)
{
- gAvatarMatrixParam = sVertexProgram->mUniform[LLShaderMgr::AVATAR_MATRIX];
+ gAvatarMatrixParam = sVertexProgram->mUniform[LLViewerShaderMgr::AVATAR_MATRIX];
}
gGL.setAlphaRejectSettings(LLRender::CF_GREATER_EQUAL, 0.2f);
gGL.setSceneBlendType(LLRender::BT_REPLACE);
@@ -622,7 +622,7 @@ void LLDrawPoolAvatar::renderForSelect()
{
sRenderingSkinned = TRUE;
sVertexProgram->bind();
- enable_vertex_weighting(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_WEIGHT]);
+ enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
}
avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE);
@@ -632,7 +632,7 @@ void LLDrawPoolAvatar::renderForSelect()
{
sRenderingSkinned = FALSE;
sVertexProgram->unbind();
- disable_vertex_weighting(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_WEIGHT]);
+ disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
}
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
@@ -670,7 +670,7 @@ LLColor3 LLDrawPoolAvatar::getDebugColor() const
LLVertexBufferAvatar::LLVertexBufferAvatar()
: LLVertexBuffer(sDataMask,
- LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_AVATAR) > 0 ?
+ LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) > 0 ?
GL_STATIC_DRAW_ARB :
GL_STREAM_DRAW_ARB)
{
@@ -692,16 +692,16 @@ void LLVertexBufferAvatar::setupVertexBuffer(U32 data_mask) const
glClientActiveTextureARB(GL_TEXTURE0_ARB);
glTexCoordPointer(2,GL_FLOAT, mStride, (void*)(base + mOffsets[TYPE_TEXCOORD]));
- set_vertex_weights(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_WEIGHT], mStride, (F32*)(base + mOffsets[TYPE_WEIGHT]));
+ set_vertex_weights(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT], mStride, (F32*)(base + mOffsets[TYPE_WEIGHT]));
if (sShaderLevel >= LLDrawPoolAvatar::SHADER_LEVEL_BUMP)
{
- set_binormals(sVertexProgram->mAttribute[LLShaderMgr::BINORMAL], mStride, (LLVector3*)(base + mOffsets[TYPE_BINORMAL]));
+ set_binormals(sVertexProgram->mAttribute[LLViewerShaderMgr::BINORMAL], mStride, (LLVector3*)(base + mOffsets[TYPE_BINORMAL]));
}
if (sShaderLevel >= LLDrawPoolAvatar::SHADER_LEVEL_CLOTH)
{
- set_vertex_clothing_weights(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_CLOTHING], mStride, (LLVector4*)(base + mOffsets[TYPE_CLOTHWEIGHT]));
+ set_vertex_clothing_weights(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_CLOTHING], mStride, (LLVector4*)(base + mOffsets[TYPE_CLOTHWEIGHT]));
}
}
else
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 56dc61c1a3..11391ee6fb 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -53,7 +53,7 @@
#include "llviewerimagelist.h"
#include "pipeline.h"
#include "llspatialpartition.h"
-#include "llglslshader.h"
+#include "llviewershadermgr.h"
//#include "llimagebmp.h"
//#include "../tools/imdebug/imdebug.h"
@@ -177,7 +177,7 @@ LLDrawPoolBump::LLDrawPoolBump()
void LLDrawPoolBump::prerender()
{
- mVertexShaderLevel = LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_OBJECT);
+ mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);
}
// static
@@ -333,7 +333,7 @@ void LLDrawPoolBump::beginShiny(bool invisible)
LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
if( cube_map )
{
- if (!invisible && LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_OBJECT) > 0 )
+ if (!invisible && LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0 )
{
LLMatrix4 mat;
mat.initRows(LLVector4(gGLModelView+0),
@@ -343,23 +343,23 @@ void LLDrawPoolBump::beginShiny(bool invisible)
shader->bind();
LLVector3 vec = LLVector3(gShinyOrigin) * mat;
LLVector4 vec4(vec, gShinyOrigin.mV[3]);
- shader->uniform4fv(LLShaderMgr::SHINY_ORIGIN, 1, vec4.mV);
+ shader->uniform4fv(LLViewerShaderMgr::SHINY_ORIGIN, 1, vec4.mV);
if (mVertexShaderLevel > 1)
{
cube_map->setMatrix(1);
// Make sure that texture coord generation happens for tex unit 1, as that's the one we use for
// the cube map in the one pass shiny shaders
- cube_channel = shader->enableTexture(LLShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB);
+ cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB);
cube_map->enableTexture(cube_channel);
cube_map->enableTextureCoords(1);
- diffuse_channel = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP);
+ diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
}
else
{
cube_channel = 0;
diffuse_channel = -1;
cube_map->setMatrix(0);
- cube_map->enable(shader->enableTexture(LLShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB));
+ cube_map->enable(shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB));
}
cube_map->bind();
}
@@ -423,13 +423,13 @@ void LLDrawPoolBump::endShiny(bool invisible)
if (!invisible && mVertexShaderLevel > 1)
{
- shader->disableTexture(LLShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB);
+ shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB);
- if (LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_OBJECT) > 0)
+ if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0)
{
if (diffuse_channel != 0)
{
- shader->disableTexture(LLShaderMgr::DIFFUSE_MAP);
+ shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
}
}
@@ -483,15 +483,15 @@ void LLDrawPoolBump::beginFullbrightShiny()
shader->bind();
LLVector3 vec = LLVector3(gShinyOrigin) * mat;
LLVector4 vec4(vec, gShinyOrigin.mV[3]);
- shader->uniform4fv(LLShaderMgr::SHINY_ORIGIN, 1, vec4.mV);
+ shader->uniform4fv(LLViewerShaderMgr::SHINY_ORIGIN, 1, vec4.mV);
cube_map->setMatrix(1);
// Make sure that texture coord generation happens for tex unit 1, as that's the one we use for
// the cube map in the one pass shiny shaders
- cube_channel = shader->enableTexture(LLShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB);
+ cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB);
cube_map->enableTexture(cube_channel);
cube_map->enableTextureCoords(1);
- diffuse_channel = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP);
+ diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
cube_map->bind();
}
@@ -531,7 +531,7 @@ void LLDrawPoolBump::endFullbrightShiny()
if (diffuse_channel != 0)
{
- shader->disableTexture(LLShaderMgr::DIFFUSE_MAP);
+ shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
}
gGL.getTexUnit(0)->activate();
glEnable(GL_TEXTURE_2D);
@@ -556,7 +556,7 @@ void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL
for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
{
LLDrawInfo& params = **k;
-
+
applyModelMatrix(params);
params.mVertexBuffer->setBuffer(mask);
diff --git a/indra/newview/lldrawpoolground.cpp b/indra/newview/lldrawpoolground.cpp
index 3500d9471f..c7e8aa32b7 100644
--- a/indra/newview/lldrawpoolground.cpp
+++ b/indra/newview/lldrawpoolground.cpp
@@ -44,7 +44,7 @@
#include "pipeline.h"
#include "llagent.h"
#include "llviewerregion.h"
-#include "llglslshader.h"
+#include "llviewershadermgr.h"
LLDrawPoolGround::LLDrawPoolGround() :
LLFacePool(POOL_GROUND)
@@ -58,7 +58,7 @@ LLDrawPool *LLDrawPoolGround::instancePool()
void LLDrawPoolGround::prerender()
{
- mVertexShaderLevel = LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_ENVIRONMENT);
+ mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT);
}
void LLDrawPoolGround::render(S32 pass)
diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp
index b534886047..2015535b30 100644
--- a/indra/newview/lldrawpoolsimple.cpp
+++ b/indra/newview/lldrawpoolsimple.cpp
@@ -40,7 +40,7 @@
#include "llsky.h"
#include "pipeline.h"
#include "llspatialpartition.h"
-#include "llglslshader.h"
+#include "llviewershadermgr.h"
#include "llrender.h"
@@ -54,7 +54,7 @@ void LLDrawPoolGlow::render(S32 pass)
LLGLDisable test(GL_ALPHA_TEST);
gGL.setSceneBlendType(LLRender::BT_ADD);
- U32 shader_level = LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_OBJECT);
+ U32 shader_level = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);
if (shader_level > 0 && fullbright_shader)
{
@@ -92,7 +92,7 @@ LLDrawPoolSimple::LLDrawPoolSimple() :
void LLDrawPoolSimple::prerender()
{
- mVertexShaderLevel = LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_OBJECT);
+ mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);
}
void LLDrawPoolSimple::beginRenderPass(S32 pass)
@@ -113,7 +113,7 @@ void LLDrawPoolSimple::beginRenderPass(S32 pass)
if (mVertexShaderLevel > 0)
{
simple_shader->bind();
- simple_shader->uniform1f(LLShaderMgr::FULLBRIGHT, 0.f);
+ simple_shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 0.f);
}
else
{
@@ -161,7 +161,7 @@ void LLDrawPoolSimple::render(S32 pass)
if (mVertexShaderLevel > 0)
{
fullbright_shader->bind();
- fullbright_shader->uniform1f(LLShaderMgr::FULLBRIGHT, 1.f);
+ fullbright_shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 1.f);
}
else
{
diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp
index 585af6c47f..2687e6d2c0 100644
--- a/indra/newview/lldrawpoolsky.cpp
+++ b/indra/newview/lldrawpoolsky.cpp
@@ -46,7 +46,7 @@
#include "llvosky.h"
#include "llworld.h" // To get water height
#include "pipeline.h"
-#include "llglslshader.h"
+#include "llviewershadermgr.h"
LLDrawPoolSky::LLDrawPoolSky() :
LLFacePool(POOL_SKY), mShader(NULL)
@@ -60,7 +60,7 @@ LLDrawPool *LLDrawPoolSky::instancePool()
void LLDrawPoolSky::prerender()
{
- mVertexShaderLevel = LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_ENVIRONMENT);
+ mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT);
gSky.mVOSkyp->updateGeometry(gSky.mVOSkyp->mDrawable);
}
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp
index 854067a32d..e5850a0057 100644
--- a/indra/newview/lldrawpoolterrain.cpp
+++ b/indra/newview/lldrawpoolterrain.cpp
@@ -51,7 +51,7 @@
#include "llviewerimagelist.h" // To get alpha gradients
#include "llworld.h"
#include "pipeline.h"
-#include "llglslshader.h"
+#include "llviewershadermgr.h"
#include "llrender.h"
const F32 DETAIL_SCALE = 1.f/16.f;
@@ -101,7 +101,7 @@ LLDrawPool *LLDrawPoolTerrain::instancePool()
void LLDrawPoolTerrain::prerender()
{
- mVertexShaderLevel = LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_ENVIRONMENT);
+ mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT);
if (mVertexShaderLevel > 0)
{
sDetailMode = 1;
@@ -239,7 +239,7 @@ void LLDrawPoolTerrain::renderFullShader()
//
// detail texture 0
//
- S32 detail0 = sShader->enableTexture(LLShaderMgr::TERRAIN_DETAIL0);
+ S32 detail0 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL0);
LLViewerImage::bindTexture(detail_texture0p,detail0);
gGL.getTexUnit(0)->activate();
@@ -257,7 +257,7 @@ void LLDrawPoolTerrain::renderFullShader()
//
// detail texture 1
//
- S32 detail1 = sShader->enableTexture(LLShaderMgr::TERRAIN_DETAIL1);
+ S32 detail1 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL1);
LLViewerImage::bindTexture(detail_texture1p,detail1);
/// ALPHA TEXTURE COORDS 0:
@@ -268,7 +268,7 @@ void LLDrawPoolTerrain::renderFullShader()
// detail texture 2
//
- S32 detail2 = sShader->enableTexture(LLShaderMgr::TERRAIN_DETAIL2);
+ S32 detail2 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL2);
LLViewerImage::bindTexture(detail_texture2p,detail2);
glEnable(GL_TEXTURE_2D);
@@ -282,7 +282,7 @@ void LLDrawPoolTerrain::renderFullShader()
//
// detail texture 3
//
- S32 detail3 = sShader->enableTexture(LLShaderMgr::TERRAIN_DETAIL3);
+ S32 detail3 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL3);
LLViewerImage::bindTexture(detail_texture3p,detail3);
/// ALPHA TEXTURE COORDS 2:
@@ -295,18 +295,18 @@ void LLDrawPoolTerrain::renderFullShader()
//
// Alpha Ramp
//
- S32 alpha_ramp = sShader->enableTexture(LLShaderMgr::TERRAIN_ALPHARAMP);
+ S32 alpha_ramp = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP);
LLViewerImage::bindTexture(m2DAlphaRampImagep,alpha_ramp);
// GL_BLEND disabled by default
drawLoop();
// Disable multitexture
- sShader->disableTexture(LLShaderMgr::TERRAIN_ALPHARAMP);
- sShader->disableTexture(LLShaderMgr::TERRAIN_DETAIL0);
- sShader->disableTexture(LLShaderMgr::TERRAIN_DETAIL1);
- sShader->disableTexture(LLShaderMgr::TERRAIN_DETAIL2);
- sShader->disableTexture(LLShaderMgr::TERRAIN_DETAIL3);
+ sShader->disableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP);
+ sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL0);
+ sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL1);
+ sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL2);
+ sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL3);
LLImageGL::unbindTexture(alpha_ramp, GL_TEXTURE_2D);
gGL.getTexUnit(4)->activate();
diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp
index 1ebd0772a8..33f23ab6fa 100644
--- a/indra/newview/lldrawpooltree.cpp
+++ b/indra/newview/lldrawpooltree.cpp
@@ -40,7 +40,7 @@
#include "llvotree.h"
#include "pipeline.h"
#include "llviewercamera.h"
-#include "llglslshader.h"
+#include "llviewershadermgr.h"
#include "llrender.h"
S32 LLDrawPoolTree::sDiffTex = 0;
@@ -61,7 +61,7 @@ LLDrawPool *LLDrawPoolTree::instancePool()
void LLDrawPoolTree::prerender()
{
- mVertexShaderLevel = LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_OBJECT);
+ mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);
}
void LLDrawPoolTree::beginRenderPass(S32 pass)
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index e76423c8eb..f7770f001c 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -51,7 +51,7 @@
#include "llvowater.h"
#include "llworld.h"
#include "pipeline.h"
-#include "llglslshader.h"
+#include "llviewershadermgr.h"
#include "llwaterparammanager.h"
const LLUUID WATER_TEST("2bfd3884-7e27-69b9-ba3a-3e673f680004");
@@ -100,8 +100,8 @@ LLDrawPool *LLDrawPoolWater::instancePool()
void LLDrawPoolWater::prerender()
{
- mVertexShaderLevel = (gGLManager.mHasCubeMap && LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap")) ?
- LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_WATER) : 0;
+ mVertexShaderLevel = (gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps) ?
+ LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_WATER) : 0;
// got rid of modulation by light color since it got a little too
// green at sunset and sl-57047 (underwater turns black at 8:00)
@@ -385,7 +385,7 @@ void LLDrawPoolWater::shade()
sTime = (F32)LLFrameTimer::getElapsedSeconds()*0.5f;
- S32 reftex = shader->enableTexture(LLShaderMgr::WATER_REFTEX);
+ S32 reftex = shader->enableTexture(LLViewerShaderMgr::WATER_REFTEX);
if (reftex > -1)
{
@@ -395,7 +395,7 @@ void LLDrawPoolWater::shade()
}
//bind normal map
- S32 bumpTex = shader->enableTexture(LLShaderMgr::BUMP_MAP);
+ S32 bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP);
LLWaterParamManager * param_mgr = LLWaterParamManager::instance();
@@ -410,15 +410,15 @@ void LLDrawPoolWater::shade()
mWaterNormp->setMipFilterNearest (mWaterNormp->getMipFilterNearest(),
!gSavedSettings.getBOOL("RenderWaterMipNormal"));
- S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX);
+ S32 screentex = shader->enableTexture(LLViewerShaderMgr::WATER_SCREENTEX);
stop_glerror();
shader->bind();
if (screentex > -1)
{
- shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV);
- shader->uniform1f(LLShaderMgr::WATER_FOGDENSITY,
+ shader->uniform4fv(LLViewerShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV);
+ shader->uniform1f(LLViewerShaderMgr::WATER_FOGDENSITY,
param_mgr->getFogDensity());
}
@@ -427,7 +427,7 @@ void LLDrawPoolWater::shade()
if (mVertexShaderLevel == 1)
{
sWaterFogColor.mV[3] = param_mgr->mDensitySliderValue;
- shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV);
+ shader->uniform4fv(LLViewerShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV);
}
F32 screenRes[] =
@@ -438,7 +438,7 @@ void LLDrawPoolWater::shade()
shader->uniform2fv("screenRes", 1, screenRes);
stop_glerror();
- S32 diffTex = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP);
+ S32 diffTex = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
stop_glerror();
light_dir.normVec();
@@ -447,14 +447,14 @@ void LLDrawPoolWater::shade()
light_diffuse *= 6.f;
//shader->uniformMatrix4fv("inverse_ref", 1, GL_FALSE, (GLfloat*) gGLObliqueProjectionInverse.mMatrix);
- shader->uniform1f(LLShaderMgr::WATER_WATERHEIGHT, eyedepth);
- shader->uniform1f(LLShaderMgr::WATER_TIME, sTime);
- shader->uniform3fv(LLShaderMgr::WATER_EYEVEC, 1, LLViewerCamera::getInstance()->getOrigin().mV);
- shader->uniform3fv(LLShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV);
- shader->uniform1f(LLShaderMgr::WATER_SPECULAR_EXP, light_exp);
- shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, param_mgr->getWave1Dir().mV);
- shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR2, 1, param_mgr->getWave2Dir().mV);
- shader->uniform3fv(LLShaderMgr::WATER_LIGHT_DIR, 1, light_dir.mV);
+ shader->uniform1f(LLViewerShaderMgr::WATER_WATERHEIGHT, eyedepth);
+ shader->uniform1f(LLViewerShaderMgr::WATER_TIME, sTime);
+ shader->uniform3fv(LLViewerShaderMgr::WATER_EYEVEC, 1, LLViewerCamera::getInstance()->getOrigin().mV);
+ shader->uniform3fv(LLViewerShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV);
+ shader->uniform1f(LLViewerShaderMgr::WATER_SPECULAR_EXP, light_exp);
+ shader->uniform2fv(LLViewerShaderMgr::WATER_WAVE_DIR1, 1, param_mgr->getWave1Dir().mV);
+ shader->uniform2fv(LLViewerShaderMgr::WATER_WAVE_DIR2, 1, param_mgr->getWave2Dir().mV);
+ shader->uniform3fv(LLViewerShaderMgr::WATER_LIGHT_DIR, 1, light_dir.mV);
shader->uniform3fv("normScale", 1, param_mgr->getNormalScale().mV);
shader->uniform1f("fresnelScale", param_mgr->getFresnelScale());
@@ -474,12 +474,12 @@ void LLDrawPoolWater::shade()
if (LLViewerCamera::getInstance()->cameraUnderWater())
{
water_color.setVec(1.f, 1.f, 1.f, 0.4f);
- shader->uniform1f(LLShaderMgr::WATER_REFSCALE, param_mgr->getScaleBelow());
+ shader->uniform1f(LLViewerShaderMgr::WATER_REFSCALE, param_mgr->getScaleBelow());
}
else
{
water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot));
- shader->uniform1f(LLShaderMgr::WATER_REFSCALE, param_mgr->getScaleAbove());
+ shader->uniform1f(LLViewerShaderMgr::WATER_REFSCALE, param_mgr->getScaleAbove());
}
if (water_color.mV[3] > 0.9f)
@@ -527,12 +527,12 @@ void LLDrawPoolWater::shade()
}
}
- shader->disableTexture(LLShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB);
- shader->disableTexture(LLShaderMgr::WATER_SCREENTEX);
- shader->disableTexture(LLShaderMgr::BUMP_MAP);
- shader->disableTexture(LLShaderMgr::DIFFUSE_MAP);
- shader->disableTexture(LLShaderMgr::WATER_REFTEX);
- shader->disableTexture(LLShaderMgr::WATER_SCREENDEPTH);
+ shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB);
+ shader->disableTexture(LLViewerShaderMgr::WATER_SCREENTEX);
+ shader->disableTexture(LLViewerShaderMgr::BUMP_MAP);
+ shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
+ shader->disableTexture(LLViewerShaderMgr::WATER_REFTEX);
+ shader->disableTexture(LLViewerShaderMgr::WATER_SCREENDEPTH);
shader->unbind();
gGL.getTexUnit(0)->activate();
diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp
index 0f83da8240..0668655ac3 100644
--- a/indra/newview/llhudrender.cpp
+++ b/indra/newview/llhudrender.cpp
@@ -33,6 +33,7 @@
#include "llhudrender.h"
+#include "llrender.h"
#include "llgl.h"
#include "llviewercamera.h"
#include "v3math.h"
diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp
index a1a2c34222..5f6fcb70e3 100644
--- a/indra/newview/llviewercamera.cpp
+++ b/indra/newview/llviewercamera.cpp
@@ -50,9 +50,6 @@
#include "lltoolmgr.h"
#include "llviewerjoystick.h"
-GLfloat gGLZFar;
-GLfloat gGLZNear;
-
//glu pick matrix implementation borrowed from Mesa3D
glh::matrix4f gl_pick_matrix(GLfloat x, GLfloat y, GLfloat width, GLfloat height, GLint* viewport)
{
@@ -146,12 +143,6 @@ void LLViewerCamera::updateCameraLocation(const LLVector3 &center,
mScreenPixelArea =(S32)((F32)mViewHeightInPixels * ((F32)mViewHeightInPixels * mAspect));
}
-// Handy copies of last good GL matrices
-F64 gGLModelView[16];
-F64 gGLLastModelView[16];
-F64 gGLProjection[16];
-S32 gGLViewport[4];
-
const LLMatrix4 &LLViewerCamera::getProjection() const
{
calcProjection(getFar());
@@ -343,9 +334,6 @@ void LLViewerCamera::setPerspective(BOOL for_selection,
gGLProjection[i] = proj_mat.m[i];
}
- gGLZNear = z_near;
- gGLZFar = z_far;
-
glMatrixMode( GL_MODELVIEW );
glh::matrix4f modelview((GLfloat*) OGL_TO_CFR_ROTATION);
diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h
index a16f25ff81..cc37851d05 100644
--- a/indra/newview/llviewercamera.h
+++ b/indra/newview/llviewercamera.h
@@ -111,11 +111,4 @@ protected:
public:
};
-extern F64 gGLModelView[16];
-extern F64 gGLLastModelView[16];
-extern F64 gGLProjection[16];
-extern S32 gGLViewport[4];
-extern F32 gGLZNear;
-extern F32 gGLZFar;
-
#endif // LL_LLVIEWERCAMERA_H
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 422546c811..f3acad35da 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -43,7 +43,7 @@
#include "lldrawpoolterrain.h"
#include "llflexibleobject.h"
#include "llfeaturemanager.h"
-#include "llglslshader.h"
+#include "llviewershadermgr.h"
#include "llnetmap.h"
#include "llpanelgeneral.h"
#include "llpanelinput.h"
@@ -114,7 +114,7 @@ static bool handleTerrainDetailChanged(const LLSD& newvalue)
static bool handleSetShaderChanged(const LLSD& newvalue)
{
- LLShaderMgr::setShaders();
+ LLViewerShaderMgr::instance()->setShaders();
return true;
}
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index d4249ce135..b2cf873a21 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -68,6 +68,7 @@
#include "llspatialpartition.h"
#include "llappviewer.h"
#include "llstartup.h"
+#include "llviewershadermgr.h"
#include "llfasttimer.h"
#include "llfloatertools.h"
#include "llviewerimagelist.h"
@@ -531,7 +532,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
gFrameStats.start(LLFrameStats::UPDATE_CULL);
S32 water_clip = 0;
- if ((LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_ENVIRONMENT) > 1) &&
+ if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT) > 1) &&
gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_WATER))
{
if (LLViewerCamera::getInstance()->cameraUnderWater())
diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp
index 95166278d5..f975e56b95 100644
--- a/indra/newview/llviewerjointmesh.cpp
+++ b/indra/newview/llviewerjointmesh.cpp
@@ -56,7 +56,7 @@
#include "llvoavatar.h"
#include "llsky.h"
#include "pipeline.h"
-#include "llglslshader.h"
+#include "llviewershadermgr.h"
#include "llmath.h"
#include "v4math.h"
#include "m3math.h"
@@ -880,7 +880,7 @@ void LLViewerJointMesh::updateJointGeometry()
&& mFace
&& mMesh->hasWeights()
&& mFace->mVertexBuffer.notNull()
- && LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_AVATAR) == 0))
+ && LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) == 0))
{
return;
}
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
new file mode 100644
index 0000000000..fe0f3f12a6
--- /dev/null
+++ b/indra/newview/llviewershadermgr.cpp
@@ -0,0 +1,1094 @@
+/**
+ * @file llviewershadermgr.cpp
+ * @brief Viewer shader manager implementation.
+ *
+ * $LicenseInfo:firstyear=2005&license=viewergpl$
+ *
+ * Copyright (c) 2005-2007, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llfeaturemanager.h"
+#include "llviewershadermgr.h"
+
+#include "llfile.h"
+#include "llviewerwindow.h"
+#include "llviewercontrol.h"
+#include "pipeline.h"
+#include "llworld.h"
+#include "llwlparammanager.h"
+#include "llwaterparammanager.h"
+#include "llsky.h"
+#include "llvosky.h"
+#include "llrender.h"
+
+#if LL_DARWIN
+#include "OpenGL/OpenGL.h"
+#endif
+
+#ifdef LL_RELEASE_FOR_DOWNLOAD
+#define UNIFORM_ERRS LL_WARNS_ONCE("Shader")
+#else
+#define UNIFORM_ERRS LL_ERRS("Shader")
+#endif
+
+// Lots of STL stuff in here, using namespace std to keep things more readable
+using std::vector;
+using std::pair;
+using std::make_pair;
+using std::string;
+
+LLVector4 gShinyOrigin;
+
+//object shaders
+LLGLSLShader gObjectSimpleProgram;
+LLGLSLShader gObjectSimpleWaterProgram;
+LLGLSLShader gObjectFullbrightProgram;
+LLGLSLShader gObjectFullbrightWaterProgram;
+
+LLGLSLShader gObjectFullbrightShinyProgram;
+LLGLSLShader gObjectShinyProgram;
+LLGLSLShader gObjectShinyWaterProgram;
+
+//environment shaders
+LLGLSLShader gTerrainProgram;
+LLGLSLShader gTerrainWaterProgram;
+LLGLSLShader gWaterProgram;
+LLGLSLShader gUnderWaterProgram;
+
+//interface shaders
+LLGLSLShader gHighlightProgram;
+
+//avatar shader handles
+LLGLSLShader gAvatarProgram;
+LLGLSLShader gAvatarWaterProgram;
+LLGLSLShader gAvatarEyeballProgram;
+LLGLSLShader gAvatarPickProgram;
+
+// WindLight shader handles
+LLGLSLShader gWLSkyProgram;
+LLGLSLShader gWLCloudProgram;
+
+// Effects Shaders
+LLGLSLShader gGlowProgram;
+LLGLSLShader gGlowExtractProgram;
+LLGLSLShader gPostColorFilterProgram;
+LLGLSLShader gPostNightVisionProgram;
+
+// Deferred rendering shaders
+LLGLSLShader gDeferredDiffuseProgram;
+
+//current avatar shader parameter pointer
+GLint gAvatarMatrixParam;
+
+LLViewerShaderMgr::LLViewerShaderMgr() :
+ mVertexShaderLevel(SHADER_COUNT, 0)
+{
+/// Make sure WL Sky is the first program
+ mShaderList.push_back(&gWLSkyProgram);
+ mShaderList.push_back(&gWLCloudProgram);
+ mShaderList.push_back(&gAvatarProgram);
+ mShaderList.push_back(&gObjectShinyProgram);
+ mShaderList.push_back(&gWaterProgram);
+ mShaderList.push_back(&gAvatarEyeballProgram);
+ mShaderList.push_back(&gObjectSimpleProgram);
+ mShaderList.push_back(&gObjectFullbrightProgram);
+ mShaderList.push_back(&gObjectFullbrightShinyProgram);
+ mShaderList.push_back(&gTerrainProgram);
+ mShaderList.push_back(&gTerrainWaterProgram);
+ mShaderList.push_back(&gObjectSimpleWaterProgram);
+ mShaderList.push_back(&gObjectFullbrightWaterProgram);
+ mShaderList.push_back(&gAvatarWaterProgram);
+ mShaderList.push_back(&gObjectShinyWaterProgram);
+ mShaderList.push_back(&gUnderWaterProgram);
+}
+
+LLViewerShaderMgr::~LLViewerShaderMgr()
+{
+ mVertexShaderLevel.clear();
+ mShaderList.clear();
+}
+
+// static
+LLViewerShaderMgr * LLViewerShaderMgr::instance()
+{
+ if(NULL == sInstance)
+ {
+ sInstance = new LLViewerShaderMgr();
+ }
+
+ return static_cast<LLViewerShaderMgr*>(sInstance);
+ }
+
+void LLViewerShaderMgr::initAttribsAndUniforms(void)
+ {
+ if (mReservedAttribs.empty())
+ {
+ mReservedAttribs.push_back("materialColor");
+ mReservedAttribs.push_back("specularColor");
+ mReservedAttribs.push_back("binormal");
+
+ mAvatarAttribs.reserve(5);
+ mAvatarAttribs.push_back("weight");
+ mAvatarAttribs.push_back("clothing");
+ mAvatarAttribs.push_back("gWindDir");
+ mAvatarAttribs.push_back("gSinWaveParams");
+ mAvatarAttribs.push_back("gGravity");
+
+ mAvatarUniforms.push_back("matrixPalette");
+
+ mReservedUniforms.reserve(24);
+ mReservedUniforms.push_back("diffuseMap");
+ mReservedUniforms.push_back("specularMap");
+ mReservedUniforms.push_back("bumpMap");
+ mReservedUniforms.push_back("environmentMap");
+ mReservedUniforms.push_back("cloude_noise_texture");
+ mReservedUniforms.push_back("fullbright");
+ mReservedUniforms.push_back("lightnorm");
+ mReservedUniforms.push_back("sunlight_color");
+ mReservedUniforms.push_back("ambient");
+ mReservedUniforms.push_back("blue_horizon");
+ mReservedUniforms.push_back("blue_density");
+ mReservedUniforms.push_back("haze_horizon");
+ mReservedUniforms.push_back("haze_density");
+ mReservedUniforms.push_back("cloud_shadow");
+ mReservedUniforms.push_back("density_multiplier");
+ mReservedUniforms.push_back("distance_multiplier");
+ mReservedUniforms.push_back("max_y");
+ mReservedUniforms.push_back("glow");
+ mReservedUniforms.push_back("cloud_color");
+ mReservedUniforms.push_back("cloud_pos_density1");
+ mReservedUniforms.push_back("cloud_pos_density2");
+ mReservedUniforms.push_back("cloud_scale");
+ mReservedUniforms.push_back("gamma");
+ mReservedUniforms.push_back("scene_light_strength");
+
+ mWLUniforms.push_back("camPosLocal");
+
+ mTerrainUniforms.reserve(5);
+ mTerrainUniforms.push_back("detail_0");
+ mTerrainUniforms.push_back("detail_1");
+ mTerrainUniforms.push_back("detail_2");
+ mTerrainUniforms.push_back("detail_3");
+ mTerrainUniforms.push_back("alpha_ramp");
+
+ mGlowUniforms.push_back("glowDelta");
+ mGlowUniforms.push_back("glowStrength");
+
+ mGlowExtractUniforms.push_back("minLuminance");
+ mGlowExtractUniforms.push_back("maxExtractAlpha");
+ mGlowExtractUniforms.push_back("lumWeights");
+ mGlowExtractUniforms.push_back("warmthWeights");
+ mGlowExtractUniforms.push_back("warmthAmount");
+
+ mShinyUniforms.push_back("origin");
+
+ mWaterUniforms.reserve(12);
+ mWaterUniforms.push_back("screenTex");
+ mWaterUniforms.push_back("screenDepth");
+ mWaterUniforms.push_back("refTex");
+ mWaterUniforms.push_back("eyeVec");
+ mWaterUniforms.push_back("time");
+ mWaterUniforms.push_back("d1");
+ mWaterUniforms.push_back("d2");
+ mWaterUniforms.push_back("lightDir");
+ mWaterUniforms.push_back("specular");
+ mWaterUniforms.push_back("lightExp");
+ mWaterUniforms.push_back("fogCol");
+ mWaterUniforms.push_back("kd");
+ mWaterUniforms.push_back("refScale");
+ mWaterUniforms.push_back("waterHeight");
+ }
+ }
+
+
+//============================================================================
+// Set Levels
+
+S32 LLViewerShaderMgr::getVertexShaderLevel(S32 type)
+{
+ return LLPipeline::sDisableShaders ? 0 : mVertexShaderLevel[type];
+}
+
+//============================================================================
+// Shader Management
+
+void LLViewerShaderMgr::setShaders()
+{
+ if (!gPipeline.mInitialized)
+ {
+ return;
+ }
+ // Make sure the compiled shader map is cleared before we recompile shaders.
+ mShaderObjects.clear();
+
+ initAttribsAndUniforms();
+ gPipeline.releaseGLBuffers();
+
+ if (gSavedSettings.getBOOL("VertexShaderEnable"))
+ {
+ LLPipeline::sWaterReflections = gGLManager.mHasCubeMap;
+ LLPipeline::sRenderGlow = gSavedSettings.getBOOL("RenderGlow");
+ }
+ else
+ {
+ LLPipeline::sRenderGlow =
+ LLPipeline::sWaterReflections = FALSE;
+ }
+
+ //hack to reset buffers that change behavior with shaders
+ gPipeline.resetVertexBuffers();
+
+ if (gViewerWindow)
+ {
+ gViewerWindow->setCursor(UI_CURSOR_WAIT);
+ }
+
+ // Lighting
+ gPipeline.setLightingDetail(-1);
+
+ // Shaders
+ LL_INFOS("ShaderLoading") << "\n~~~~~~~~~~~~~~~~~~\n Loading Shaders:\n~~~~~~~~~~~~~~~~~~" << LL_ENDL;
+ for (S32 i = 0; i < SHADER_COUNT; i++)
+ {
+ mVertexShaderLevel[i] = 0;
+ }
+ mMaxAvatarShaderLevel = 0;
+
+ if (LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")
+ && gSavedSettings.getBOOL("VertexShaderEnable"))
+ {
+ S32 light_class = 2;
+ S32 env_class = 2;
+ S32 obj_class = 2;
+ S32 effect_class = 2;
+ S32 wl_class = 2;
+ S32 water_class = 2;
+ S32 deferred_class = 0;
+ if (!gSavedSettings.getBOOL("WindLightUseAtmosShaders"))
+ {
+ // user has disabled WindLight in their settings, downgrade
+ // windlight shaders to stub versions.
+ wl_class = 1;
+
+ // if class one or less, turn off more shaders
+ // since higher end cards won't see any real gain
+ // from turning off most of the shaders,
+ // but class one would
+ // TODO: Make water on class one cards color things
+ // beneath it properly
+ if(LLFeatureManager::getInstance()->getGPUClass() < GPU_CLASS_2)
+ {
+ // use lesser water and other stuff
+ light_class = 2;
+ env_class = 0;
+ obj_class = 0;
+ effect_class = 1;
+ water_class = 1;
+ }
+ }
+
+ if (gSavedSettings.getBOOL("RenderDeferred"))
+ {
+ light_class = 1;
+ env_class = 0;
+ obj_class = 0;
+ water_class = 1;
+ effect_class = 1;
+ deferred_class = 1;
+ }
+
+ if(!gSavedSettings.getBOOL("EnableRippleWater"))
+ {
+ water_class = 0;
+ }
+
+ // Trigger a full rebuild of the fallback skybox / cubemap if we've toggled windlight shaders
+ if (mVertexShaderLevel[SHADER_WINDLIGHT] != wl_class && gSky.mVOSkyp.notNull())
+ {
+ gSky.mVOSkyp->forceSkyUpdate();
+ }
+
+ // Load lighting shaders
+ mVertexShaderLevel[SHADER_LIGHTING] = light_class;
+ mVertexShaderLevel[SHADER_INTERFACE] = light_class;
+ mVertexShaderLevel[SHADER_ENVIRONMENT] = env_class;
+ mVertexShaderLevel[SHADER_WATER] = water_class;
+ mVertexShaderLevel[SHADER_OBJECT] = obj_class;
+ mVertexShaderLevel[SHADER_EFFECT] = effect_class;
+ mVertexShaderLevel[SHADER_WINDLIGHT] = wl_class;
+ mVertexShaderLevel[SHADER_DEFERRED] = deferred_class;
+
+ BOOL loaded = loadBasicShaders();
+
+ if (loaded)
+ {
+ gPipeline.mVertexShadersEnabled = TRUE;
+ gPipeline.mVertexShadersLoaded = 1;
+
+ // Load all shaders to set max levels
+ loadShadersEnvironment();
+ loadShadersWater();
+ loadShadersObject();
+ loadShadersWindLight();
+ loadShadersEffects();
+ loadShadersInterface();
+ loadShadersDeferred();
+
+ // Load max avatar shaders to set the max level
+ mVertexShaderLevel[SHADER_AVATAR] = 3;
+ mMaxAvatarShaderLevel = 3;
+ loadShadersAvatar();
+
+#if 0 && LL_DARWIN // force avatar shaders off for mac
+ mVertexShaderLevel[SHADER_AVATAR] = 0;
+ sMaxAvatarShaderLevel = 0;
+#else
+ if (gSavedSettings.getBOOL("RenderAvatarVP"))
+ {
+ BOOL avatar_cloth = gSavedSettings.getBOOL("RenderAvatarCloth");
+ S32 avatar_class = 1;
+
+ // cloth is a class3 shader
+ if(avatar_cloth)
+ {
+ avatar_class = 3;
+ }
+
+ // Set the actual level
+ mVertexShaderLevel[SHADER_AVATAR] = avatar_class;
+ loadShadersAvatar();
+ if (mVertexShaderLevel[SHADER_AVATAR] != avatar_class)
+ {
+ if (mVertexShaderLevel[SHADER_AVATAR] == 0)
+ {
+ gSavedSettings.setBOOL("RenderAvatarVP", FALSE);
+ }
+ if(llmax(mVertexShaderLevel[SHADER_AVATAR]-1,0) >= 3)
+ {
+ avatar_cloth = true;
+ }
+ else
+ {
+ avatar_cloth = false;
+ }
+ gSavedSettings.setBOOL("RenderAvatarCloth", avatar_cloth);
+ }
+ }
+ else
+ {
+ mVertexShaderLevel[SHADER_AVATAR] = 0;
+ gSavedSettings.setBOOL("RenderAvatarCloth", FALSE);
+ loadShadersAvatar(); // unloads
+ }
+#endif
+ }
+ else
+ {
+ gPipeline.mVertexShadersEnabled = FALSE;
+ gPipeline.mVertexShadersLoaded = 0;
+ mVertexShaderLevel[SHADER_LIGHTING] = 0;
+ mVertexShaderLevel[SHADER_INTERFACE] = 0;
+ mVertexShaderLevel[SHADER_ENVIRONMENT] = 0;
+ mVertexShaderLevel[SHADER_WATER] = 0;
+ mVertexShaderLevel[SHADER_OBJECT] = 0;
+ mVertexShaderLevel[SHADER_EFFECT] = 0;
+ mVertexShaderLevel[SHADER_WINDLIGHT] = 0;
+ }
+ }
+ else
+ {
+ gPipeline.mVertexShadersEnabled = FALSE;
+ gPipeline.mVertexShadersLoaded = 0;
+ mVertexShaderLevel[SHADER_LIGHTING] = 0;
+ mVertexShaderLevel[SHADER_INTERFACE] = 0;
+ mVertexShaderLevel[SHADER_ENVIRONMENT] = 0;
+ mVertexShaderLevel[SHADER_WATER] = 0;
+ mVertexShaderLevel[SHADER_OBJECT] = 0;
+ mVertexShaderLevel[SHADER_EFFECT] = 0;
+ mVertexShaderLevel[SHADER_WINDLIGHT] = 0;
+ }
+
+ if (gViewerWindow)
+ {
+ gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ }
+ gPipeline.createGLBuffers();
+}
+
+void LLViewerShaderMgr::unloadShaders()
+{
+ gObjectSimpleProgram.unload();
+ gObjectSimpleWaterProgram.unload();
+ gObjectFullbrightProgram.unload();
+ gObjectFullbrightWaterProgram.unload();
+
+ gObjectShinyProgram.unload();
+ gObjectFullbrightShinyProgram.unload();
+ gObjectShinyWaterProgram.unload();
+ gWaterProgram.unload();
+ gUnderWaterProgram.unload();
+ gTerrainProgram.unload();
+ gTerrainWaterProgram.unload();
+ gGlowProgram.unload();
+ gGlowExtractProgram.unload();
+ gAvatarProgram.unload();
+ gAvatarWaterProgram.unload();
+ gAvatarEyeballProgram.unload();
+ gAvatarPickProgram.unload();
+ gHighlightProgram.unload();
+
+ gWLSkyProgram.unload();
+ gWLCloudProgram.unload();
+
+ gPostColorFilterProgram.unload();
+ gPostNightVisionProgram.unload();
+
+ gDeferredDiffuseProgram.unload();
+
+ mVertexShaderLevel[SHADER_LIGHTING] = 0;
+ mVertexShaderLevel[SHADER_OBJECT] = 0;
+ mVertexShaderLevel[SHADER_AVATAR] = 0;
+ mVertexShaderLevel[SHADER_ENVIRONMENT] = 0;
+ mVertexShaderLevel[SHADER_WATER] = 0;
+ mVertexShaderLevel[SHADER_INTERFACE] = 0;
+
+ gPipeline.mVertexShadersLoaded = 0;
+}
+
+BOOL LLViewerShaderMgr::loadBasicShaders()
+{
+ // Load basic dependency shaders first
+ // All of these have to load for any shaders to function
+
+#if LL_DARWIN // Mac can't currently handle all 8 lights,
+ S32 sum_lights_class = 2;
+#else
+ S32 sum_lights_class = 3;
+
+ // class one cards will get the lower sum lights
+ // class zero we're not going to think about
+ // since a class zero card COULD be a ridiculous new card
+ // and old cards should have the features masked
+ if(LLFeatureManager::getInstance()->getGPUClass() == GPU_CLASS_1)
+ {
+ sum_lights_class = 2;
+ }
+#endif
+
+ // If we have sun and moon only checked, then only sum those lights.
+ if (gPipeline.getLightingDetail() == 0)
+ {
+ sum_lights_class = 1;
+ }
+
+ // Load the Basic Vertex Shaders at the appropriate level.
+ // (in order of shader function call depth for reference purposes, deepest level first)
+
+ vector< pair<string, S32> > shaders;
+ shaders.reserve(10);
+ shaders.push_back( make_pair( "windlight/atmosphericsVarsV.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );
+ shaders.push_back( make_pair( "windlight/atmosphericsHelpersV.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );
+ shaders.push_back( make_pair( "lighting/lightFuncV.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ shaders.push_back( make_pair( "lighting/sumLightsV.glsl", sum_lights_class ) );
+ shaders.push_back( make_pair( "lighting/lightV.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ shaders.push_back( make_pair( "lighting/lightFuncSpecularV.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ shaders.push_back( make_pair( "lighting/sumLightsSpecularV.glsl", sum_lights_class ) );
+ shaders.push_back( make_pair( "lighting/lightSpecularV.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ shaders.push_back( make_pair( "windlight/atmosphericsV.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );
+ shaders.push_back( make_pair( "avatar/avatarSkinV.glsl", 1 ) );
+
+ // We no longer have to bind the shaders to global glhandles, they are automatically added to a map now.
+ for (U32 i = 0; i < shaders.size(); i++)
+ {
+ // Note usage of GL_VERTEX_SHADER_ARB
+ if (loadShaderFile(shaders[i].first, shaders[i].second, GL_VERTEX_SHADER_ARB) == 0)
+ {
+ return FALSE;
+ }
+ }
+
+ // Load the Basic Fragment Shaders at the appropriate level.
+ // (in order of shader function call depth for reference purposes, deepest level first)
+
+ shaders.clear();
+ shaders.reserve(12);
+ shaders.push_back( make_pair( "windlight/atmosphericsVarsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );
+ shaders.push_back( make_pair( "windlight/gammaF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT]) );
+ shaders.push_back( make_pair( "windlight/atmosphericsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );
+ shaders.push_back( make_pair( "windlight/transportF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );
+ shaders.push_back( make_pair( "environment/waterFogF.glsl", mVertexShaderLevel[SHADER_WATER] ) );
+ shaders.push_back( make_pair( "lighting/lightF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ shaders.push_back( make_pair( "lighting/lightFullbrightF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ shaders.push_back( make_pair( "lighting/lightWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ shaders.push_back( make_pair( "lighting/lightFullbrightWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ shaders.push_back( make_pair( "lighting/lightShinyF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ shaders.push_back( make_pair( "lighting/lightFullbrightShinyF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ shaders.push_back( make_pair( "lighting/lightShinyWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+
+ for (U32 i = 0; i < shaders.size(); i++)
+ {
+ // Note usage of GL_FRAGMENT_SHADER_ARB
+ if (loadShaderFile(shaders[i].first, shaders[i].second, GL_FRAGMENT_SHADER_ARB) == 0)
+ {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+BOOL LLViewerShaderMgr::loadShadersEnvironment()
+{
+ BOOL success = TRUE;
+
+ if (mVertexShaderLevel[SHADER_ENVIRONMENT] == 0)
+ {
+ gTerrainProgram.unload();
+ return FALSE;
+ }
+
+ if (success)
+ {
+ gTerrainProgram.mName = "Terrain Shader";
+ gTerrainProgram.mFeatures.calculatesLighting = true;
+ gTerrainProgram.mFeatures.calculatesAtmospherics = true;
+ gTerrainProgram.mFeatures.hasAtmospherics = true;
+ gTerrainProgram.mFeatures.hasGamma = true;
+ gTerrainProgram.mShaderFiles.clear();
+ gTerrainProgram.mShaderFiles.push_back(make_pair("environment/terrainV.glsl", GL_VERTEX_SHADER_ARB));
+ gTerrainProgram.mShaderFiles.push_back(make_pair("environment/terrainF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gTerrainProgram.mShaderLevel = mVertexShaderLevel[SHADER_ENVIRONMENT];
+ success = gTerrainProgram.createShader(NULL, &mTerrainUniforms);
+ }
+
+ if (!success)
+ {
+ mVertexShaderLevel[SHADER_ENVIRONMENT] = 0;
+ return FALSE;
+ }
+
+ LLWorld::getInstance()->updateWaterObjects();
+
+ return TRUE;
+}
+
+BOOL LLViewerShaderMgr::loadShadersWater()
+{
+ BOOL success = TRUE;
+ BOOL terrainWaterSuccess = TRUE;
+
+ if (mVertexShaderLevel[SHADER_WATER] == 0)
+ {
+ gWaterProgram.unload();
+ gUnderWaterProgram.unload();
+ gTerrainWaterProgram.unload();
+ return FALSE;
+ }
+
+ if (success)
+ {
+ // load water shader
+ gWaterProgram.mName = "Water Shader";
+ gWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gWaterProgram.mFeatures.hasGamma = true;
+ gWaterProgram.mFeatures.hasTransport = true;
+ gWaterProgram.mShaderFiles.clear();
+ gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER_ARB));
+ gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_WATER];
+ success = gWaterProgram.createShader(NULL, &mWaterUniforms);
+ }
+
+ if (success)
+ {
+ //load under water vertex shader
+ gUnderWaterProgram.mName = "Underwater Shader";
+ gUnderWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gUnderWaterProgram.mShaderFiles.clear();
+ gUnderWaterProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER_ARB));
+ gUnderWaterProgram.mShaderFiles.push_back(make_pair("environment/underWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gUnderWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_WATER];
+ gUnderWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+
+ success = gUnderWaterProgram.createShader(NULL, &mWaterUniforms);
+ }
+
+ if (success)
+ {
+ //load terrain water shader
+ gTerrainWaterProgram.mName = "Terrain Water Shader";
+ gTerrainWaterProgram.mFeatures.calculatesLighting = true;
+ gTerrainWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gTerrainWaterProgram.mFeatures.hasAtmospherics = true;
+ gTerrainWaterProgram.mFeatures.hasWaterFog = true;
+ gTerrainWaterProgram.mShaderFiles.clear();
+ gTerrainWaterProgram.mShaderFiles.push_back(make_pair("environment/terrainV.glsl", GL_VERTEX_SHADER_ARB));
+ gTerrainWaterProgram.mShaderFiles.push_back(make_pair("environment/terrainWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gTerrainWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_ENVIRONMENT];
+ gTerrainWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ terrainWaterSuccess = gTerrainWaterProgram.createShader(NULL, &mTerrainUniforms);
+ }
+
+ /// Keep track of water shader levels
+ if (gWaterProgram.mShaderLevel != mVertexShaderLevel[SHADER_WATER]
+ || gUnderWaterProgram.mShaderLevel != mVertexShaderLevel[SHADER_WATER])
+ {
+ mVertexShaderLevel[SHADER_WATER] = llmin(gWaterProgram.mShaderLevel, gUnderWaterProgram.mShaderLevel);
+ }
+
+ if (!success)
+ {
+ mVertexShaderLevel[SHADER_WATER] = 0;
+ return FALSE;
+ }
+
+ // if we failed to load the terrain water shaders and we need them (using class2 water),
+ // then drop down to class1 water.
+ if (mVertexShaderLevel[SHADER_WATER] > 1 && !terrainWaterSuccess)
+ {
+ mVertexShaderLevel[SHADER_WATER]--;
+ return loadShadersWater();
+ }
+
+ LLWorld::getInstance()->updateWaterObjects();
+
+ return TRUE;
+}
+
+BOOL LLViewerShaderMgr::loadShadersEffects()
+{
+ BOOL success = TRUE;
+
+ if (mVertexShaderLevel[SHADER_EFFECT] == 0)
+ {
+ gGlowProgram.unload();
+ gGlowExtractProgram.unload();
+ gPostColorFilterProgram.unload();
+ gPostNightVisionProgram.unload();
+ return FALSE;
+ }
+
+ if (success)
+ {
+ gGlowProgram.mName = "Glow Shader (Post)";
+ gGlowProgram.mShaderFiles.clear();
+ gGlowProgram.mShaderFiles.push_back(make_pair("effects/glowV.glsl", GL_VERTEX_SHADER_ARB));
+ gGlowProgram.mShaderFiles.push_back(make_pair("effects/glowF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gGlowProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT];
+ success = gGlowProgram.createShader(NULL, &mGlowUniforms);
+ if (!success)
+ {
+ LLPipeline::sRenderGlow = FALSE;
+ }
+ }
+
+ if (success)
+ {
+ gGlowExtractProgram.mName = "Glow Extract Shader (Post)";
+ gGlowExtractProgram.mShaderFiles.clear();
+ gGlowExtractProgram.mShaderFiles.push_back(make_pair("effects/glowExtractV.glsl", GL_VERTEX_SHADER_ARB));
+ gGlowExtractProgram.mShaderFiles.push_back(make_pair("effects/glowExtractF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gGlowExtractProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT];
+ success = gGlowExtractProgram.createShader(NULL, &mGlowExtractUniforms);
+ if (!success)
+ {
+ LLPipeline::sRenderGlow = FALSE;
+ }
+ }
+
+#if 0
+ // disabling loading of postprocess shaders until we fix
+ // ATI sampler2DRect compatibility.
+
+ //load Color Filter Shader
+ if (success)
+ {
+ vector<string> shaderUniforms;
+ shaderUniforms.reserve(7);
+ shaderUniforms.push_back("RenderTexture");
+ shaderUniforms.push_back("gamma");
+ shaderUniforms.push_back("brightness");
+ shaderUniforms.push_back("contrast");
+ shaderUniforms.push_back("contrastBase");
+ shaderUniforms.push_back("saturation");
+ shaderUniforms.push_back("lumWeights");
+
+ gPostColorFilterProgram.mName = "Color Filter Shader (Post)";
+ gPostColorFilterProgram.mShaderFiles.clear();
+ gPostColorFilterProgram.mShaderFiles.push_back(make_pair("effects/colorFilterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gPostColorFilterProgram.mShaderFiles.push_back(make_pair("effects/drawQuadV.glsl", GL_VERTEX_SHADER_ARB));
+ gPostColorFilterProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT];
+ success = gPostColorFilterProgram.createShader(NULL, &shaderUniforms);
+ }
+
+ //load Night Vision Shader
+ if (success)
+ {
+ vector<string> shaderUniforms;
+ shaderUniforms.reserve(5);
+ shaderUniforms.push_back("RenderTexture");
+ shaderUniforms.push_back("NoiseTexture");
+ shaderUniforms.push_back("brightMult");
+ shaderUniforms.push_back("noiseStrength");
+ shaderUniforms.push_back("lumWeights");
+
+ gPostNightVisionProgram.mName = "Night Vision Shader (Post)";
+ gPostNightVisionProgram.mShaderFiles.clear();
+ gPostNightVisionProgram.mShaderFiles.push_back(make_pair("effects/nightVisionF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gPostNightVisionProgram.mShaderFiles.push_back(make_pair("effects/drawQuadV.glsl", GL_VERTEX_SHADER_ARB));
+ gPostNightVisionProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT];
+ success = gPostNightVisionProgram.createShader(NULL, &shaderUniforms);
+ }
+ #endif
+
+ return success;
+
+}
+
+BOOL LLViewerShaderMgr::loadShadersDeferred()
+{
+ if (mVertexShaderLevel[SHADER_DEFERRED] == 0)
+ {
+ gDeferredDiffuseProgram.unload();
+ return FALSE;
+ }
+
+ BOOL success = TRUE;
+
+ if (success)
+ {
+ gDeferredDiffuseProgram.mName = "Deffered Diffuse Shader";
+ gDeferredDiffuseProgram.mShaderFiles.clear();
+ gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER_ARB));
+ gDeferredDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDeferredDiffuseProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+ success = gDeferredDiffuseProgram.createShader(NULL, NULL);
+ }
+
+ return success;
+}
+
+BOOL LLViewerShaderMgr::loadShadersObject()
+{
+ BOOL success = TRUE;
+
+ if (mVertexShaderLevel[SHADER_OBJECT] == 0)
+ {
+ gObjectShinyProgram.unload();
+ gObjectFullbrightShinyProgram.unload();
+ gObjectShinyWaterProgram.unload();
+ gObjectSimpleProgram.unload();
+ gObjectSimpleWaterProgram.unload();
+ gObjectFullbrightProgram.unload();
+ gObjectFullbrightWaterProgram.unload();
+ return FALSE;
+ }
+
+ if (success)
+ {
+ gObjectSimpleProgram.mName = "Simple Shader";
+ gObjectSimpleProgram.mFeatures.calculatesLighting = true;
+ gObjectSimpleProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectSimpleProgram.mFeatures.hasGamma = true;
+ gObjectSimpleProgram.mFeatures.hasAtmospherics = true;
+ gObjectSimpleProgram.mFeatures.hasLighting = true;
+ gObjectSimpleProgram.mShaderFiles.clear();
+ gObjectSimpleProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectSimpleProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectSimpleProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectSimpleProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gObjectSimpleWaterProgram.mName = "Simple Water Shader";
+ gObjectSimpleWaterProgram.mFeatures.calculatesLighting = true;
+ gObjectSimpleWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectSimpleWaterProgram.mFeatures.hasWaterFog = true;
+ gObjectSimpleWaterProgram.mFeatures.hasAtmospherics = true;
+ gObjectSimpleWaterProgram.mFeatures.hasLighting = true;
+ gObjectSimpleWaterProgram.mShaderFiles.clear();
+ gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectSimpleWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gObjectSimpleWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gObjectSimpleWaterProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gObjectFullbrightProgram.mName = "Fullbright Shader";
+ gObjectFullbrightProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectFullbrightProgram.mFeatures.hasGamma = true;
+ gObjectFullbrightProgram.mFeatures.hasTransport = true;
+ gObjectFullbrightProgram.mFeatures.isFullbright = true;
+ gObjectFullbrightProgram.mShaderFiles.clear();
+ gObjectFullbrightProgram.mShaderFiles.push_back(make_pair("objects/fullbrightV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectFullbrightProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectFullbrightProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectFullbrightProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gObjectFullbrightWaterProgram.mName = "Fullbright Water Shader";
+ gObjectFullbrightWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectFullbrightWaterProgram.mFeatures.isFullbright = true;
+ gObjectFullbrightWaterProgram.mFeatures.hasWaterFog = true;
+ gObjectFullbrightWaterProgram.mFeatures.hasTransport = true;
+ gObjectFullbrightWaterProgram.mShaderFiles.clear();
+ gObjectFullbrightWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectFullbrightWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectFullbrightWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gObjectFullbrightWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gObjectFullbrightWaterProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gObjectShinyProgram.mName = "Shiny Shader";
+ gObjectShinyProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectShinyProgram.mFeatures.calculatesLighting = true;
+ gObjectShinyProgram.mFeatures.hasGamma = true;
+ gObjectShinyProgram.mFeatures.hasAtmospherics = true;
+ gObjectShinyProgram.mFeatures.isShiny = true;
+ gObjectShinyProgram.mShaderFiles.clear();
+ gObjectShinyProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectShinyProgram.mShaderFiles.push_back(make_pair("objects/shinyF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectShinyProgram.createShader(NULL, &mShinyUniforms);
+ }
+
+ if (success)
+ {
+ gObjectShinyWaterProgram.mName = "Shiny Water Shader";
+ gObjectShinyWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectShinyWaterProgram.mFeatures.calculatesLighting = true;
+ gObjectShinyWaterProgram.mFeatures.isShiny = true;
+ gObjectShinyWaterProgram.mFeatures.hasWaterFog = true;
+ gObjectShinyWaterProgram.mFeatures.hasAtmospherics = true;
+ gObjectShinyWaterProgram.mShaderFiles.clear();
+ gObjectShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/shinyWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectShinyWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gObjectShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gObjectShinyWaterProgram.createShader(NULL, &mShinyUniforms);
+ }
+
+ if (success)
+ {
+ gObjectFullbrightShinyProgram.mName = "Fullbright Shiny Shader";
+ gObjectFullbrightShinyProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectFullbrightShinyProgram.mFeatures.isFullbright = true;
+ gObjectFullbrightShinyProgram.mFeatures.isShiny = true;
+ gObjectFullbrightShinyProgram.mFeatures.hasGamma = true;
+ gObjectFullbrightShinyProgram.mFeatures.hasTransport = true;
+ gObjectFullbrightShinyProgram.mShaderFiles.clear();
+ gObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectFullbrightShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectFullbrightShinyProgram.createShader(NULL, &mShinyUniforms);
+ }
+
+
+ if( !success )
+ {
+ mVertexShaderLevel[SHADER_OBJECT] = 0;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+BOOL LLViewerShaderMgr::loadShadersAvatar()
+{
+ BOOL success = TRUE;
+
+ if (mVertexShaderLevel[SHADER_AVATAR] == 0)
+ {
+ gAvatarProgram.unload();
+ gAvatarWaterProgram.unload();
+ gAvatarEyeballProgram.unload();
+ gAvatarPickProgram.unload();
+ return FALSE;
+ }
+
+ if (success)
+ {
+ gAvatarProgram.mName = "Avatar Shader";
+ gAvatarProgram.mFeatures.hasSkinning = true;
+ gAvatarProgram.mFeatures.calculatesAtmospherics = true;
+ gAvatarProgram.mFeatures.calculatesLighting = true;
+ gAvatarProgram.mFeatures.hasGamma = true;
+ gAvatarProgram.mFeatures.hasAtmospherics = true;
+ gAvatarProgram.mFeatures.hasLighting = true;
+ gAvatarProgram.mShaderFiles.clear();
+ gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarV.glsl", GL_VERTEX_SHADER_ARB));
+ gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gAvatarProgram.mShaderLevel = mVertexShaderLevel[SHADER_AVATAR];
+ success = gAvatarProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+
+ if (success)
+ {
+ gAvatarWaterProgram.mName = "Avatar Water Shader";
+ gAvatarWaterProgram.mFeatures.hasSkinning = true;
+ gAvatarWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gAvatarWaterProgram.mFeatures.calculatesLighting = true;
+ gAvatarWaterProgram.mFeatures.hasWaterFog = true;
+ gAvatarWaterProgram.mFeatures.hasAtmospherics = true;
+ gAvatarWaterProgram.mFeatures.hasLighting = true;
+ gAvatarWaterProgram.mShaderFiles.clear();
+ gAvatarWaterProgram.mShaderFiles.push_back(make_pair("avatar/avatarV.glsl", GL_VERTEX_SHADER_ARB));
+ gAvatarWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ // Note: no cloth under water:
+ gAvatarWaterProgram.mShaderLevel = llmin(mVertexShaderLevel[SHADER_AVATAR], 1);
+ gAvatarWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gAvatarWaterProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+ }
+
+ /// Keep track of avatar levels
+ if (gAvatarProgram.mShaderLevel != mVertexShaderLevel[SHADER_AVATAR])
+ {
+ mMaxAvatarShaderLevel = mVertexShaderLevel[SHADER_AVATAR] = gAvatarProgram.mShaderLevel;
+ }
+ }
+
+ if (success)
+ {
+ gAvatarPickProgram.mName = "Avatar Pick Shader";
+ gAvatarPickProgram.mFeatures.hasSkinning = true;
+ gAvatarPickProgram.mShaderFiles.clear();
+ gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarV.glsl", GL_VERTEX_SHADER_ARB));
+ gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gAvatarPickProgram.mShaderLevel = mVertexShaderLevel[SHADER_AVATAR];
+ success = gAvatarPickProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+ }
+
+ if (success)
+ {
+ gAvatarEyeballProgram.mName = "Avatar Eyeball Program";
+ gAvatarEyeballProgram.mFeatures.calculatesLighting = true;
+ gAvatarEyeballProgram.mFeatures.isSpecular = true;
+ gAvatarEyeballProgram.mFeatures.calculatesAtmospherics = true;
+ gAvatarEyeballProgram.mFeatures.hasGamma = true;
+ gAvatarEyeballProgram.mFeatures.hasAtmospherics = true;
+ gAvatarEyeballProgram.mFeatures.hasLighting = true;
+ gAvatarEyeballProgram.mShaderFiles.clear();
+ gAvatarEyeballProgram.mShaderFiles.push_back(make_pair("avatar/eyeballV.glsl", GL_VERTEX_SHADER_ARB));
+ gAvatarEyeballProgram.mShaderFiles.push_back(make_pair("avatar/eyeballF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gAvatarEyeballProgram.mShaderLevel = mVertexShaderLevel[SHADER_AVATAR];
+ success = gAvatarEyeballProgram.createShader(NULL, NULL);
+ }
+
+ if( !success )
+ {
+ mVertexShaderLevel[SHADER_AVATAR] = 0;
+ mMaxAvatarShaderLevel = 0;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+BOOL LLViewerShaderMgr::loadShadersInterface()
+{
+ BOOL success = TRUE;
+
+ if (mVertexShaderLevel[SHADER_INTERFACE] == 0)
+ {
+ gHighlightProgram.unload();
+ return FALSE;
+ }
+
+ if (success)
+ {
+ gHighlightProgram.mName = "Highlight Shader";
+ gHighlightProgram.mShaderFiles.clear();
+ gHighlightProgram.mShaderFiles.push_back(make_pair("interface/highlightV.glsl", GL_VERTEX_SHADER_ARB));
+ gHighlightProgram.mShaderFiles.push_back(make_pair("interface/highlightF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gHighlightProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
+ success = gHighlightProgram.createShader(NULL, NULL);
+ }
+
+ if( !success )
+ {
+ mVertexShaderLevel[SHADER_INTERFACE] = 0;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+BOOL LLViewerShaderMgr::loadShadersWindLight()
+{
+ BOOL success = TRUE;
+
+ if (mVertexShaderLevel[SHADER_WINDLIGHT] < 2)
+ {
+ gWLSkyProgram.unload();
+ gWLCloudProgram.unload();
+ return FALSE;
+ }
+
+ if (success)
+ {
+ gWLSkyProgram.mName = "Windlight Sky Shader";
+ //gWLSkyProgram.mFeatures.hasGamma = true;
+ gWLSkyProgram.mShaderFiles.clear();
+ gWLSkyProgram.mShaderFiles.push_back(make_pair("windlight/skyV.glsl", GL_VERTEX_SHADER_ARB));
+ gWLSkyProgram.mShaderFiles.push_back(make_pair("windlight/skyF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT];
+ gWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY;
+ success = gWLSkyProgram.createShader(NULL, &mWLUniforms);
+ }
+
+ if (success)
+ {
+ gWLCloudProgram.mName = "Windlight Cloud Program";
+ //gWLCloudProgram.mFeatures.hasGamma = true;
+ gWLCloudProgram.mShaderFiles.clear();
+ gWLCloudProgram.mShaderFiles.push_back(make_pair("windlight/cloudsV.glsl", GL_VERTEX_SHADER_ARB));
+ gWLCloudProgram.mShaderFiles.push_back(make_pair("windlight/cloudsF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gWLCloudProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT];
+ gWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY;
+ success = gWLCloudProgram.createShader(NULL, &mWLUniforms);
+ }
+
+ return success;
+}
+
+std::string LLViewerShaderMgr::getShaderDirPrefix(void)
+ {
+ return gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "shaders/class");
+ }
+
+void LLViewerShaderMgr::updateShaderUniforms(LLGLSLShader * shader)
+ {
+ LLWLParamManager::instance()->updateShaderUniforms(shader);
+ LLWaterParamManager::instance()->updateShaderUniforms(shader);
+}
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
new file mode 100644
index 0000000000..6b8189b4a6
--- /dev/null
+++ b/indra/newview/llviewershadermgr.h
@@ -0,0 +1,313 @@
+/**
+ * @file llviewershadermgr.h
+ * @brief Viewer Shader Manager
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2008, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_VIEWER_SHADER_MGR_H
+#define LL_VIEWER_SHADER_MGR_H
+
+#include "llshadermgr.h"
+
+class LLViewerShaderMgr: public LLShaderMgr
+{
+public:
+ LLViewerShaderMgr();
+ /* virtual */ ~LLViewerShaderMgr();
+
+ // singleton pattern implementation
+ static LLViewerShaderMgr * instance();
+
+ void initAttribsAndUniforms(void);
+ void setShaders();
+ void unloadShaders();
+ S32 getVertexShaderLevel(S32 type);
+ BOOL loadBasicShaders();
+ BOOL loadShadersEffects();
+ BOOL loadShadersDeferred();
+ BOOL loadShadersObject();
+ BOOL loadShadersAvatar();
+ BOOL loadShadersEnvironment();
+ BOOL loadShadersWater();
+ BOOL loadShadersInterface();
+ BOOL loadShadersWindLight();
+
+ std::vector<S32> mVertexShaderLevel;
+ S32 mMaxAvatarShaderLevel;
+
+ enum EShaderClass
+ {
+ SHADER_LIGHTING,
+ SHADER_OBJECT,
+ SHADER_AVATAR,
+ SHADER_ENVIRONMENT,
+ SHADER_INTERFACE,
+ SHADER_EFFECT,
+ SHADER_WINDLIGHT,
+ SHADER_WATER,
+ SHADER_DEFERRED,
+ SHADER_COUNT
+ };
+
+ typedef enum
+ {
+ MATERIAL_COLOR = 0,
+ SPECULAR_COLOR,
+ BINORMAL,
+ END_RESERVED_ATTRIBS
+ } eGLSLReservedAttribs;
+
+ typedef enum
+ {
+ DIFFUSE_MAP = 0,
+ SPECULAR_MAP,
+ BUMP_MAP,
+ ENVIRONMENT_MAP,
+ CLOUD_NOISE_MAP,
+ FULLBRIGHT,
+ LIGHTNORM,
+ SUNLIGHT_COLOR,
+ AMBIENT,
+ BLUE_HORIZON,
+ BLUE_DENSITY,
+ HAZE_HORIZON,
+ HAZE_DENSITY,
+ CLOUD_SHADOW,
+ DENSITY_MULTIPLIER,
+ DISTANCE_MULTIPLIER,
+ MAX_Y,
+ GLOW,
+ CLOUD_COLOR,
+ CLOUD_POS_DENSITY1,
+ CLOUD_POS_DENSITY2,
+ CLOUD_SCALE,
+ GAMMA,
+ SCENE_LIGHT_STRENGTH,
+ END_RESERVED_UNIFORMS
+ } eGLSLReservedUniforms;
+
+ typedef enum
+ {
+ SHINY_ORIGIN = END_RESERVED_UNIFORMS
+ } eShinyUniforms;
+
+ typedef enum
+ {
+ WATER_SCREENTEX = END_RESERVED_UNIFORMS,
+ WATER_SCREENDEPTH,
+ WATER_REFTEX,
+ WATER_EYEVEC,
+ WATER_TIME,
+ WATER_WAVE_DIR1,
+ WATER_WAVE_DIR2,
+ WATER_LIGHT_DIR,
+ WATER_SPECULAR,
+ WATER_SPECULAR_EXP,
+ WATER_FOGCOLOR,
+ WATER_FOGDENSITY,
+ WATER_REFSCALE,
+ WATER_WATERHEIGHT,
+ } eWaterUniforms;
+
+ typedef enum
+ {
+ WL_CAMPOSLOCAL = END_RESERVED_UNIFORMS,
+ WL_WATERHEIGHT
+ } eWLUniforms;
+
+ typedef enum
+ {
+ TERRAIN_DETAIL0 = END_RESERVED_UNIFORMS,
+ TERRAIN_DETAIL1,
+ TERRAIN_DETAIL2,
+ TERRAIN_DETAIL3,
+ TERRAIN_ALPHARAMP
+ } eTerrainUniforms;
+
+ typedef enum
+ {
+ GLOW_DELTA = END_RESERVED_UNIFORMS
+ } eGlowUniforms;
+
+ typedef enum
+ {
+ AVATAR_WEIGHT = END_RESERVED_ATTRIBS,
+ AVATAR_CLOTHING,
+ AVATAR_WIND,
+ AVATAR_SINWAVE,
+ AVATAR_GRAVITY
+ } eAvatarAttribs;
+
+ typedef enum
+ {
+ AVATAR_MATRIX = END_RESERVED_UNIFORMS
+ } eAvatarUniforms;
+
+ // simple model of forward iterator
+ // http://www.sgi.com/tech/stl/ForwardIterator.html
+ class shader_iter
+ {
+ private:
+ friend bool operator == (shader_iter const & a, shader_iter const & b);
+ friend bool operator != (shader_iter const & a, shader_iter const & b);
+
+ typedef std::vector<LLGLSLShader *>::const_iterator base_iter_t;
+ public:
+ shader_iter()
+ {
+ }
+
+ shader_iter(base_iter_t iter) : mIter(iter)
+ {
+ }
+
+ LLGLSLShader & operator * () const
+ {
+ return **mIter;
+ }
+
+ LLGLSLShader * operator -> () const
+ {
+ return *mIter;
+ }
+
+ shader_iter & operator++ ()
+ {
+ ++mIter;
+ return *this;
+ }
+
+ shader_iter operator++ (int)
+ {
+ return mIter++;
+ }
+
+ private:
+ base_iter_t mIter;
+ };
+
+ shader_iter beginShaders() const
+ {
+ return mShaderList.begin();
+ }
+
+ shader_iter endShaders() const
+ {
+ return mShaderList.end();
+ }
+
+
+ /* virtual */ std::string getShaderDirPrefix(void); // Virtual
+
+ /* virtual */ void updateShaderUniforms(LLGLSLShader * shader); // Virtual
+
+private:
+
+ std::vector<std::string> mShinyUniforms;
+
+ //water parameters
+ std::vector<std::string> mWaterUniforms;
+
+ std::vector<std::string> mWLUniforms;
+
+ //terrain parameters
+ std::vector<std::string> mTerrainUniforms;
+
+ //glow parameters
+ std::vector<std::string> mGlowUniforms;
+
+ std::vector<std::string> mGlowExtractUniforms;
+
+ //avatar shader parameter tables
+ std::vector<std::string> mAvatarAttribs;
+
+ std::vector<std::string> mAvatarUniforms;
+
+ // the list of shaders we need to propagate parameters to.
+ std::vector<LLGLSLShader *> mShaderList;
+
+}; //LLViewerShaderMgr
+
+inline bool operator == (LLViewerShaderMgr::shader_iter const & a, LLViewerShaderMgr::shader_iter const & b)
+{
+ return a.mIter == b.mIter;
+}
+
+inline bool operator != (LLViewerShaderMgr::shader_iter const & a, LLViewerShaderMgr::shader_iter const & b)
+{
+ return a.mIter != b.mIter;
+}
+
+extern LLVector4 gShinyOrigin;
+
+//object shaders
+extern LLGLSLShader gObjectSimpleProgram;
+extern LLGLSLShader gObjectSimpleWaterProgram;
+extern LLGLSLShader gObjectFullbrightProgram;
+extern LLGLSLShader gObjectFullbrightWaterProgram;
+
+extern LLGLSLShader gObjectSimpleLODProgram;
+extern LLGLSLShader gObjectFullbrightLODProgram;
+
+extern LLGLSLShader gObjectFullbrightShinyProgram;
+extern LLGLSLShader gObjectShinyProgram;
+extern LLGLSLShader gObjectShinyWaterProgram;
+
+//environment shaders
+extern LLGLSLShader gTerrainProgram;
+extern LLGLSLShader gTerrainWaterProgram;
+extern LLGLSLShader gWaterProgram;
+extern LLGLSLShader gUnderWaterProgram;
+extern LLGLSLShader gGlowProgram;
+extern LLGLSLShader gGlowExtractProgram;
+
+//interface shaders
+extern LLGLSLShader gHighlightProgram;
+
+// avatar shader handles
+extern LLGLSLShader gAvatarProgram;
+extern LLGLSLShader gAvatarWaterProgram;
+extern LLGLSLShader gAvatarEyeballProgram;
+extern LLGLSLShader gAvatarPickProgram;
+
+// WindLight shader handles
+extern LLGLSLShader gWLSkyProgram;
+extern LLGLSLShader gWLCloudProgram;
+
+// Post Process Shaders
+extern LLGLSLShader gPostColorFilterProgram;
+extern LLGLSLShader gPostNightVisionProgram;
+
+// Deferred rendering shaders
+extern LLGLSLShader gDeferredDiffuseProgram;
+
+//current avatar shader parameter pointer
+extern GLint gAvatarMatrixParam;
+
+
+#endif
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index cf2c094ded..287f063757 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -114,7 +114,7 @@
#include "llworld.h"
#include "pipeline.h"
#include "llspatialpartition.h"
-#include "llglslshader.h"
+#include "llviewershadermgr.h"
#include "llappviewer.h"
#include "llsky.h"
#include "llanimstatelabels.h"
@@ -2824,7 +2824,7 @@ void LLVOAvatar::idleUpdateLoadingEffect()
void LLVOAvatar::idleUpdateWindEffect()
{
// update wind effect
- if ((LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_AVATAR) >= LLDrawPoolAvatar::SHADER_LEVEL_CLOTH))
+ if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) >= LLDrawPoolAvatar::SHADER_LEVEL_CLOTH))
{
F32 hover_strength = 0.f;
F32 time_delta = mRippleTimer.getElapsedTimeF32() - mRippleTimeLast;
@@ -3388,7 +3388,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
return FALSE;
}
}
-
+
// change animation time quanta based on avatar render load
if (!mIsSelf && !mIsDummy)
{
@@ -4000,7 +4000,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
mDrawable->clearState(LLDrawable::REBUILD_GEOMETRY);
}
- if (LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_AVATAR) <= 0)
+ if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) <= 0)
{
if (mNeedsSkin)
{
@@ -9714,7 +9714,7 @@ BOOL LLVOAvatar::updateLOD()
}
updateVisibility();
-
+
return res;
}
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 1ef721e918..330d5c370d 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -441,7 +441,7 @@ void LLVOSky::initCubeMap()
{
mCubeMap->init(images);
}
- else if (gSavedSettings.getBOOL("RenderWater") && gGLManager.mHasCubeMap && LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap"))
+ else if (gSavedSettings.getBOOL("RenderWater") && gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps)
{
mCubeMap = new LLCubeMap();
mCubeMap->init(images);
@@ -479,7 +479,7 @@ void LLVOSky::restoreGL()
calcAtmospherics();
if (gSavedSettings.getBOOL("RenderWater") && gGLManager.mHasCubeMap
- && LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap"))
+ && LLCubeMap::sUseCubeMaps)
{
LLCubeMap* cube_map = getCubeMap();
diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp
index 4f2dd663ed..29f086b7f9 100644
--- a/indra/newview/llwaterparammanager.cpp
+++ b/indra/newview/llwaterparammanager.cpp
@@ -33,6 +33,8 @@
#include "llwaterparammanager.h"
+#include "llrender.h"
+
#include "pipeline.h"
#include "llsky.h"
@@ -205,9 +207,9 @@ void LLWaterParamManager::propagateParameters(void)
// bind the variables only if we're using shaders
if(gPipeline.canUseVertexShaders())
{
- LLShaderMgr::shader_iter shaders_iter, end_shaders;
- end_shaders = LLShaderMgr::endShaders();
- for(shaders_iter = LLShaderMgr::beginShaders(); shaders_iter != end_shaders; ++shaders_iter)
+ LLViewerShaderMgr::shader_iter shaders_iter, end_shaders;
+ end_shaders = LLViewerShaderMgr::instance()->endShaders();
+ for(shaders_iter = LLViewerShaderMgr::instance()->beginShaders(); shaders_iter != end_shaders; ++shaders_iter)
{
if (shaders_iter->mProgramObject != 0
&& shaders_iter->mShaderGroup == LLGLSLShader::SG_WATER)
@@ -229,7 +231,7 @@ void LLWaterParamManager::updateShaderUniforms(LLGLSLShader * shader)
{
if (shader->mShaderGroup == LLGLSLShader::SG_WATER)
{
- shader->uniform4fv(LLShaderMgr::LIGHTNORM, 1, LLWLParamManager::instance()->getRotatedLightDir().mV);
+ shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, LLWLParamManager::instance()->getRotatedLightDir().mV);
shader->uniform3fv("camPosLocal", 1, LLViewerCamera::getInstance()->getOrigin().mV);
shader->uniform4fv("waterFogColor", 1, LLDrawPoolWater::sWaterFogColor.mV);
shader->uniform4fv("waterPlane", 1, mWaterPlane.mV);
@@ -289,9 +291,9 @@ void LLWaterParamManager::update(LLViewerCamera * cam)
sunMoonDir.normVec();
mWaterFogKS = 1.f/llmax(sunMoonDir.mV[2], WATER_FOG_LIGHT_CLAMP);
- LLShaderMgr::shader_iter shaders_iter, end_shaders;
- end_shaders = LLShaderMgr::endShaders();
- for(shaders_iter = LLShaderMgr::beginShaders(); shaders_iter != end_shaders; ++shaders_iter)
+ LLViewerShaderMgr::shader_iter shaders_iter, end_shaders;
+ end_shaders = LLViewerShaderMgr::instance()->endShaders();
+ for(shaders_iter = LLViewerShaderMgr::instance()->beginShaders(); shaders_iter != end_shaders; ++shaders_iter)
{
if (shaders_iter->mProgramObject != 0
&& shaders_iter->mShaderGroup == LLGLSLShader::SG_WATER)
diff --git a/indra/newview/llwaterparamset.h b/indra/newview/llwaterparamset.h
index b733160dff..c16901a4cd 100644
--- a/indra/newview/llwaterparamset.h
+++ b/indra/newview/llwaterparamset.h
@@ -37,7 +37,7 @@
#include "v4math.h"
#include "v4color.h"
-#include "llglslshader.h"
+#include "llviewershadermgr.h"
class LLFloaterWater;
class LLWaterParamSet;
diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp
index 24ddb6fc08..b55c3e5b6d 100644
--- a/indra/newview/llwlparammanager.cpp
+++ b/indra/newview/llwlparammanager.cpp
@@ -281,13 +281,13 @@ void LLWLParamManager::updateShaderUniforms(LLGLSLShader * shader)
if (shader->mShaderGroup == LLGLSLShader::SG_DEFAULT)
{
- shader->uniform4fv(LLShaderMgr::LIGHTNORM, 1, mRotatedLightDir.mV);
+ shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, mRotatedLightDir.mV);
shader->uniform3fv("camPosLocal", 1, LLViewerCamera::getInstance()->getOrigin().mV);
}
else if (shader->mShaderGroup == LLGLSLShader::SG_SKY)
{
- shader->uniform4fv(LLShaderMgr::LIGHTNORM, 1, mClampedLightDir.mV);
+ shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, mClampedLightDir.mV);
}
shader->uniform1f("scene_light_strength", mSceneLightStrength);
@@ -345,9 +345,9 @@ void LLWLParamManager::propagateParameters(void)
mCurParams.set("lightnorm", mLightDir);
// bind the variables for all shaders only if we're using WindLight
- LLShaderMgr::shader_iter shaders_iter, end_shaders;
- end_shaders = LLShaderMgr::endShaders();
- for(shaders_iter = LLShaderMgr::beginShaders(); shaders_iter != end_shaders; ++shaders_iter)
+ LLViewerShaderMgr::shader_iter shaders_iter, end_shaders;
+ end_shaders = LLViewerShaderMgr::instance()->endShaders();
+ for(shaders_iter = LLViewerShaderMgr::instance()->beginShaders(); shaders_iter != end_shaders; ++shaders_iter)
{
if (shaders_iter->mProgramObject != 0
&& (gPipeline.canUseWindLightShaders()
@@ -408,9 +408,9 @@ void LLWLParamManager::update(LLViewerCamera * cam)
lightNorm3 *= LLQuaternion(-(camYaw + camYawDelta), LLVector3(0.f, 1.f, 0.f));
mRotatedLightDir = LLVector4(lightNorm3, 0.f);
- LLShaderMgr::shader_iter shaders_iter, end_shaders;
- end_shaders = LLShaderMgr::endShaders();
- for(shaders_iter = LLShaderMgr::beginShaders(); shaders_iter != end_shaders; ++shaders_iter)
+ LLViewerShaderMgr::shader_iter shaders_iter, end_shaders;
+ end_shaders = LLViewerShaderMgr::instance()->endShaders();
+ for(shaders_iter = LLViewerShaderMgr::instance()->beginShaders(); shaders_iter != end_shaders; ++shaders_iter)
{
if (shaders_iter->mProgramObject != 0
&& (gPipeline.canUseWindLightShaders()
diff --git a/indra/newview/llwlparamset.h b/indra/newview/llwlparamset.h
index 15afeaf364..76a7b8a189 100644
--- a/indra/newview/llwlparamset.h
+++ b/indra/newview/llwlparamset.h
@@ -37,7 +37,7 @@
#include "v4math.h"
#include "v4color.h"
-#include "llglslshader.h"
+#include "llviewershadermgr.h"
class LLFloaterWindLight;
class LLWLParamSet;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 3679b57da8..f9a18bf192 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -93,7 +93,7 @@
#include "llworld.h"
#include "llcubemap.h"
#include "lldebugmessagebox.h"
-#include "llglslshader.h"
+#include "llviewershadermgr.h"
#include "llviewerjoystick.h"
#include "llviewerdisplay.h"
#include "llwlparammanager.h"
@@ -300,7 +300,7 @@ void LLPipeline::init()
// Enable features
- LLShaderMgr::setShaders();
+ LLViewerShaderMgr::instance()->setShaders();
stop_glerror();
}
@@ -565,7 +565,7 @@ void LLPipeline::restoreGL()
if (mVertexShadersEnabled)
{
- LLShaderMgr::setShaders();
+ LLViewerShaderMgr::instance()->setShaders();
}
for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin();
@@ -603,18 +603,18 @@ BOOL LLPipeline::canUseWindLightShaders() const
{
return (!LLPipeline::sDisableShaders &&
gWLSkyProgram.mProgramObject != 0 &&
- LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_WINDLIGHT) > 1);
+ LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_WINDLIGHT) > 1);
}
BOOL LLPipeline::canUseWindLightShadersOnObjects() const
{
return (canUseWindLightShaders()
- && LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_OBJECT) > 0);
+ && LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0);
}
void LLPipeline::unloadShaders()
{
- LLShaderMgr::unloadShaders();
+ LLViewerShaderMgr::instance()->unloadShaders();
mVertexShadersLoaded = 0;
}
@@ -660,7 +660,7 @@ S32 LLPipeline::setLightingDetail(S32 level)
if (mVertexShadersLoaded == 1)
{
- LLShaderMgr::setShaders();
+ LLViewerShaderMgr::instance()->setShaders();
}
}
return mLightingDetail;
@@ -1795,7 +1795,7 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera)
else if (drawablep->isAvatar())
{
drawablep->updateDistance(camera); // calls vobj->updateLOD() which calls LLVOAvatar::updateVisibility()
- }
+ }
}
}
@@ -2192,10 +2192,10 @@ void LLPipeline::renderHighlights()
LLGLEnable color_mat(GL_COLOR_MATERIAL);
disableLights();
- if ((LLShaderMgr::sVertexShaderLevel[LLShaderMgr::SHADER_INTERFACE] > 0))
+ if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
{
gHighlightProgram.bind();
- gHighlightProgram.vertexAttrib4f(LLShaderMgr::MATERIAL_COLOR,1,1,1,0.5f);
+ gHighlightProgram.vertexAttrib4f(LLViewerShaderMgr::MATERIAL_COLOR,1,1,1,0.5f);
}
if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED))
@@ -2225,9 +2225,9 @@ void LLPipeline::renderHighlights()
{
// Paint 'em red!
color.setVec(1.f, 0.f, 0.f, 0.5f);
- if ((LLShaderMgr::sVertexShaderLevel[LLShaderMgr::SHADER_INTERFACE] > 0))
+ if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
{
- gHighlightProgram.vertexAttrib4f(LLShaderMgr::MATERIAL_COLOR,1,0,0,0.5f);
+ gHighlightProgram.vertexAttrib4f(LLViewerShaderMgr::MATERIAL_COLOR,1,0,0,0.5f);
}
int count = mHighlightFaces.size();
for (S32 i = 0; i < count; i++)
@@ -2241,7 +2241,7 @@ void LLPipeline::renderHighlights()
// have touch-handlers.
mHighlightFaces.clear();
- if (LLShaderMgr::sVertexShaderLevel[LLShaderMgr::SHADER_INTERFACE] > 0)
+ if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)
{
gHighlightProgram.unbind();
}