summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-08-19 15:00:48 -0500
committerDave Parks <davep@lindenlab.com>2011-08-19 15:00:48 -0500
commit0e496309d6cb7581c9f69b7da244699c382750ac (patch)
treeea8f36edbac232448d2aa1d7f7d407d9df999b6e /indra
parentf40d2c5afb78f4a17b4753c42f6756dbd76a18c8 (diff)
parent428c762a3ea6caec277d915b8b175403cf3f52dd (diff)
merge
Diffstat (limited to 'indra')
-rw-r--r--indra/llplugin/llpluginclassmedia.h6
-rw-r--r--indra/llplugin/llplugininstance.h2
-rw-r--r--indra/llplugin/llpluginmessagepipe.h3
-rw-r--r--indra/llplugin/llpluginprocessparent.h2
-rw-r--r--indra/llrender/llgl.cpp11
-rw-r--r--indra/llrender/llglslshader.cpp13
-rw-r--r--indra/llrender/llglslshader.h5
-rw-r--r--indra/llrender/llimagegl.cpp4
-rw-r--r--indra/llrender/llrender.cpp29
-rw-r--r--indra/llrender/llshadermgr.cpp106
-rw-r--r--indra/llwindow/llwindowwin32.cpp31
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl26
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl27
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl23
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/impostorF.glsl26
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/impostorV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskF.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskNonIndexedF.glsl33
-rw-r--r--indra/newview/app_settings/shaders/class2/lighting/lightFullbrightAlphaMaskF.glsl29
-rw-r--r--indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterAlphaMaskF.glsl29
-rw-r--r--indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl29
-rw-r--r--indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskF.glsl27
-rw-r--r--indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskNonIndexedF.glsl31
-rw-r--r--indra/newview/lldrawpoolalpha.cpp69
-rw-r--r--indra/newview/lldrawpoolavatar.cpp28
-rw-r--r--indra/newview/lldrawpoolbump.cpp6
-rw-r--r--indra/newview/lldrawpoolsimple.cpp27
-rw-r--r--indra/newview/lldrawpooltree.cpp36
-rw-r--r--indra/newview/lldrawpoolwlsky.cpp3
-rw-r--r--indra/newview/llglsandbox.cpp2
-rw-r--r--indra/newview/llselectmgr.cpp2
-rw-r--r--indra/newview/llspatialpartition.cpp9
-rw-r--r--indra/newview/llspatialpartition.h2
-rw-r--r--indra/newview/llstartup.cpp32
-rw-r--r--indra/newview/llviewerregion.cpp1
-rw-r--r--indra/newview/llviewershadermgr.cpp192
-rw-r--r--indra/newview/llviewershadermgr.h10
-rw-r--r--indra/newview/llviewertexture.cpp22
-rw-r--r--indra/newview/llviewertexture.h1
-rw-r--r--indra/newview/llvoavatar.cpp14
-rw-r--r--indra/newview/llvocache.cpp18
-rwxr-xr-xindra/newview/llvovolume.cpp26
-rw-r--r--indra/newview/llvovolume.h2
-rw-r--r--indra/newview/pipeline.cpp34
49 files changed, 996 insertions, 154 deletions
diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h
index e7f303275e..d32cb0afe9 100644
--- a/indra/llplugin/llpluginclassmedia.h
+++ b/indra/llplugin/llpluginclassmedia.h
@@ -41,16 +41,16 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner
LOG_CLASS(LLPluginClassMedia);
public:
LLPluginClassMedia(LLPluginClassMediaOwner *owner);
- virtual ~LLPluginClassMedia();
+ ~LLPluginClassMedia();
// local initialization, called by the media manager when creating a source
- virtual bool init(const std::string &launcher_filename,
+ bool init(const std::string &launcher_filename,
const std::string &plugin_dir,
const std::string &plugin_filename,
bool debug);
// undoes everything init() didm called by the media manager when destroying a source
- virtual void reset();
+ void reset();
void idle(void);
diff --git a/indra/llplugin/llplugininstance.h b/indra/llplugin/llplugininstance.h
index e6926c3e37..3643a15d8c 100644
--- a/indra/llplugin/llplugininstance.h
+++ b/indra/llplugin/llplugininstance.h
@@ -39,7 +39,7 @@
class LLPluginInstanceMessageListener
{
public:
- virtual ~LLPluginInstanceMessageListener();
+ ~LLPluginInstanceMessageListener();
/** Plugin receives message from plugin loader shell. */
virtual void receivePluginMessage(const std::string &message) = 0;
};
diff --git a/indra/llplugin/llpluginmessagepipe.h b/indra/llplugin/llpluginmessagepipe.h
index 627577beb1..beb942c0fe 100644
--- a/indra/llplugin/llpluginmessagepipe.h
+++ b/indra/llplugin/llpluginmessagepipe.h
@@ -40,7 +40,8 @@ class LLPluginMessagePipeOwner
LOG_CLASS(LLPluginMessagePipeOwner);
public:
LLPluginMessagePipeOwner();
- virtual ~LLPluginMessagePipeOwner();
+ ~LLPluginMessagePipeOwner();
+
// called with incoming messages
virtual void receiveMessageRaw(const std::string &message) = 0;
// called when the socket has an error
diff --git a/indra/llplugin/llpluginprocessparent.h b/indra/llplugin/llpluginprocessparent.h
index c66723f175..26c6b0c402 100644
--- a/indra/llplugin/llpluginprocessparent.h
+++ b/indra/llplugin/llpluginprocessparent.h
@@ -41,7 +41,7 @@
class LLPluginProcessParentOwner
{
public:
- virtual ~LLPluginProcessParentOwner();
+ ~LLPluginProcessParentOwner();
virtual void receivePluginMessage(const LLPluginMessage &message) = 0;
virtual bool receivePluginMessageEarly(const LLPluginMessage &message) {return false;};
// This will only be called when the plugin has died unexpectedly
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 39f59c0bd8..4e3cfb9c8a 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -48,6 +48,7 @@
#include "llstacktrace.h"
#include "llglheaders.h"
+#include "llglslshader.h"
#ifdef _DEBUG
//#define GL_STATE_VERIFY
@@ -1781,6 +1782,16 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask)
LLGLState::LLGLState(LLGLenum state, S32 enabled) :
mState(state), mWasEnabled(FALSE), mIsEnabled(FALSE)
{
+ if (LLGLSLShader::sNoFixedFunction)
+ { //always disable state that's deprecated post GL 3.0
+ switch (state)
+ {
+ case GL_ALPHA_TEST:
+ enabled = 0;
+ break;
+ }
+ }
+
stop_glerror();
if (state)
{
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index 80c93bb0d2..f51d83abe4 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -49,6 +49,7 @@ using std::make_pair;
using std::string;
GLhandleARB LLGLSLShader::sCurBoundShader = 0;
+LLGLSLShader* LLGLSLShader::sCurBoundShaderPtr = NULL;
bool LLGLSLShader::sNoFixedFunction = false;
//UI shader -- declared here so llui_libtest will link properly
@@ -63,7 +64,8 @@ BOOL shouldChange(const LLVector4& v1, const LLVector4& v2)
LLShaderFeatures::LLShaderFeatures()
: calculatesLighting(false), isShiny(false), isFullbright(false), hasWaterFog(false),
hasTransport(false), hasSkinning(false), hasObjectSkinning(false), hasAtmospherics(false), isSpecular(false),
-hasGamma(false), hasLighting(false), calculatesAtmospherics(false), mIndexedTextureChannels(0), disableTextureIndex(false)
+hasGamma(false), hasLighting(false), calculatesAtmospherics(false), mIndexedTextureChannels(0), disableTextureIndex(false),
+hasAlphaMask(false)
{
}
@@ -386,6 +388,7 @@ void LLGLSLShader::bind()
{
glUseProgramObjectARB(mProgramObject);
sCurBoundShader = mProgramObject;
+ sCurBoundShaderPtr = this;
if (mUniformsDirty)
{
LLShaderMgr::instance()->updateShaderUniforms(this);
@@ -410,6 +413,7 @@ void LLGLSLShader::unbind()
}
glUseProgramObjectARB(0);
sCurBoundShader = 0;
+ sCurBoundShaderPtr = NULL;
stop_glerror();
}
}
@@ -418,6 +422,7 @@ void LLGLSLShader::bindNoShader(void)
{
glUseProgramObjectARB(0);
sCurBoundShader = 0;
+ sCurBoundShaderPtr = NULL;
}
S32 LLGLSLShader::enableTexture(S32 uniform, LLTexUnit::eTextureType mode)
@@ -979,3 +984,9 @@ void LLGLSLShader::vertexAttrib4fv(U32 index, GLfloat* v)
glVertexAttrib4fvARB(mAttribute[index], v);
}
}
+
+void LLGLSLShader::setAlphaRange(F32 minimum, F32 maximum)
+{
+ uniform1f("minimum_alpha", minimum);
+ uniform1f("maximum_alpha", maximum);
+}
diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h
index 621e0b82ee..558ea66b50 100644
--- a/indra/llrender/llglslshader.h
+++ b/indra/llrender/llglslshader.h
@@ -47,6 +47,7 @@ public:
bool hasGamma;
S32 mIndexedTextureChannels;
bool disableTextureIndex;
+ bool hasAlphaMask;
// char numLights;
@@ -67,6 +68,8 @@ public:
LLGLSLShader();
static GLhandleARB sCurBoundShader;
+ static LLGLSLShader* sCurBoundShaderPtr;
+
static bool sNoFixedFunction;
void unload();
@@ -105,6 +108,8 @@ public:
void uniformMatrix3fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v);
void uniformMatrix4fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v);
+ void setAlphaRange(F32 minimum, F32 maximum);
+
void vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
void vertexAttrib4fv(U32 index, GLfloat* v);
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 9ca3a23d52..7188b0fa44 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1424,7 +1424,7 @@ void LLImageGL::deleteDeadTextures()
{
LLTexUnit* tex_unit = gGL.getTexUnit(i);
- if (tex_unit->getCurrTexture() == tex)
+ if (tex_unit && tex_unit->getCurrTexture() == tex)
{
tex_unit->unbind(tex_unit->getCurrType());
stop_glerror();
@@ -1887,6 +1887,7 @@ BOOL LLImageGL::getMask(const LLVector2 &tc)
void LLImageGL::setCategory(S32 category)
{
+#if 0 //turn this off temporarily because it is not in use now.
if(!gAuditTexture)
{
return ;
@@ -1907,6 +1908,7 @@ void LLImageGL::setCategory(S32 category)
mCategory = -1 ;
}
}
+#endif
}
//for debug use
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 70df1dd1d1..d72918b15d 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -1168,6 +1168,11 @@ void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value)
{
flush();
+ if (LLGLSLShader::sNoFixedFunction)
+ { //glAlphaFunc is deprecated in OpenGL 3.3
+ return;
+ }
+
if (mCurrAlphaFunc != func ||
mCurrAlphaFuncVal != value)
{
@@ -1182,6 +1187,30 @@ void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value)
glAlphaFunc(sGLCompareFunc[func], value);
}
}
+
+ if (gDebugGL)
+ { //make sure cached state is correct
+ GLint cur_func = 0;
+ glGetIntegerv(GL_ALPHA_TEST_FUNC, &cur_func);
+
+ if (func == CF_DEFAULT)
+ {
+ func = CF_GREATER;
+ }
+
+ if (cur_func != sGLCompareFunc[func])
+ {
+ llerrs << "Alpha test function corrupted!" << llendl;
+ }
+
+ F32 ref = 0.f;
+ glGetFloatv(GL_ALPHA_TEST_REF, &ref);
+
+ if (ref != value)
+ {
+ llerrs << "Alpha test value corrupted!" << llendl;
+ }
+ }
}
void LLRender::blendFunc(eBlendFactor sfactor, eBlendFactor dfactor)
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 751b250d96..986c1f2774 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -206,21 +206,40 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
if (features->hasLighting)
{
-
if (features->hasWaterFog)
{
if (features->disableTextureIndex)
{
- if (!shader->attachObject("lighting/lightWaterNonIndexedF.glsl"))
+ if (features->hasAlphaMask)
{
- return FALSE;
+ if (!shader->attachObject("lighting/lightWaterAlphaMaskNonIndexedF.glsl"))
+ {
+ return FALSE;
+ }
+ }
+ else
+ {
+ if (!shader->attachObject("lighting/lightWaterNonIndexedF.glsl"))
+ {
+ return FALSE;
+ }
}
}
else
{
- if (!shader->attachObject("lighting/lightWaterF.glsl"))
+ if (features->hasAlphaMask)
{
- return FALSE;
+ if (!shader->attachObject("lighting/lightWaterAlphaMaskF.glsl"))
+ {
+ return FALSE;
+ }
+ }
+ else
+ {
+ if (!shader->attachObject("lighting/lightWaterF.glsl"))
+ {
+ return FALSE;
+ }
}
shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
}
@@ -230,16 +249,36 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
{
if (features->disableTextureIndex)
{
- if (!shader->attachObject("lighting/lightNonIndexedF.glsl"))
+ if (features->hasAlphaMask)
{
- return FALSE;
+ if (!shader->attachObject("lighting/lightAlphaMaskNonIndexedF.glsl"))
+ {
+ return FALSE;
+ }
+ }
+ else
+ {
+ if (!shader->attachObject("lighting/lightNonIndexedF.glsl"))
+ {
+ return FALSE;
+ }
}
}
else
{
- if (!shader->attachObject("lighting/lightF.glsl"))
+ if (features->hasAlphaMask)
{
- return FALSE;
+ if (!shader->attachObject("lighting/lightAlphaMaskF.glsl"))
+ {
+ return FALSE;
+ }
+ }
+ else
+ {
+ if (!shader->attachObject("lighting/lightF.glsl"))
+ {
+ return FALSE;
+ }
}
shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
}
@@ -272,14 +311,28 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
{
if (features->disableTextureIndex)
{
- if (!shader->attachObject("lighting/lightFullbrightWaterNonIndexedF.glsl"))
+ if (features->hasAlphaMask)
+ {
+ if (!shader->attachObject("lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl"))
+ {
+ return FALSE;
+ }
+ }
+ else if (!shader->attachObject("lighting/lightFullbrightWaterNonIndexedF.glsl"))
{
return FALSE;
}
}
else
{
- if (!shader->attachObject("lighting/lightFullbrightWaterF.glsl"))
+ if (features->hasAlphaMask)
+ {
+ if (!shader->attachObject("lighting/lightFullbrightWaterAlphaMaskF.glsl"))
+ {
+ return FALSE;
+ }
+ }
+ else if (!shader->attachObject("lighting/lightFullbrightWaterF.glsl"))
{
return FALSE;
}
@@ -310,16 +363,37 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
{
if (features->disableTextureIndex)
{
- if (!shader->attachObject("lighting/lightFullbrightNonIndexedF.glsl"))
+
+ if (features->hasAlphaMask)
{
- return FALSE;
+ if (!shader->attachObject("lighting/lightFullbrightNonIndexedAlphaMaskF.glsl"))
+ {
+ return FALSE;
+ }
+ }
+ else
+ {
+ if (!shader->attachObject("lighting/lightFullbrightNonIndexedF.glsl"))
+ {
+ return FALSE;
+ }
}
}
else
{
- if (!shader->attachObject("lighting/lightFullbrightF.glsl"))
+ if (features->hasAlphaMask)
{
- return FALSE;
+ if (!shader->attachObject("lighting/lightFullbrightAlphaMaskF.glsl"))
+ {
+ return FALSE;
+ }
+ }
+ else
+ {
+ if (!shader->attachObject("lighting/lightFullbrightF.glsl"))
+ {
+ return FALSE;
+ }
}
shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
}
@@ -406,7 +480,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns)
LL_DEBUGS("ShaderLoading") << log << LL_ENDL;
}
}
-}
+ }
GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, S32 texture_index_channels)
{
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 551d487cc8..1239e2d40b 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -1172,8 +1172,39 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
// First we try and get a 32 bit depth pixel format
BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
+
+ while(!result && mFSAASamples > 0)
+ {
+ llwarns << "FSAASamples: " << mFSAASamples << " not supported." << llendl ;
+
+ mFSAASamples /= 2 ; //try to decrease sample pixel number until to disable anti-aliasing
+ if(mFSAASamples < 2)
+ {
+ mFSAASamples = 0 ;
+ }
+
+ if (mFSAASamples > 0)
+ {
+ attrib_list[end_attrib + 3] = mFSAASamples;
+ }
+ else
+ {
+ cur_attrib = end_attrib ;
+ end_attrib = 0 ;
+ attrib_list[cur_attrib++] = 0 ; //end
+ }
+ result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
+
+ if(result)
+ {
+ llwarns << "Only support FSAASamples: " << mFSAASamples << llendl ;
+ }
+ }
+
if (!result)
{
+ llwarns << "mFSAASamples: " << mFSAASamples << llendl ;
+
close();
show_window_creation_error("Error after wglChoosePixelFormatARB 32-bit");
return FALSE;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
new file mode 100644
index 0000000000..338d0ebb2b
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
@@ -0,0 +1,30 @@
+/**
+ * @file diffuseF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
+uniform sampler2D diffuseMap;
+
+varying vec3 vary_normal;
+
+void main()
+{
+ vec4 col = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
+
+ if (col.a < minimum_alpha || col.a > maximum_alpha)
+ {
+ discard;
+ }
+
+ gl_FragData[0] = vec4(col.rgb, 0.0);
+ gl_FragData[1] = vec4(0,0,0,0); // spec
+ vec3 nvn = normalize(vary_normal);
+ gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl
new file mode 100644
index 0000000000..0671cb94bd
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl
@@ -0,0 +1,26 @@
+/**
+ * @file diffuseAlphaMaskIndexedF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+varying vec3 vary_normal;
+
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
+void main()
+{
+ vec4 col = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+
+ if (col.a < minimum_alpha || col.a > maximum_alpha)
+ {
+ discard;
+ }
+
+ gl_FragData[0] = vec4(col.rgb, 0.0);
+ gl_FragData[1] = vec4(0,0,0,0);
+ vec3 nvn = normalize(vary_normal);
+ gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
+}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
index f1e9955bb6..7337f853a5 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
@@ -23,6 +23,8 @@
* $/LicenseInfo$
*/
+uniform float minimum_alpha;
+uniform float maximum_alpha;
uniform sampler2D diffuseMap;
@@ -32,6 +34,12 @@ uniform sampler2D specularMap;
void main()
{
vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy);
+
+ if (col.a < minimum_alpha || col.a > maximum_alpha)
+ {
+ discard;
+ }
+
gl_FragData[0] = vec4(col.rgb, col.a * 0.005);
gl_FragData[1] = texture2D(specularMap, gl_TexCoord[0].xy);
gl_FragData[2] = vec4(texture2D(normalMap, gl_TexCoord[0].xy).xyz, 0.0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
new file mode 100644
index 0000000000..e24d0b666e
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
@@ -0,0 +1,27 @@
+/**
+ * @file shadowAlphaMaskF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
+uniform sampler2D diffuseMap;
+
+varying vec4 post_pos;
+
+void main()
+{
+ float alpha = texture2D(diffuseMap, gl_TexCoord[0].xy).a * gl_Color.a;
+
+ if (alpha < minimum_alpha || alpha > maximum_alpha)
+ {
+ discard;
+ }
+
+ gl_FragColor = vec4(1,1,1,1);
+
+ gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0);
+}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
new file mode 100644
index 0000000000..58e9bcec58
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
@@ -0,0 +1,23 @@
+/**
+ * @file shadowAlphaMaskV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+
+varying vec4 post_pos;
+
+void main()
+{
+ //transform vertex
+ vec4 pos = gl_ModelViewProjectionMatrix*gl_Vertex;
+
+ post_pos = pos;
+
+ gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);
+
+ gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_FrontColor = gl_Color;
+}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl
index b687d97da0..785fe0084f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl
@@ -25,13 +25,11 @@
-uniform sampler2D diffuseMap;
-
varying vec4 post_pos;
void main()
{
- gl_FragColor = vec4(1,1,1,texture2D(diffuseMap, gl_TexCoord[0].xy).a * gl_Color.a);
+ gl_FragColor = vec4(1,1,1,1);
gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
index 394fedf28f..66fee10887 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
@@ -35,7 +35,4 @@ void main()
post_pos = pos;
gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);
-
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
- gl_FrontColor = gl_Color;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl
new file mode 100644
index 0000000000..13597ee439
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl
@@ -0,0 +1,26 @@
+/**
+ * @file impostorF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
+vec3 fullbrightAtmosTransport(vec3 light);
+vec3 fullbrightScaleSoftClip(vec3 light);
+
+uniform sampler2D diffuseMap;
+
+void main()
+{
+ vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+
+ if (color.a < minimum_alpha || color.a > maximum_alpha)
+ {
+ discard;
+ }
+
+ gl_FragColor = color;
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl
new file mode 100644
index 0000000000..724b86a1b7
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl
@@ -0,0 +1,16 @@
+/**
+ * @file impostorV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+void main()
+{
+ //transform vertex
+ gl_Position = ftransform();
+ gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+
+ gl_FrontColor = gl_Color;
+}
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskF.glsl
new file mode 100644
index 0000000000..1211ad7a89
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskF.glsl
@@ -0,0 +1,30 @@
+/**
+ * @file lightAlphaMaskF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
+vec3 atmosLighting(vec3 light);
+vec3 scaleSoftClip(vec3 light);
+
+void default_lighting()
+{
+ vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+
+ if (color.a < minimum_alpha || color.a > maximum_alpha)
+ {
+ discard;
+ }
+
+ color.rgb = atmosLighting(color.rgb);
+
+ color.rgb = scaleSoftClip(color.rgb);
+
+ gl_FragColor = color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskNonIndexedF.glsl
new file mode 100644
index 0000000000..1a7d67b943
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskNonIndexedF.glsl
@@ -0,0 +1,33 @@
+/**
+ * @file lightAlphaMaskNonIndexedF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
+
+uniform sampler2D diffuseMap;
+
+vec3 atmosLighting(vec3 light);
+vec3 scaleSoftClip(vec3 light);
+
+void default_lighting()
+{
+ vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+
+ if (color.a < minimum_alpha || color.a > maximum_alpha)
+ {
+ discard;
+ }
+
+ color.rgb = atmosLighting(color.rgb);
+
+ color.rgb = scaleSoftClip(color.rgb);
+
+ gl_FragColor = color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightAlphaMaskF.glsl
new file mode 100644
index 0000000000..73e885a7e9
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightAlphaMaskF.glsl
@@ -0,0 +1,29 @@
+/**
+ * @file lightFullbrightAlphaMaskF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
+vec3 fullbrightAtmosTransport(vec3 light);
+vec3 fullbrightScaleSoftClip(vec3 light);
+
+void fullbright_lighting()
+{
+ vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+
+ if (color.a < minimum_alpha || color.a > maximum_alpha)
+ {
+ discard;
+ }
+
+ color.rgb = fullbrightAtmosTransport(color.rgb);
+
+ color.rgb = fullbrightScaleSoftClip(color.rgb);
+
+ gl_FragColor = color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl
new file mode 100644
index 0000000000..55dfe9b166
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl
@@ -0,0 +1,31 @@
+/**
+ * @file lightFullbrightNonIndexedAlphaMaskF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
+vec3 fullbrightAtmosTransport(vec3 light);
+vec3 fullbrightScaleSoftClip(vec3 light);
+
+uniform sampler2D diffuseMap;
+
+void fullbright_lighting()
+{
+ vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+
+ if (color.a < minimum_alpha || color.a > maximum_alpha)
+ {
+ discard;
+ }
+
+ color.rgb = fullbrightAtmosTransport(color.rgb);
+
+ color.rgb = fullbrightScaleSoftClip(color.rgb);
+
+ gl_FragColor = color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterAlphaMaskF.glsl
new file mode 100644
index 0000000000..e4cea077f9
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterAlphaMaskF.glsl
@@ -0,0 +1,29 @@
+/**
+ * @file lightFullbrightWaterAlphaMaskF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
+vec4 diffuseLookup(vec2 texcoord);
+
+vec3 fullbrightAtmosTransport(vec3 light);
+vec4 applyWaterFog(vec4 color);
+
+void fullbright_lighting_water()
+{
+ vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+
+ if (color.a < minimum_alpha || color.a > maximum_alpha)
+ {
+ discard;
+ }
+
+ color.rgb = fullbrightAtmosTransport(color.rgb);
+
+ gl_FragColor = applyWaterFog(color);
+}
+
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl
new file mode 100644
index 0000000000..e8533f94a7
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl
@@ -0,0 +1,29 @@
+/**
+ * @file lightFullbrightWaterNonIndexedAlphaMaskF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
+uniform sampler2D diffuseMap;
+
+vec3 fullbrightAtmosTransport(vec3 light);
+vec4 applyWaterFog(vec4 color);
+
+void fullbright_lighting_water()
+{
+ vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
+
+ if (color.a < minimum_alpha || color.a > maximum_alpha)
+ {
+ discard;
+ }
+
+ color.rgb = fullbrightAtmosTransport(color.rgb);
+
+ gl_FragColor = applyWaterFog(color);
+}
+
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskF.glsl
new file mode 100644
index 0000000000..7b3c20f092
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskF.glsl
@@ -0,0 +1,27 @@
+/**
+ * @file lightWaterAlphaMaskF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
+vec3 atmosLighting(vec3 light);
+vec4 applyWaterFog(vec4 color);
+
+void default_lighting_water()
+{
+ vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+
+ if (color.a < minimum_alpha || color.a > maximum_alpha)
+ {
+ discard;
+ }
+
+ color.rgb = atmosLighting(color.rgb);
+
+ gl_FragColor = applyWaterFog(color);
+}
+
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskNonIndexedF.glsl
new file mode 100644
index 0000000000..907140effd
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskNonIndexedF.glsl
@@ -0,0 +1,31 @@
+/**
+ * @file lightWaterAlphaMaskNonIndexedF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
+uniform sampler2D diffuseMap;
+
+vec3 atmosLighting(vec3 light);
+vec4 applyWaterFog(vec4 color);
+
+void default_lighting_water()
+{
+ vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+
+ if (color.a < minimum_alpha || color.a > maximum_alpha)
+ {
+ discard;
+ }
+
+ color.rgb = atmosLighting(color.rgb);
+
+ color = applyWaterFog(color);
+
+ gl_FragColor = color;
+}
+
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index ddcf42e523..9719140a37 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -88,16 +88,13 @@ void LLDrawPoolAlpha::endDeferredPass(S32 pass)
void LLDrawPoolAlpha::renderDeferred(S32 pass)
{
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.f);
- {
- LLFastTimer t(FTM_RENDER_GRASS);
- gDeferredTreeProgram.bind();
- LLGLEnable test(GL_ALPHA_TEST);
- //render alpha masked objects
- LLRenderPass::renderTexture(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask());
- gDeferredTreeProgram.unbind();
- }
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ LLFastTimer t(FTM_RENDER_GRASS);
+ gDeferredDiffuseAlphaMaskProgram.bind();
+ gDeferredDiffuseAlphaMaskProgram.setAlphaRange(0.33f, 1.f);
+
+ //render alpha masked objects
+ LLRenderPass::pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
+ gDeferredDiffuseAlphaMaskProgram.unbind();
}
@@ -124,7 +121,7 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass)
if (pass == 0)
{
simple_shader = &gDeferredAlphaProgram;
- fullbright_shader = &gObjectFullbrightProgram;
+ fullbright_shader = &gObjectFullbrightAlphaMaskProgram;
//prime simple shader (loads shadow relevant uniforms)
gPipeline.bindDeferredShader(*simple_shader);
@@ -138,7 +135,8 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass)
gPipeline.mDeferredDepth.bindTarget();
simple_shader = NULL;
fullbright_shader = NULL;
- gObjectFullbrightProgram.bind();
+ gObjectFullbrightAlphaMaskProgram.bind();
+ gObjectFullbrightAlphaMaskProgram.setAlphaRange(0.33f, 1.f);
}
deferred_render = TRUE;
@@ -157,7 +155,7 @@ void LLDrawPoolAlpha::endPostDeferredPass(S32 pass)
{
gPipeline.mDeferredDepth.flush();
gPipeline.mScreen.bindTarget();
- gObjectFullbrightProgram.unbind();
+ gObjectFullbrightAlphaMaskProgram.unbind();
}
deferred_render = FALSE;
@@ -175,13 +173,13 @@ void LLDrawPoolAlpha::beginRenderPass(S32 pass)
if (LLPipeline::sUnderWaterRender)
{
- simple_shader = &gObjectSimpleWaterProgram;
- fullbright_shader = &gObjectFullbrightWaterProgram;
+ simple_shader = &gObjectSimpleWaterAlphaMaskProgram;
+ fullbright_shader = &gObjectFullbrightWaterAlphaMaskProgram;
}
else
{
- simple_shader = &gObjectSimpleProgram;
- fullbright_shader = &gObjectFullbrightProgram;
+ simple_shader = &gObjectSimpleAlphaMaskProgram;
+ fullbright_shader = &gObjectFullbrightAlphaMaskProgram;
}
if (mVertexShaderLevel > 0)
@@ -227,29 +225,32 @@ void LLDrawPoolAlpha::render(S32 pass)
mAlphaDFactor = LLRender::BF_ZERO; // block (zero-out) glow where the alpha test succeeds
gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.33f);
if (mVertexShaderLevel > 0)
{
- if (!LLPipeline::sRenderDeferred)
+ if (!LLPipeline::sRenderDeferred || !deferred_render)
{
simple_shader->bind();
+ simple_shader->setAlphaRange(0.33f, 1.f);
+
pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
}
if (fullbright_shader)
{
fullbright_shader->bind();
+ fullbright_shader->setAlphaRange(0.33f, 1.f);
}
pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
//LLGLSLShader::bindNoShader();
}
else
{
+ gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.33f); //OK
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask());
gPipeline.enableLightsDynamic();
pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask());
+ gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); //OK
}
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
LLGLDepthTest depth(GL_TRUE, LLDrawPoolWater::sSkipScreenCopy ||
@@ -257,7 +258,6 @@ void LLDrawPoolAlpha::render(S32 pass)
if (deferred_render && pass == 1)
{
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.33f);
gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA);
}
else
@@ -268,13 +268,33 @@ void LLDrawPoolAlpha::render(S32 pass)
mAlphaDFactor = LLRender::BF_ONE_MINUS_SOURCE_ALPHA; // }
gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
- if (LLPipeline::sImpostorRender)
+ if (mVertexShaderLevel > 0)
{
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
+ if (LLPipeline::sImpostorRender)
+ {
+ fullbright_shader->bind();
+ fullbright_shader->setAlphaRange(0.5f, 1.f);
+ simple_shader->bind();
+ simple_shader->setAlphaRange(0.5f, 1.f);
+ }
+ else
+ {
+ fullbright_shader->bind();
+ fullbright_shader->setAlphaRange(0.f, 1.f);
+ simple_shader->bind();
+ simple_shader->setAlphaRange(0.f, 1.f);
+ }
}
else
{
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ if (LLPipeline::sImpostorRender)
+ {
+ gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); //OK
+ }
+ else
+ {
+ gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); //OK
+ }
}
}
@@ -291,7 +311,6 @@ void LLDrawPoolAlpha::render(S32 pass)
if (deferred_render && pass == 1)
{
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index 9f790d03fe..28e464b60d 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -258,7 +258,6 @@ void LLDrawPoolAvatar::beginPostDeferredAlpha()
sSkipOpaque = TRUE;
sShaderLevel = mVertexShaderLevel;
sVertexProgram = &gDeferredAvatarAlphaProgram;
-
sRenderingSkinned = TRUE;
gPipeline.bindDeferredShader(*sVertexProgram);
@@ -361,7 +360,7 @@ void LLDrawPoolAvatar::beginShadowPass(S32 pass)
{
gAvatarMatrixParam = sVertexProgram->mUniform[LLViewerShaderMgr::AVATAR_MATRIX];
}
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER_EQUAL, 0.2f);
+ //gGL.setAlphaRejectSettings(LLRender::CF_GREATER_EQUAL, 0.2f);
glColor4f(1,1,1,1);
@@ -590,12 +589,22 @@ void LLDrawPoolAvatar::beginImpostor()
LLVOAvatar::sNumVisibleAvatars = 0;
}
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gImpostorProgram.bind();
+ gImpostorProgram.setAlphaRange(0.01f, 1.f);
+ }
+
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
sDiffuseChannel = 0;
}
void LLDrawPoolAvatar::endImpostor()
{
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gImpostorProgram.unbind();
+ }
gPipeline.enableLightsDynamic();
}
@@ -605,16 +614,17 @@ void LLDrawPoolAvatar::beginRigid()
{
if (LLPipeline::sUnderWaterRender)
{
- sVertexProgram = &gObjectSimpleNonIndexedWaterProgram;
+ sVertexProgram = &gObjectAlphaMaskNonIndexedWaterProgram;
}
else
{
- sVertexProgram = &gObjectSimpleNonIndexedProgram;
+ sVertexProgram = &gObjectAlphaMaskNonIndexedProgram;
}
if (sVertexProgram != NULL)
{ //eyeballs render with the specular shader
sVertexProgram->bind();
+ sVertexProgram->setAlphaRange(0.2f, 1.f);
}
}
else
@@ -647,6 +657,7 @@ void LLDrawPoolAvatar::beginDeferredImpostor()
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
sVertexProgram->bind();
+ sVertexProgram->setAlphaRange(0.01f, 1.f);
}
void LLDrawPoolAvatar::endDeferredImpostor()
@@ -692,11 +703,11 @@ void LLDrawPoolAvatar::beginSkinned()
{
if (LLPipeline::sUnderWaterRender)
{
- sVertexProgram = &gObjectSimpleNonIndexedWaterProgram;
+ sVertexProgram = &gObjectAlphaMaskNonIndexedWaterProgram;
}
else
{
- sVertexProgram = &gObjectSimpleNonIndexedProgram;
+ sVertexProgram = &gObjectAlphaMaskNonIndexedProgram;
}
}
@@ -728,6 +739,11 @@ void LLDrawPoolAvatar::beginSkinned()
sVertexProgram->bind();
}
}
+
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ sVertexProgram->setAlphaRange(0.2f, 1.f);
+ }
}
void LLDrawPoolAvatar::endSkinned()
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index d801f6df18..0742250b0b 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -155,6 +155,7 @@ void LLStandardBumpmap::addstandard()
LLViewerTextureManager::getFetchedTexture(LLUUID(bump_image_id));
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLViewerTexture::BOOST_BUMP) ;
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL );
+ gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->forceToSaveRawImage(0) ;
LLStandardBumpmap::sStandardBumpmapCount++;
}
@@ -1073,11 +1074,12 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText
if (!src_image->hasCallbacks())
{ //if image has no callbacks but resolutions don't match, trigger raw image loaded callback again
if (src_image->getWidth() != bump->getWidth() ||
- src_image->getHeight() != bump->getHeight() ||
- (LLPipeline::sRenderDeferred && bump->getComponents() != 4))
+ src_image->getHeight() != bump->getHeight())// ||
+ //(LLPipeline::sRenderDeferred && bump->getComponents() != 4))
{
src_image->setBoostLevel(LLViewerTexture::BOOST_BUMP) ;
src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL );
+ src_image->forceToSaveRawImage(0) ;
}
}
}
diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp
index 224f149c6b..eec4ee6bac 100644
--- a/indra/newview/lldrawpoolsimple.cpp
+++ b/indra/newview/lldrawpoolsimple.cpp
@@ -182,7 +182,6 @@ void LLDrawPoolSimple::endRenderPass(S32 pass)
void LLDrawPoolSimple::render(S32 pass)
{
LLGLDisable blend(GL_BLEND);
- LLGLDisable alpha_test(GL_ALPHA_TEST);
{ //render simple
LLFastTimer t(FTM_RENDER_SIMPLE);
@@ -202,6 +201,7 @@ void LLDrawPoolSimple::render(S32 pass)
}
else
{
+ LLGLDisable alpha_test(GL_ALPHA_TEST);
renderTexture(LLRenderPass::PASS_SIMPLE, getVertexDataMask());
}
@@ -256,19 +256,21 @@ void LLDrawPoolGrass::beginRenderPass(S32 pass)
if (LLPipeline::sUnderWaterRender)
{
- simple_shader = &gObjectSimpleNonIndexedWaterProgram;
+ simple_shader = &gObjectAlphaMaskNonIndexedWaterProgram;
}
else
{
- simple_shader = &gObjectSimpleNonIndexedProgram;
+ simple_shader = &gObjectAlphaMaskNonIndexedProgram;
}
if (mVertexShaderLevel > 0)
{
simple_shader->bind();
+ simple_shader->setAlphaRange(0.5f, 1.f);
}
else
{
+ gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
// don't use shaders!
if (gGLManager.mHasShaderObjects)
{
@@ -286,22 +288,23 @@ void LLDrawPoolGrass::endRenderPass(S32 pass)
{
simple_shader->unbind();
}
+ else
+ {
+ gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ }
}
void LLDrawPoolGrass::render(S32 pass)
{
LLGLDisable blend(GL_BLEND);
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
-
+
{
LLFastTimer t(FTM_RENDER_GRASS);
LLGLEnable test(GL_ALPHA_TEST);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
//render grass
LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask());
- }
-
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ }
}
void LLDrawPoolGrass::beginDeferredPass(S32 pass)
@@ -316,17 +319,13 @@ void LLDrawPoolGrass::endDeferredPass(S32 pass)
void LLDrawPoolGrass::renderDeferred(S32 pass)
{
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.f);
-
{
LLFastTimer t(FTM_RENDER_GRASS_DEFERRED);
- gDeferredTreeProgram.bind();
- LLGLEnable test(GL_ALPHA_TEST);
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.bind();
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.setAlphaRange(0.5f, 1.f);
//render grass
LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask());
}
-
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp
index 429e06b227..a6e0151114 100644
--- a/indra/newview/lldrawpooltree.cpp
+++ b/indra/newview/lldrawpooltree.cpp
@@ -62,24 +62,25 @@ void LLDrawPoolTree::prerender()
void LLDrawPoolTree::beginRenderPass(S32 pass)
{
LLFastTimer t(FTM_RENDER_TREES);
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
-
+
if (LLPipeline::sUnderWaterRender)
{
- shader = &gObjectSimpleNonIndexedWaterProgram;
+ shader = &gObjectAlphaMaskNonIndexedWaterProgram;
}
else
{
- shader = &gObjectSimpleNonIndexedProgram;
+ shader = &gObjectAlphaMaskNonIndexedProgram;
}
if (gPipeline.canUseVertexShaders())
{
shader->bind();
+ shader->setAlphaRange(0.5f, 1.f);
}
else
{
gPipeline.enableLightsDynamic();
+ gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
}
}
@@ -92,7 +93,7 @@ void LLDrawPoolTree::render(S32 pass)
return;
}
- LLGLEnable test(GL_ALPHA_TEST);
+ LLGLState test(GL_ALPHA_TEST, LLGLSLShader::sNoFixedFunction ? 0 : 1);
LLOverrideFaceColor color(this, 1.f, 1.f, 1.f, 1.f);
if (gSavedSettings.getBOOL("RenderAnimateTrees"))
@@ -121,12 +122,16 @@ void LLDrawPoolTree::render(S32 pass)
void LLDrawPoolTree::endRenderPass(S32 pass)
{
LLFastTimer t(FTM_RENDER_TREES);
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
-
+
if (gPipeline.canUseWindLightShadersOnObjects())
{
shader->unbind();
}
+
+ if (mVertexShaderLevel <= 0)
+ {
+ gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ }
}
//============================================
@@ -135,10 +140,10 @@ void LLDrawPoolTree::endRenderPass(S32 pass)
void LLDrawPoolTree::beginDeferredPass(S32 pass)
{
LLFastTimer t(FTM_RENDER_TREES);
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.f);
- shader = &gDeferredTreeProgram;
+ shader = &gDeferredNonIndexedDiffuseAlphaMaskProgram;
shader->bind();
+ shader->setAlphaRange(0.5f, 1.f);
}
void LLDrawPoolTree::renderDeferred(S32 pass)
@@ -149,8 +154,7 @@ void LLDrawPoolTree::renderDeferred(S32 pass)
void LLDrawPoolTree::endDeferredPass(S32 pass)
{
LLFastTimer t(FTM_RENDER_TREES);
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
-
+
shader->unbind();
}
@@ -160,11 +164,12 @@ void LLDrawPoolTree::endDeferredPass(S32 pass)
void LLDrawPoolTree::beginShadowPass(S32 pass)
{
LLFastTimer t(FTM_SHADOW_TREE);
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
+
glPolygonOffset(gSavedSettings.getF32("RenderDeferredTreeShadowOffset"),
gSavedSettings.getF32("RenderDeferredTreeShadowBias"));
- gDeferredShadowProgram.bind();
+ gDeferredShadowAlphaMaskProgram.bind();
+ gDeferredShadowAlphaMaskProgram.setAlphaRange(0.5f, 1.f);
}
void LLDrawPoolTree::renderShadow(S32 pass)
@@ -175,12 +180,9 @@ void LLDrawPoolTree::renderShadow(S32 pass)
void LLDrawPoolTree::endShadowPass(S32 pass)
{
LLFastTimer t(FTM_SHADOW_TREE);
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
-
+
glPolygonOffset(gSavedSettings.getF32("RenderDeferredSpotShadowOffset"),
gSavedSettings.getF32("RenderDeferredSpotShadowBias"));
-
- //gDeferredShadowProgram.unbind();
}
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index a219386b53..79a835fd14 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -233,8 +233,7 @@ void LLDrawPoolWLSky::renderSkyClouds(F32 camHeightLocal) const
{
LLGLEnable blend(GL_BLEND);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
-
+
gGL.getTexUnit(0)->bind(sCloudNoiseTexture);
cloud_shader->bind();
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index 842911ecc0..fa3f546157 100644
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -620,7 +620,7 @@ void LLViewerParcelMgr::renderCollisionSegments(U8* segments, BOOL use_pass, LLV
F32 pos_y = pos.mV[VY];
LLGLSUIDefault gls_ui;
- LLGLDepthTest gls_depth(GL_TRUE);
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
LLGLDisable cull(GL_CULL_FACE);
if (mCollisionBanned == BA_BANNED)
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 8fa4065fa6..26b2b0f5c3 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -5123,7 +5123,6 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
gGL.getTexUnit(0)->bind(mSilhouetteImagep);
LLGLSPipelineSelection gls_select;
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.f);
LLGLEnable blend(GL_BLEND);
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
@@ -5250,7 +5249,6 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
}
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
void LLSelectMgr::generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point)
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index e23b431457..fd17781a2e 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -523,6 +523,11 @@ void LLSpatialGroup::clearDrawMap()
mDrawMap.clear();
}
+BOOL LLSpatialGroup::isHUDGroup()
+{
+ return mSpatialPartition && mSpatialPartition->isHUDPartition() ;
+}
+
BOOL LLSpatialGroup::isRecentlyVisible() const
{
return (LLDrawable::getCurrentFrame() - mVisible[LLViewerCamera::sCurCameraID]) < LLDrawable::getMinVisFrameRange() ;
@@ -4155,6 +4160,10 @@ void LLSpatialGroup::drawObjectBox(LLColor4 col)
drawBox(mObjectBounds[0], size);
}
+bool LLSpatialPartition::isHUDPartition()
+{
+ return mPartitionType == LLViewerRegion::PARTITION_HUD ;
+}
BOOL LLSpatialPartition::isVisible(const LLVector3& v)
{
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h
index 54d5d36f6e..11955540c6 100644
--- a/indra/newview/llspatialpartition.h
+++ b/indra/newview/llspatialpartition.h
@@ -282,6 +282,7 @@ public:
LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part);
+ BOOL isHUDGroup() ;
BOOL isDead() { return isState(DEAD); }
BOOL isState(U32 state) const;
BOOL isOcclusionState(U32 state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state ? TRUE : FALSE; }
@@ -470,6 +471,7 @@ public:
S32 cull(LLCamera &camera, std::vector<LLDrawable *>* results = NULL, BOOL for_select = FALSE); // Cull on arbitrary frustum
BOOL isVisible(const LLVector3& v);
+ bool isHUDPartition() ;
virtual LLSpatialBridge* asBridge() { return NULL; }
virtual BOOL isBridge() { return asBridge() != NULL; }
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 7991233ace..880b437404 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -2556,22 +2556,32 @@ void init_start_screen(S32 location_id)
else if(!start_image_bmp->load(temp_str) )
{
LL_WARNS("AppInit") << "Bitmap load failed" << LL_ENDL;
- return;
+ gStartTexture = NULL;
}
+ else
+ {
+ gStartImageWidth = start_image_bmp->getWidth();
+ gStartImageHeight = start_image_bmp->getHeight();
- gStartImageWidth = start_image_bmp->getWidth();
- gStartImageHeight = start_image_bmp->getHeight();
+ LLPointer<LLImageRaw> raw = new LLImageRaw;
+ if (!start_image_bmp->decode(raw, 0.0f))
+ {
+ LL_WARNS("AppInit") << "Bitmap decode failed" << LL_ENDL;
+ gStartTexture = NULL;
+ }
+ else
+ {
+ raw->expandToPowerOfTwo();
+ gStartTexture = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE) ;
+ }
+ }
- LLPointer<LLImageRaw> raw = new LLImageRaw;
- if (!start_image_bmp->decode(raw, 0.0f))
+ if(gStartTexture.isNull())
{
- LL_WARNS("AppInit") << "Bitmap decode failed" << LL_ENDL;
- gStartTexture = NULL;
- return;
+ gStartTexture = LLViewerTexture::sBlackImagep ;
+ gStartImageWidth = gStartTexture->getWidth() ;
+ gStartImageHeight = gStartTexture->getHeight() ;
}
-
- raw->expandToPowerOfTwo();
- gStartTexture = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE) ;
}
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index db2dc531db..17f908d73f 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -1193,6 +1193,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec
eCacheUpdateResult result = CACHE_UPDATE_ADDED;
if (mImpl->mCacheMap.size() > MAX_OBJECT_CACHE_ENTRIES)
{
+ delete mImpl->mCacheMap.begin()->second ;
mImpl->mCacheMap.erase(mImpl->mCacheMap.begin());
result = CACHE_UPDATE_REPLACED;
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 62d83b516f..36106752a2 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -70,8 +70,12 @@ LLGLSLShader gTwoTextureAddProgram;
//object shaders
LLGLSLShader gObjectSimpleProgram;
LLGLSLShader gObjectSimpleWaterProgram;
+LLGLSLShader gObjectSimpleAlphaMaskProgram;
+LLGLSLShader gObjectSimpleWaterAlphaMaskProgram;
LLGLSLShader gObjectFullbrightProgram;
LLGLSLShader gObjectFullbrightWaterProgram;
+LLGLSLShader gObjectFullbrightAlphaMaskProgram;
+LLGLSLShader gObjectFullbrightWaterAlphaMaskProgram;
LLGLSLShader gObjectFullbrightShinyProgram;
LLGLSLShader gObjectFullbrightShinyWaterProgram;
LLGLSLShader gObjectShinyProgram;
@@ -80,6 +84,8 @@ LLGLSLShader gObjectBumpProgram;
LLGLSLShader gObjectSimpleNonIndexedProgram;
LLGLSLShader gObjectSimpleNonIndexedWaterProgram;
+LLGLSLShader gObjectAlphaMaskNonIndexedProgram;
+LLGLSLShader gObjectAlphaMaskNonIndexedWaterProgram;
LLGLSLShader gObjectFullbrightNonIndexedProgram;
LLGLSLShader gObjectFullbrightNonIndexedWaterProgram;
LLGLSLShader gObjectFullbrightShinyNonIndexedProgram;
@@ -112,6 +118,7 @@ LLGLSLShader gAvatarProgram;
LLGLSLShader gAvatarWaterProgram;
LLGLSLShader gAvatarEyeballProgram;
LLGLSLShader gAvatarPickProgram;
+LLGLSLShader gImpostorProgram;
// WindLight shader handles
LLGLSLShader gWLSkyProgram;
@@ -128,7 +135,9 @@ LLGLSLShader gDeferredImpostorProgram;
LLGLSLShader gDeferredEdgeProgram;
LLGLSLShader gDeferredWaterProgram;
LLGLSLShader gDeferredDiffuseProgram;
+LLGLSLShader gDeferredDiffuseAlphaMaskProgram;
LLGLSLShader gDeferredNonIndexedDiffuseProgram;
+LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskProgram;
LLGLSLShader gDeferredSkinnedDiffuseProgram;
LLGLSLShader gDeferredSkinnedBumpProgram;
LLGLSLShader gDeferredSkinnedAlphaProgram;
@@ -145,6 +154,7 @@ LLGLSLShader gDeferredSunProgram;
LLGLSLShader gDeferredBlurLightProgram;
LLGLSLShader gDeferredSoftenProgram;
LLGLSLShader gDeferredShadowProgram;
+LLGLSLShader gDeferredShadowAlphaMaskProgram;
LLGLSLShader gDeferredAvatarShadowProgram;
LLGLSLShader gDeferredAttachmentShadowProgram;
LLGLSLShader gDeferredAlphaProgram;
@@ -177,6 +187,8 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gWaterProgram);
mShaderList.push_back(&gAvatarEyeballProgram);
mShaderList.push_back(&gObjectSimpleProgram);
+ mShaderList.push_back(&gImpostorProgram);
+ mShaderList.push_back(&gObjectSimpleAlphaMaskProgram);
mShaderList.push_back(&gObjectBumpProgram);
mShaderList.push_back(&gUIProgram);
mShaderList.push_back(&gCustomAlphaProgram);
@@ -185,10 +197,13 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gSolidColorProgram);
mShaderList.push_back(&gOcclusionProgram);
mShaderList.push_back(&gObjectFullbrightProgram);
+ mShaderList.push_back(&gObjectFullbrightAlphaMaskProgram);
mShaderList.push_back(&gObjectFullbrightShinyProgram);
mShaderList.push_back(&gObjectFullbrightShinyWaterProgram);
mShaderList.push_back(&gObjectSimpleNonIndexedProgram);
mShaderList.push_back(&gObjectSimpleNonIndexedWaterProgram);
+ mShaderList.push_back(&gObjectAlphaMaskNonIndexedProgram);
+ mShaderList.push_back(&gObjectAlphaMaskNonIndexedWaterProgram);
mShaderList.push_back(&gObjectFullbrightNonIndexedProgram);
mShaderList.push_back(&gObjectFullbrightNonIndexedWaterProgram);
mShaderList.push_back(&gObjectFullbrightShinyNonIndexedProgram);
@@ -205,6 +220,8 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gTerrainWaterProgram);
mShaderList.push_back(&gObjectSimpleWaterProgram);
mShaderList.push_back(&gObjectFullbrightWaterProgram);
+ mShaderList.push_back(&gObjectSimpleWaterAlphaMaskProgram);
+ mShaderList.push_back(&gObjectFullbrightWaterAlphaMaskProgram);
mShaderList.push_back(&gAvatarWaterProgram);
mShaderList.push_back(&gObjectShinyWaterProgram);
mShaderList.push_back(&gObjectShinyNonIndexedWaterProgram);
@@ -623,10 +640,15 @@ void LLViewerShaderMgr::unloadShaders()
gSolidColorProgram.unload();
gObjectSimpleProgram.unload();
+ gImpostorProgram.unload();
+ gObjectSimpleAlphaMaskProgram.unload();
gObjectBumpProgram.unload();
gObjectSimpleWaterProgram.unload();
+ gObjectSimpleWaterAlphaMaskProgram.unload();
gObjectFullbrightProgram.unload();
gObjectFullbrightWaterProgram.unload();
+ gObjectFullbrightAlphaMaskProgram.unload();
+ gObjectFullbrightWaterAlphaMaskProgram.unload();
gObjectShinyProgram.unload();
gObjectFullbrightShinyProgram.unload();
@@ -635,6 +657,8 @@ void LLViewerShaderMgr::unloadShaders()
gObjectSimpleNonIndexedProgram.unload();
gObjectSimpleNonIndexedWaterProgram.unload();
+ gObjectAlphaMaskNonIndexedProgram.unload();
+ gObjectAlphaMaskNonIndexedWaterProgram.unload();
gObjectFullbrightNonIndexedProgram.unload();
gObjectFullbrightNonIndexedWaterProgram.unload();
@@ -673,6 +697,8 @@ void LLViewerShaderMgr::unloadShaders()
gPostNightVisionProgram.unload();
gDeferredDiffuseProgram.unload();
+ gDeferredDiffuseAlphaMaskProgram.unload();
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.unload();
gDeferredNonIndexedDiffuseProgram.unload();
gDeferredSkinnedDiffuseProgram.unload();
gDeferredSkinnedBumpProgram.unload();
@@ -766,17 +792,25 @@ BOOL LLViewerShaderMgr::loadBasicShaders()
index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/transportF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "environment/waterFogF.glsl", mVertexShaderLevel[SHADER_WATER] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightAlphaMaskNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightNonIndexedAlphaMaskF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightWaterNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightWaterAlphaMaskNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightWaterNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightShinyNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightShinyNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightShinyWaterNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightShinyWaterNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightAlphaMaskF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightFullbrightF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightFullbrightAlphaMaskF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightWaterAlphaMaskF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightFullbrightWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
+ index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightFullbrightWaterAlphaMaskF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightShinyF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightFullbrightShinyF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightShinyWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) );
@@ -1022,6 +1056,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
{
gDeferredTreeProgram.unload();
gDeferredDiffuseProgram.unload();
+ gDeferredDiffuseAlphaMaskProgram.unload();
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.unload();
gDeferredNonIndexedDiffuseProgram.unload();
gDeferredSkinnedDiffuseProgram.unload();
gDeferredSkinnedBumpProgram.unload();
@@ -1037,6 +1073,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredBlurLightProgram.unload();
gDeferredSoftenProgram.unload();
gDeferredShadowProgram.unload();
+ gDeferredShadowAlphaMaskProgram.unload();
gDeferredAvatarShadowProgram.unload();
gDeferredAttachmentShadowProgram.unload();
gDeferredAvatarProgram.unload();
@@ -1077,6 +1114,27 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
if (success)
{
+ gDeferredDiffuseAlphaMaskProgram.mName = "Deferred Diffuse Alpha Mask Shader";
+ gDeferredDiffuseAlphaMaskProgram.mShaderFiles.clear();
+ gDeferredDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER_ARB));
+ gDeferredDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskIndexedF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDeferredDiffuseAlphaMaskProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits;
+ gDeferredDiffuseAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+ success = gDeferredDiffuseAlphaMaskProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.mName = "Deferred Diffuse Non-Indexed Alpha Mask Shader";
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.clear();
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER_ARB));
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+ success = gDeferredNonIndexedDiffuseAlphaMaskProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gDeferredNonIndexedDiffuseProgram.mName = "Non Indexed Deferred Diffuse Shader";
gDeferredNonIndexedDiffuseProgram.mShaderFiles.clear();
gDeferredNonIndexedDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER_ARB));
@@ -1401,6 +1459,16 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
if (success)
{
+ gDeferredShadowAlphaMaskProgram.mName = "Deferred Shadow Alpha Mask Shader";
+ gDeferredShadowAlphaMaskProgram.mShaderFiles.clear();
+ gDeferredShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskV.glsl", GL_VERTEX_SHADER_ARB));
+ gDeferredShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDeferredShadowAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+ success = gDeferredShadowAlphaMaskProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gDeferredAvatarShadowProgram.mName = "Deferred Avatar Shadow Shader";
gDeferredAvatarShadowProgram.mFeatures.hasSkinning = true;
gDeferredAvatarShadowProgram.mShaderFiles.clear();
@@ -1613,16 +1681,23 @@ BOOL LLViewerShaderMgr::loadShadersObject()
gObjectFullbrightShinyWaterProgram.unload();
gObjectShinyWaterProgram.unload();
gObjectSimpleProgram.unload();
+ gImpostorProgram.unload();
+ gObjectSimpleAlphaMaskProgram.unload();
gObjectBumpProgram.unload();
gObjectSimpleWaterProgram.unload();
+ gObjectSimpleWaterAlphaMaskProgram.unload();
gObjectFullbrightProgram.unload();
+ gObjectFullbrightAlphaMaskProgram.unload();
gObjectFullbrightWaterProgram.unload();
+ gObjectFullbrightWaterAlphaMaskProgram.unload();
gObjectShinyNonIndexedProgram.unload();
gObjectFullbrightShinyNonIndexedProgram.unload();
gObjectFullbrightShinyNonIndexedWaterProgram.unload();
gObjectShinyNonIndexedWaterProgram.unload();
gObjectSimpleNonIndexedProgram.unload();
gObjectSimpleNonIndexedWaterProgram.unload();
+ gObjectAlphaMaskNonIndexedProgram.unload();
+ gObjectAlphaMaskNonIndexedWaterProgram.unload();
gObjectFullbrightNonIndexedProgram.unload();
gObjectFullbrightNonIndexedWaterProgram.unload();
gSkinnedObjectSimpleProgram.unload();
@@ -1672,6 +1747,41 @@ BOOL LLViewerShaderMgr::loadShadersObject()
if (success)
{
+ gObjectAlphaMaskNonIndexedProgram.mName = "Non indexed alpha mask Shader";
+ gObjectAlphaMaskNonIndexedProgram.mFeatures.calculatesLighting = true;
+ gObjectAlphaMaskNonIndexedProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectAlphaMaskNonIndexedProgram.mFeatures.hasGamma = true;
+ gObjectAlphaMaskNonIndexedProgram.mFeatures.hasAtmospherics = true;
+ gObjectAlphaMaskNonIndexedProgram.mFeatures.hasLighting = true;
+ gObjectAlphaMaskNonIndexedProgram.mFeatures.disableTextureIndex = true;
+ gObjectAlphaMaskNonIndexedProgram.mFeatures.hasAlphaMask = true;
+ gObjectAlphaMaskNonIndexedProgram.mShaderFiles.clear();
+ gObjectAlphaMaskNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectAlphaMaskNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectAlphaMaskNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectAlphaMaskNonIndexedProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gObjectAlphaMaskNonIndexedWaterProgram.mName = "Non indexed alpha mask Water Shader";
+ gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.calculatesLighting = true;
+ gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.hasWaterFog = true;
+ gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.hasAtmospherics = true;
+ gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.hasLighting = true;
+ gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.disableTextureIndex = true;
+ gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.hasAlphaMask = true;
+ gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.clear();
+ gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectAlphaMaskNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gObjectAlphaMaskNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gObjectAlphaMaskNonIndexedWaterProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gObjectFullbrightNonIndexedProgram.mName = "Non Indexed Fullbright Shader";
gObjectFullbrightNonIndexedProgram.mFeatures.calculatesAtmospherics = true;
gObjectFullbrightNonIndexedProgram.mFeatures.hasGamma = true;
@@ -1770,6 +1880,17 @@ BOOL LLViewerShaderMgr::loadShadersObject()
if (success)
{
+ gImpostorProgram.mName = "Impostor Shader";
+ gImpostorProgram.mFeatures.disableTextureIndex = true;
+ gImpostorProgram.mShaderFiles.clear();
+ gImpostorProgram.mShaderFiles.push_back(make_pair("objects/impostorV.glsl", GL_VERTEX_SHADER_ARB));
+ gImpostorProgram.mShaderFiles.push_back(make_pair("objects/impostorF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gImpostorProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gImpostorProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gObjectSimpleProgram.mName = "Simple Shader";
gObjectSimpleProgram.mFeatures.calculatesLighting = true;
gObjectSimpleProgram.mFeatures.calculatesAtmospherics = true;
@@ -1783,6 +1904,23 @@ BOOL LLViewerShaderMgr::loadShadersObject()
gObjectSimpleProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
success = gObjectSimpleProgram.createShader(NULL, NULL);
}
+
+ if (success)
+ {
+ gObjectSimpleAlphaMaskProgram.mName = "Simple Alpha Mask Shader";
+ gObjectSimpleAlphaMaskProgram.mFeatures.calculatesLighting = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.hasGamma = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.hasAtmospherics = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.hasLighting = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.hasAlphaMask = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.mIndexedTextureChannels = 0;
+ gObjectSimpleAlphaMaskProgram.mShaderFiles.clear();
+ gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectSimpleAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectSimpleAlphaMaskProgram.createShader(NULL, NULL);
+ }
if (success)
{
@@ -1819,6 +1957,24 @@ BOOL LLViewerShaderMgr::loadShadersObject()
if (success)
{
+ gObjectSimpleWaterAlphaMaskProgram.mName = "Simple Water Alpha Mask Shader";
+ gObjectSimpleWaterAlphaMaskProgram.mFeatures.calculatesLighting = true;
+ gObjectSimpleWaterAlphaMaskProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectSimpleWaterAlphaMaskProgram.mFeatures.hasWaterFog = true;
+ gObjectSimpleWaterAlphaMaskProgram.mFeatures.hasAtmospherics = true;
+ gObjectSimpleWaterAlphaMaskProgram.mFeatures.hasLighting = true;
+ gObjectSimpleWaterAlphaMaskProgram.mFeatures.hasAlphaMask = true;
+ gObjectSimpleWaterAlphaMaskProgram.mFeatures.mIndexedTextureChannels = 0;
+ gObjectSimpleWaterAlphaMaskProgram.mShaderFiles.clear();
+ gObjectSimpleWaterAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectSimpleWaterAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectSimpleWaterAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gObjectSimpleWaterAlphaMaskProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gObjectSimpleWaterAlphaMaskProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gObjectFullbrightProgram.mName = "Fullbright Shader";
gObjectFullbrightProgram.mFeatures.calculatesAtmospherics = true;
gObjectFullbrightProgram.mFeatures.hasGamma = true;
@@ -1850,6 +2006,39 @@ BOOL LLViewerShaderMgr::loadShadersObject()
if (success)
{
+ gObjectFullbrightAlphaMaskProgram.mName = "Fullbright Alpha Mask Shader";
+ gObjectFullbrightAlphaMaskProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectFullbrightAlphaMaskProgram.mFeatures.hasGamma = true;
+ gObjectFullbrightAlphaMaskProgram.mFeatures.hasTransport = true;
+ gObjectFullbrightAlphaMaskProgram.mFeatures.isFullbright = true;
+ gObjectFullbrightAlphaMaskProgram.mFeatures.hasAlphaMask = true;
+ gObjectFullbrightAlphaMaskProgram.mFeatures.mIndexedTextureChannels = 0;
+ gObjectFullbrightAlphaMaskProgram.mShaderFiles.clear();
+ gObjectFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/fullbrightV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectFullbrightAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectFullbrightAlphaMaskProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gObjectFullbrightWaterAlphaMaskProgram.mName = "Fullbright Water Shader";
+ gObjectFullbrightWaterAlphaMaskProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectFullbrightWaterAlphaMaskProgram.mFeatures.isFullbright = true;
+ gObjectFullbrightWaterAlphaMaskProgram.mFeatures.hasWaterFog = true;
+ gObjectFullbrightWaterAlphaMaskProgram.mFeatures.hasTransport = true;
+ gObjectFullbrightWaterAlphaMaskProgram.mFeatures.hasAlphaMask = true;
+ gObjectFullbrightWaterAlphaMaskProgram.mFeatures.mIndexedTextureChannels = 0;
+ gObjectFullbrightWaterAlphaMaskProgram.mShaderFiles.clear();
+ gObjectFullbrightWaterAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/fullbrightV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectFullbrightWaterAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectFullbrightWaterAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gObjectFullbrightWaterAlphaMaskProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gObjectFullbrightWaterAlphaMaskProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gObjectShinyProgram.mName = "Shiny Shader";
gObjectShinyProgram.mFeatures.calculatesAtmospherics = true;
gObjectShinyProgram.mFeatures.calculatesLighting = true;
@@ -2092,6 +2281,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
gAvatarProgram.mFeatures.hasGamma = true;
gAvatarProgram.mFeatures.hasAtmospherics = true;
gAvatarProgram.mFeatures.hasLighting = true;
+ gAvatarProgram.mFeatures.hasAlphaMask = true;
gAvatarProgram.mFeatures.disableTextureIndex = true;
gAvatarProgram.mShaderFiles.clear();
gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarV.glsl", GL_VERTEX_SHADER_ARB));
@@ -2108,6 +2298,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
gAvatarWaterProgram.mFeatures.hasWaterFog = true;
gAvatarWaterProgram.mFeatures.hasAtmospherics = true;
gAvatarWaterProgram.mFeatures.hasLighting = true;
+ gAvatarWaterProgram.mFeatures.hasAlphaMask = true;
gAvatarWaterProgram.mFeatures.disableTextureIndex = true;
gAvatarWaterProgram.mShaderFiles.clear();
gAvatarWaterProgram.mShaderFiles.push_back(make_pair("avatar/avatarV.glsl", GL_VERTEX_SHADER_ARB));
@@ -2146,6 +2337,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
gAvatarEyeballProgram.mFeatures.hasGamma = true;
gAvatarEyeballProgram.mFeatures.hasAtmospherics = true;
gAvatarEyeballProgram.mFeatures.hasLighting = true;
+ gAvatarEyeballProgram.mFeatures.hasAlphaMask = true;
gAvatarEyeballProgram.mFeatures.disableTextureIndex = true;
gAvatarEyeballProgram.mShaderFiles.clear();
gAvatarEyeballProgram.mShaderFiles.push_back(make_pair("avatar/eyeballV.glsl", GL_VERTEX_SHADER_ARB));
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
index 93a0ecc4f0..d4040f11e1 100644
--- a/indra/newview/llviewershadermgr.h
+++ b/indra/newview/llviewershadermgr.h
@@ -297,11 +297,17 @@ extern LLGLSLShader gTwoTextureAddProgram;
//object shaders
extern LLGLSLShader gObjectSimpleProgram;
+extern LLGLSLShader gObjectSimpleAlphaMaskProgram;
extern LLGLSLShader gObjectSimpleWaterProgram;
+extern LLGLSLShader gObjectSimpleWaterAlphaMaskProgram;
extern LLGLSLShader gObjectSimpleNonIndexedProgram;
extern LLGLSLShader gObjectSimpleNonIndexedWaterProgram;
+extern LLGLSLShader gObjectAlphaMaskNonIndexedProgram;
+extern LLGLSLShader gObjectAlphaMaskNonIndexedWaterProgram;
extern LLGLSLShader gObjectFullbrightProgram;
extern LLGLSLShader gObjectFullbrightWaterProgram;
+extern LLGLSLShader gObjectFullbrightAlphaMaskProgram;
+extern LLGLSLShader gObjectFullbrightWaterAlphaMaskProgram;
extern LLGLSLShader gObjectFullbrightNonIndexedProgram;
extern LLGLSLShader gObjectFullbrightNonIndexedWaterProgram;
extern LLGLSLShader gObjectBumpProgram;
@@ -345,6 +351,7 @@ extern LLGLSLShader gAvatarProgram;
extern LLGLSLShader gAvatarWaterProgram;
extern LLGLSLShader gAvatarEyeballProgram;
extern LLGLSLShader gAvatarPickProgram;
+extern LLGLSLShader gImpostorProgram;
// WindLight shader handles
extern LLGLSLShader gWLSkyProgram;
@@ -359,6 +366,8 @@ extern LLGLSLShader gDeferredImpostorProgram;
extern LLGLSLShader gDeferredEdgeProgram;
extern LLGLSLShader gDeferredWaterProgram;
extern LLGLSLShader gDeferredDiffuseProgram;
+extern LLGLSLShader gDeferredDiffuseAlphaMaskProgram;
+extern LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskProgram;
extern LLGLSLShader gDeferredNonIndexedDiffuseProgram;
extern LLGLSLShader gDeferredSkinnedDiffuseProgram;
extern LLGLSLShader gDeferredSkinnedBumpProgram;
@@ -377,6 +386,7 @@ extern LLGLSLShader gDeferredBlurLightProgram;
extern LLGLSLShader gDeferredAvatarProgram;
extern LLGLSLShader gDeferredSoftenProgram;
extern LLGLSLShader gDeferredShadowProgram;
+extern LLGLSLShader gDeferredShadowAlphaMaskProgram;
extern LLGLSLShader gDeferredPostGIProgram;
extern LLGLSLShader gDeferredPostProgram;
extern LLGLSLShader gDeferredPostNoDoFProgram;
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 5fcc57bc91..70509f9a9f 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -66,6 +66,7 @@
// statics
LLPointer<LLViewerTexture> LLViewerTexture::sNullImagep = NULL;
+LLPointer<LLViewerTexture> LLViewerTexture::sBlackImagep = NULL;
LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sMissingAssetImagep = NULL;
LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sWhiteImagep = NULL;
LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sDefaultImagep = NULL;
@@ -295,17 +296,23 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromHost(const
void LLViewerTextureManager::init()
{
- LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,3);
- raw->clear(0x77, 0x77, 0x77, 0xFF);
- LLViewerTexture::sNullImagep = LLViewerTextureManager::getLocalTexture(raw.get(), TRUE) ;
-
-#if 1
- LLPointer<LLViewerFetchedTexture> imagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT);
- LLViewerFetchedTexture::sDefaultImagep = imagep;
+ {
+ LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,3);
+ raw->clear(0x77, 0x77, 0x77, 0xFF);
+ LLViewerTexture::sNullImagep = LLViewerTextureManager::getLocalTexture(raw.get(), TRUE) ;
+ }
const S32 dim = 128;
LLPointer<LLImageRaw> image_raw = new LLImageRaw(dim,dim,3);
U8* data = image_raw->getData();
+
+ memset(data, 0, dim * dim * 3) ;
+ LLViewerTexture::sBlackImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE) ;
+
+#if 1
+ LLPointer<LLViewerFetchedTexture> imagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT);
+ LLViewerFetchedTexture::sDefaultImagep = imagep;
+
for (S32 i = 0; i<dim; i++)
{
for (S32 j = 0; j<dim; j++)
@@ -359,6 +366,7 @@ void LLViewerTextureManager::cleanup()
LLImageGL::sDefaultGLTexture = NULL ;
LLViewerTexture::sNullImagep = NULL;
+ LLViewerTexture::sBlackImagep = NULL;
LLViewerFetchedTexture::sDefaultImagep = NULL;
LLViewerFetchedTexture::sSmokeImagep = NULL;
LLViewerFetchedTexture::sMissingAssetImagep = NULL;
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index c5b8c8923a..de528927b4 100644
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -330,6 +330,7 @@ public:
static BOOL sUseTextureAtlas ;
static LLPointer<LLViewerTexture> sNullImagep; // Null texture for non-textured objects.
+ static LLPointer<LLViewerTexture> sBlackImagep; // Texture to show NOTHING (pure black)
};
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index b5be3cd552..7946846222 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -4225,7 +4225,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
bool should_alpha_mask = shouldAlphaMask();
LLGLState test(GL_ALPHA_TEST, should_alpha_mask);
- if (should_alpha_mask)
+ if (should_alpha_mask && !LLGLSLShader::sNoFixedFunction)
{
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
}
@@ -4254,7 +4254,10 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
}
}
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ if (should_alpha_mask && !LLGLSLShader::sNoFixedFunction)
+ {
+ gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ }
if (!LLDrawPoolAvatar::sSkipTransparent || LLPipeline::sImpostorRender)
{
@@ -4337,7 +4340,7 @@ U32 LLVOAvatar::renderRigid()
bool should_alpha_mask = shouldAlphaMask();
LLGLState test(GL_ALPHA_TEST, should_alpha_mask);
- if (should_alpha_mask)
+ if (should_alpha_mask && !LLGLSLShader::sNoFixedFunction)
{
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
}
@@ -4348,7 +4351,10 @@ U32 LLVOAvatar::renderRigid()
num_indices += mMeshLOD[MESH_ID_EYEBALL_RIGHT]->render(mAdjustedPixelArea, TRUE, mIsDummy);
}
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ if (should_alpha_mask && !LLGLSLShader::sNoFixedFunction)
+ {
+ gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ }
return num_indices;
}
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index f0b5b50feb..6d457434b5 100644
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -621,16 +621,20 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca
S32 num_entries;
success = check_read(&apr_file, &num_entries, sizeof(S32)) ;
- for (S32 i = 0; success && i < num_entries; i++)
+ if(success)
{
- LLVOCacheEntry* entry = new LLVOCacheEntry(&apr_file);
- if (!entry->getLocalID())
+ for (S32 i = 0; i < num_entries; i++)
{
- llwarns << "Aborting cache file load for " << filename << ", cache file corruption!" << llendl;
- delete entry ;
- success = false ;
+ LLVOCacheEntry* entry = new LLVOCacheEntry(&apr_file);
+ if (!entry->getLocalID())
+ {
+ llwarns << "Aborting cache file load for " << filename << ", cache file corruption!" << llendl;
+ delete entry ;
+ success = false ;
+ break ;
+ }
+ cache_entry_map[entry->getLocalID()] = entry;
}
- cache_entry_map[entry->getLocalID()] = entry;
}
}
}
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 30216f02db..528c7acbc8 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -704,19 +704,22 @@ BOOL LLVOVolume::isVisible() const
return FALSE ;
}
-void LLVOVolume::updateTextureVirtualSize()
+void LLVOVolume::updateTextureVirtualSize(bool forced)
{
LLFastTimer ftm(FTM_VOLUME_TEXTURES);
// Update the pixel area of all faces
- if(!isVisible())
+ if(!forced)
{
- return ;
- }
+ if(!isVisible())
+ {
+ return ;
+ }
- if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SIMPLE))
- {
- return;
+ if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SIMPLE))
+ {
+ return;
+ }
}
static LLCachedControl<bool> dont_load_textures(gSavedSettings,"TextureDisable");
@@ -3998,7 +4001,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
llassert_always(vobj);
- vobj->updateTextureVirtualSize();
+ vobj->updateTextureVirtualSize(true);
vobj->preRebuild();
drawablep->clearState(LLDrawable::HAS_ALPHA);
@@ -4487,6 +4490,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
std::sort(faces.begin(), faces.end(), LLFace::CompareDistanceGreater());
}
+ bool hud_group = group->isHUDGroup() ;
std::vector<LLFace*>::iterator face_iter = faces.begin();
LLSpatialGroup::buffer_map_t buffer_map;
@@ -4757,7 +4761,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
registerFace(group, facep, LLRenderPass::PASS_INVISI_SHINY);
registerFace(group, facep, LLRenderPass::PASS_INVISIBLE);
}
- else if (LLPipeline::sRenderDeferred)
+ else if (LLPipeline::sRenderDeferred && !hud_group)
{ //deferred rendering
if (te->getFullbright())
{ //register in post deferred fullbright shiny pass
@@ -4795,7 +4799,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
else if (fullbright || bake_sunlight)
{ //fullbright
registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT);
- if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && te->getBumpmap())
+ if (LLPipeline::sRenderDeferred && !hud_group && LLPipeline::sRenderBump && te->getBumpmap())
{ //if this is the deferred render and a bump map is present, register in post deferred bump
registerFace(group, facep, LLRenderPass::PASS_POST_BUMP);
}
@@ -4821,7 +4825,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
}
//not sure why this is here, and looks like it might cause bump mapped objects to get rendered redundantly -- davep 5/11/2010
- if (!is_alpha && !LLPipeline::sRenderDeferred)
+ if (!is_alpha && (hud_group || !LLPipeline::sRenderDeferred))
{
llassert((mask & LLVertexBuffer::MAP_NORMAL) || fullbright);
facep->setPoolType((fullbright) ? LLDrawPool::POOL_FULLBRIGHT : LLDrawPool::POOL_SIMPLE);
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index fc00f0c0d0..13565cb27c 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -206,7 +206,7 @@ public:
/*virtual*/ BOOL updateLOD();
void updateRadius();
/*virtual*/ void updateTextures();
- void updateTextureVirtualSize();
+ void updateTextureVirtualSize(bool forced = false);
void updateFaceFlags();
void regenFaces();
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 4899df13e5..7a26404138 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -3340,13 +3340,15 @@ void render_hud_elements()
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
gGL.color4f(1,1,1,1);
- if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
+
+ if (LLGLSLShader::sNoFixedFunction)
{
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
+ }
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE);
+ if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
+ {
LLGLEnable multisample(gSavedSettings.getU32("RenderFSAASamples") > 0 ? GL_MULTISAMPLE_ARB : 0);
gViewerWindow->renderSelections(FALSE, FALSE, FALSE); // For HUD version in render_ui_3d()
@@ -3360,10 +3362,6 @@ void render_hud_elements()
// Render name tags.
LLHUDObject::renderAll();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.unbind();
- }
}
else if (gForceRenderLandFence)
{
@@ -3374,6 +3372,11 @@ void render_hud_elements()
{
LLHUDText::renderAllHUD();
}
+
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.unbind();
+ }
gGL.flush();
}
@@ -3669,6 +3672,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
occlude = FALSE;
gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView);
+ LLGLSLShader::bindNoShader();
doOcclusion(camera);
}
@@ -3734,6 +3738,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
occlude = FALSE;
gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView);
+ LLGLSLShader::bindNoShader();
doOcclusion(camera);
}
}
@@ -3934,6 +3939,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
occlude = FALSE;
gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView);
+ LLGLSLShader::bindNoShader();
doOcclusion(camera);
gGL.setColorMask(true, false);
}
@@ -3999,6 +4005,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
occlude = FALSE;
gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView);
+ LLGLSLShader::bindNoShader();
doOcclusion(camera);
gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView);
@@ -6182,7 +6189,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
gGlowExtractProgram.uniform1f("warmthAmount", warmthAmount);
LLGLEnable blend_on(GL_BLEND);
LLGLEnable test(GL_ALPHA_TEST);
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+
gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
mScreen.bindTexture(0, 0);
@@ -8252,7 +8259,6 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
gOcclusionProgram.bind();
}
LLFastTimer ftm(FTM_SHADOW_SIMPLE);
- LLGLDisable test(GL_ALPHA_TEST);
gGL.getTexUnit(0)->disable();
for (U32 i = 0; i < sizeof(types)/sizeof(U32); ++i)
{
@@ -8278,12 +8284,11 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
{
LLFastTimer ftm(FTM_SHADOW_ALPHA);
- LLGLEnable test(GL_ALPHA_TEST);
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.6f);
+ gDeferredShadowAlphaMaskProgram.bind();
+ gDeferredShadowAlphaMaskProgram.setAlphaRange(0.6f, 1.f);
renderObjects(LLRenderPass::PASS_ALPHA_SHADOW, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR, TRUE);
glColor4f(1,1,1,1);
renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE);
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
//glCullFace(GL_BACK);
@@ -8768,6 +8773,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
LLPipeline::RENDER_TYPE_WATER,
LLPipeline::RENDER_TYPE_VOIDWATER,
LLPipeline::RENDER_TYPE_PASS_ALPHA_SHADOW,
+ LLPipeline::RENDER_TYPE_PASS_GRASS,
LLPipeline::RENDER_TYPE_PASS_SIMPLE,
LLPipeline::RENDER_TYPE_PASS_BUMP,
LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT,