summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2010-05-10 13:01:20 -0500
committerDave Parks <davep@lindenlab.com>2010-05-10 13:01:20 -0500
commitee7c2396e24a81295cc1665a38845a41a2b81e23 (patch)
treeb80a5b59403008f8ae68e888302a8c8923d7a750
parent33c4d124ce60b2999efb73fc17dc996cb3c2a103 (diff)
parent49579bebdd274a88c2381c4cab3d09ecd393564d (diff)
merge
-rw-r--r--indra/llrender/llrender.cpp1
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl3
-rw-r--r--indra/newview/featuretable.txt1
-rw-r--r--indra/newview/lldrawpoolavatar.cpp43
-rw-r--r--indra/newview/lldrawpoolavatar.h4
-rw-r--r--indra/newview/llviewerjointmesh.cpp30
-rw-r--r--indra/newview/pipeline.cpp2
7 files changed, 47 insertions, 37 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 43662fbb5c..2472339ec4 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -165,6 +165,7 @@ void LLTexUnit::enable(eTextureType type)
if ( (mCurrTexType != type || gGL.mDirty) && (type != TT_NONE) )
{
activate();
+
if (mCurrTexType != TT_NONE && !gGL.mDirty)
{
disable(); // Force a disable of a previous texture type if it's enabled.
diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
index f8dd1b7431..de423ee22a 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
@@ -21,6 +21,7 @@ varying vec3 vary_position;
varying vec3 vary_ambient;
varying vec3 vary_directional;
varying vec3 vary_normal;
+varying vec3 vary_fragcoord;
uniform float near_clip;
uniform float shadow_offset;
@@ -77,7 +78,7 @@ void main()
gl_FrontColor = col;
gl_FogFragCoord = pos.z;
-
+ vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
}
diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt
index cf280ae5f6..41c38dd116 100644
--- a/indra/newview/featuretable.txt
+++ b/indra/newview/featuretable.txt
@@ -57,6 +57,7 @@ RenderShaderLightingMaxLevel 1 3
RenderDeferred 1 1
RenderDeferredSSAO 1 1
RenderShadowDetail 1 2
+RenderUseFBO 1 1
//
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index a49cf8781e..d1f4be71f5 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -62,6 +62,8 @@ static U32 sShaderLevel = 0;
LLGLSLShader* LLDrawPoolAvatar::sVertexProgram = NULL;
BOOL LLDrawPoolAvatar::sSkipOpaque = FALSE;
BOOL LLDrawPoolAvatar::sSkipTransparent = FALSE;
+S32 LLDrawPoolAvatar::sDiffuseChannel = 0;
+
static bool is_deferred_render = false;
@@ -99,7 +101,6 @@ BOOL gAvatarEmbossBumpMap = FALSE;
static BOOL sRenderingSkinned = FALSE;
S32 normal_channel = -1;
S32 specular_channel = -1;
-S32 diffuse_channel = -1;
S32 cube_channel = -1;
static const U32 rigged_data_mask[] = {
@@ -279,6 +280,7 @@ void LLDrawPoolAvatar::beginPostDeferredAlpha()
gPipeline.bindDeferredShader(*sVertexProgram);
+ sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
}
@@ -286,7 +288,7 @@ void LLDrawPoolAvatar::beginDeferredRiggedAlpha()
{
sVertexProgram = &gDeferredSkinnedAlphaProgram;
gPipeline.bindDeferredShader(*sVertexProgram);
- diffuse_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
+ sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
gPipeline.enableLightsDynamic();
}
@@ -295,6 +297,7 @@ void LLDrawPoolAvatar::endDeferredRiggedAlpha()
{
LLVertexBuffer::unbind();
gPipeline.unbindDeferredShader(*sVertexProgram);
+ sDiffuseChannel = 0;
LLVertexBuffer::sWeight4Loc = -1;
sVertexProgram = NULL;
}
@@ -332,7 +335,7 @@ void LLDrawPoolAvatar::endPostDeferredAlpha()
disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
gPipeline.unbindDeferredShader(*sVertexProgram);
-
+ sDiffuseChannel = 0;
sShaderLevel = mVertexShaderLevel;
}
@@ -382,7 +385,7 @@ void LLDrawPoolAvatar::beginShadowPass(S32 pass)
else
{
sVertexProgram = &gDeferredAttachmentShadowProgram;
- diffuse_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
+ sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
sVertexProgram->bind();
LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
@@ -596,7 +599,7 @@ void LLDrawPoolAvatar::beginImpostor()
}
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
- diffuse_channel = 0;
+ sDiffuseChannel = 0;
}
void LLDrawPoolAvatar::endImpostor()
@@ -649,7 +652,7 @@ void LLDrawPoolAvatar::beginDeferredImpostor()
specular_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::SPECULAR_MAP);
normal_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::DEFERRED_NORMAL);
- diffuse_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
+ sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
sVertexProgram->bind();
}
@@ -772,7 +775,7 @@ void LLDrawPoolAvatar::endSkinned()
void LLDrawPoolAvatar::beginRiggedSimple()
{
sVertexProgram = &gSkinnedObjectSimpleProgram;
- diffuse_channel = 0;
+ sDiffuseChannel = 0;
gSkinnedObjectSimpleProgram.bind();
LLVertexBuffer::sWeight4Loc = gSkinnedObjectSimpleProgram.getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
@@ -788,7 +791,7 @@ void LLDrawPoolAvatar::endRiggedSimple()
void LLDrawPoolAvatar::beginRiggedAlpha()
{
sVertexProgram = &gSkinnedObjectSimpleProgram;
- diffuse_channel = 0;
+ sDiffuseChannel = 0;
sVertexProgram->bind();
LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
@@ -805,7 +808,7 @@ void LLDrawPoolAvatar::endRiggedAlpha()
void LLDrawPoolAvatar::beginRiggedFullbrightAlpha()
{
sVertexProgram = &gSkinnedObjectFullbrightProgram;
- diffuse_channel = 0;
+ sDiffuseChannel = 0;
sVertexProgram->bind();
LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
@@ -821,7 +824,7 @@ void LLDrawPoolAvatar::endRiggedFullbrightAlpha()
void LLDrawPoolAvatar::beginRiggedGlow()
{
sVertexProgram = &gSkinnedObjectFullbrightProgram;
- diffuse_channel = 0;
+ sDiffuseChannel = 0;
sVertexProgram->bind();
LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
@@ -837,7 +840,7 @@ void LLDrawPoolAvatar::endRiggedGlow()
void LLDrawPoolAvatar::beginRiggedFullbright()
{
sVertexProgram = &gSkinnedObjectFullbrightProgram;
- diffuse_channel = 0;
+ sDiffuseChannel = 0;
gSkinnedObjectFullbrightProgram.bind();
LLVertexBuffer::sWeight4Loc = gSkinnedObjectFullbrightProgram.getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
@@ -854,14 +857,14 @@ void LLDrawPoolAvatar::beginRiggedShinySimple()
{
sVertexProgram = &gSkinnedObjectShinySimpleProgram;
sVertexProgram->bind();
- LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, diffuse_channel, cube_channel, false);
+ LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
void LLDrawPoolAvatar::endRiggedShinySimple()
{
LLVertexBuffer::unbind();
- LLDrawPoolBump::unbindCubeMap(sVertexProgram, 2, diffuse_channel, cube_channel, false);
+ LLDrawPoolBump::unbindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
sVertexProgram->unbind();
sVertexProgram = NULL;
LLVertexBuffer::sWeight4Loc = -1;
@@ -871,14 +874,14 @@ void LLDrawPoolAvatar::beginRiggedFullbrightShiny()
{
sVertexProgram = &gSkinnedObjectFullbrightShinyProgram;
sVertexProgram->bind();
- LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, diffuse_channel, cube_channel, false);
+ LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
void LLDrawPoolAvatar::endRiggedFullbrightShiny()
{
LLVertexBuffer::unbind();
- LLDrawPoolBump::unbindCubeMap(sVertexProgram, 2, diffuse_channel, cube_channel, false);
+ LLDrawPoolBump::unbindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
sVertexProgram->unbind();
sVertexProgram = NULL;
LLVertexBuffer::sWeight4Loc = -1;
@@ -888,7 +891,7 @@ void LLDrawPoolAvatar::endRiggedFullbrightShiny()
void LLDrawPoolAvatar::beginDeferredRiggedSimple()
{
sVertexProgram = &gDeferredSkinnedDiffuseProgram;
- diffuse_channel = 0;
+ sDiffuseChannel = 0;
sVertexProgram->bind();
LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
@@ -906,7 +909,7 @@ void LLDrawPoolAvatar::beginDeferredRiggedBump()
sVertexProgram = &gDeferredSkinnedBumpProgram;
sVertexProgram->bind();
normal_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::BUMP_MAP);
- diffuse_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
+ sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
@@ -918,7 +921,7 @@ void LLDrawPoolAvatar::endDeferredRiggedBump()
sVertexProgram->unbind();
LLVertexBuffer::sWeight4Loc = -1;
normal_channel = -1;
- diffuse_channel = -1;
+ sDiffuseChannel = 0;
sVertexProgram = NULL;
}
@@ -1047,7 +1050,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
avatarp->mImpostor.bindTexture(1, specular_channel);
}
}
- avatarp->renderImpostor(LLColor4U(255,255,255,255), diffuse_channel);
+ avatarp->renderImpostor(LLColor4U(255,255,255,255), sDiffuseChannel);
}
return;
}
@@ -1305,7 +1308,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
glColor4f(0,0,0,face->getTextureEntry()->getGlow());
}
- gGL.getTexUnit(diffuse_channel)->bind(face->getTexture());
+ gGL.getTexUnit(sDiffuseChannel)->bind(face->getTexture());
if (normal_channel > -1)
{
LLDrawPoolBump::bindBumpMap(face, normal_channel);
diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h
index bab6f01480..4a5b009412 100644
--- a/indra/newview/lldrawpoolavatar.h
+++ b/indra/newview/lldrawpoolavatar.h
@@ -1,4 +1,4 @@
-/**
+ /**
* @file lldrawpoolavatar.h
* @brief LLDrawPoolAvatar class definition
*
@@ -205,6 +205,8 @@ public:
static BOOL sSkipOpaque;
static BOOL sSkipTransparent;
+ static S32 sDiffuseChannel;
+
static LLGLSLShader* sVertexProgram;
};
diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp
index fb6cc8d790..deb3d8fd97 100644
--- a/indra/newview/llviewerjointmesh.cpp
+++ b/indra/newview/llviewerjointmesh.cpp
@@ -516,6 +516,8 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
U32 triangle_count = 0;
+ S32 diffuse_channel = LLDrawPoolAvatar::sDiffuseChannel;
+
stop_glerror();
//----------------------------------------------------------------
@@ -541,7 +543,7 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
LLTexUnit::eTextureAddressMode old_mode = LLTexUnit::TAM_WRAP;
if (mTestImageName)
{
- gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mTestImageName);
+ gGL.getTexUnit(diffuse_channel)->bindManual(LLTexUnit::TT_TEXTURE, mTestImageName);
if (mIsTransparent)
{
@@ -550,18 +552,18 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
else
{
glColor4f(0.7f, 0.6f, 0.3f, 1.f);
- gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_LERP_TEX_ALPHA, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR);
+ gGL.getTexUnit(diffuse_channel)->setTextureColorBlend(LLTexUnit::TBO_LERP_TEX_ALPHA, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR);
}
}
else if( !is_dummy && mLayerSet )
{
if( mLayerSet->hasComposite() )
{
- gGL.getTexUnit(0)->bind(mLayerSet->getComposite());
+ gGL.getTexUnit(diffuse_channel)->bind(mLayerSet->getComposite());
}
else
{
- gGL.getTexUnit(0)->bind(LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT));
+ gGL.getTexUnit(diffuse_channel)->bind(LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT));
}
}
else
@@ -571,25 +573,25 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
{
old_mode = mTexture->getAddressMode();
}
- gGL.getTexUnit(0)->bind(mTexture.get());
- gGL.getTexUnit(0)->bind(mTexture);
- gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
+ gGL.getTexUnit(diffuse_channel)->bind(mTexture.get());
+ gGL.getTexUnit(diffuse_channel)->bind(mTexture);
+ gGL.getTexUnit(diffuse_channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
}
else
{
- gGL.getTexUnit(0)->bind(LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT));
+ gGL.getTexUnit(diffuse_channel)->bind(LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT));
}
if (gRenderForSelect)
{
if (isTransparent())
{
- gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
- gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_CONST_ALPHA);
+ gGL.getTexUnit(diffuse_channel)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
+ gGL.getTexUnit(diffuse_channel)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_CONST_ALPHA);
}
else
{
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE);
}
}
@@ -626,13 +628,13 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
if (mTestImageName)
{
- gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
+ gGL.getTexUnit(diffuse_channel)->setTextureBlendType(LLTexUnit::TB_MULT);
}
if (mTexture.notNull() && !is_dummy)
{
- gGL.getTexUnit(0)->bind(mTexture);
- gGL.getTexUnit(0)->setTextureAddressMode(old_mode);
+ gGL.getTexUnit(diffuse_channel)->bind(mTexture);
+ gGL.getTexUnit(diffuse_channel)->setTextureAddressMode(old_mode);
}
return triangle_count;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 9bcec9e13d..da01ae44db 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -7778,7 +7778,7 @@ BOOL LLPipeline::getVisiblePointCloud(LLCamera& camera, LLVector3& min, LLVector
0,1,
1,2,
2,3,
- 3,1,
+ 3,0,
4,5,
5,6,