summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/fullbrightAlphaMaskF.glsl70
-rwxr-xr-xindra/newview/lldrawpoolsimple.cpp15
-rwxr-xr-xindra/newview/llviewershadermgr.cpp17
-rwxr-xr-xindra/newview/llviewershadermgr.h1
4 files changed, 100 insertions, 3 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightAlphaMaskF.glsl
new file mode 100644
index 0000000000..5aa31b96df
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightAlphaMaskF.glsl
@@ -0,0 +1,70 @@
+/**
+ * @file fullbrightF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#extension GL_ARB_texture_rectangle : enable
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+#if !HAS_DIFFUSE_LOOKUP
+uniform sampler2D diffuseMap;
+#endif
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
+vec3 fullbrightAtmosTransport(vec3 light);
+vec3 fullbrightScaleSoftClip(vec3 light);
+
+uniform float minimum_alpha;
+
+void main()
+{
+#if HAS_DIFFUSE_LOOKUP
+ vec4 color = diffuseLookup(vary_texcoord0.xy);
+#else
+ vec4 color = texture2D(diffuseMap, vary_texcoord0.xy);
+#endif
+
+ if (color.a < minimum_alpha)
+ {
+ discard;
+ }
+
+ color.rgb = pow(color.rgb,vec3(2.2f,2.2f,2.2f));
+ color.rgb *= vertex_color.rgb;
+
+ color.rgb = fullbrightAtmosTransport(color.rgb);
+ color.rgb = fullbrightScaleSoftClip(color.rgb);
+
+ color.rgb = pow(color.rgb, vec3(1.0/2.2));
+
+ frag_color.rgb = color.rgb;
+ frag_color.a = color.a;
+}
+
diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp
index 2cf9d833c6..e219769a0c 100755
--- a/indra/newview/lldrawpoolsimple.cpp
+++ b/indra/newview/lldrawpoolsimple.cpp
@@ -625,14 +625,16 @@ S32 LLDrawPoolFullbright::getNumPasses()
void LLDrawPoolFullbrightAlphaMask::beginPostDeferredPass(S32 pass)
{
- gObjectFullbrightAlphaMaskProgram.bind();
+
if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred)
{
+ gObjectFullbrightAlphaMaskProgram.bind();
gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f);
}
else
{
- gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
+ gDeferredFullbrightAlphaMaskProgram.bind();
+ gDeferredFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
}
}
@@ -646,7 +648,14 @@ void LLDrawPoolFullbrightAlphaMask::renderPostDeferred(S32 pass)
void LLDrawPoolFullbrightAlphaMask::endPostDeferredPass(S32 pass)
{
- gObjectFullbrightAlphaMaskProgram.unbind();
+ if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred)
+ {
+ gObjectFullbrightAlphaMaskProgram.unbind();
+ }
+ else
+ {
+ gDeferredFullbrightAlphaMaskProgram.unbind();
+ }
LLRenderPass::endRenderPass(pass);
}
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 7bce629d3e..6d9a0dd261 100755
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -197,6 +197,7 @@ LLGLSLShader gDeferredAttachmentShadowProgram;
LLGLSLShader gDeferredAlphaProgram;
LLGLSLShader gDeferredAvatarEyesProgram;
LLGLSLShader gDeferredFullbrightProgram;
+LLGLSLShader gDeferredFullbrightAlphaMaskProgram;
LLGLSLShader gDeferredEmissiveProgram;
LLGLSLShader gDeferredPostProgram;
LLGLSLShader gDeferredCoFProgram;
@@ -290,6 +291,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gDeferredAlphaProgram);
mShaderList.push_back(&gDeferredSkinnedAlphaProgram);
mShaderList.push_back(&gDeferredFullbrightProgram);
+ mShaderList.push_back(&gDeferredFullbrightAlphaMaskProgram);
mShaderList.push_back(&gDeferredFullbrightShinyProgram);
mShaderList.push_back(&gDeferredSkinnedFullbrightShinyProgram);
mShaderList.push_back(&gDeferredSkinnedFullbrightProgram);
@@ -1130,6 +1132,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarAlphaProgram.unload();
gDeferredAlphaProgram.unload();
gDeferredFullbrightProgram.unload();
+ gDeferredFullbrightAlphaMaskProgram.unload();
gDeferredEmissiveProgram.unload();
gDeferredAvatarEyesProgram.unload();
gDeferredPostProgram.unload();
@@ -1495,6 +1498,20 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
if (success)
{
+ gDeferredFullbrightAlphaMaskProgram.mName = "Deferred Fullbright Alpha Mask Shader";
+ gDeferredFullbrightAlphaMaskProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredFullbrightAlphaMaskProgram.mFeatures.hasGamma = true;
+ gDeferredFullbrightAlphaMaskProgram.mFeatures.hasTransport = true;
+ gDeferredFullbrightAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
+ gDeferredFullbrightAlphaMaskProgram.mShaderFiles.clear();
+ gDeferredFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER_ARB));
+ gDeferredFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightAlphaMaskF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDeferredFullbrightAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+ success = gDeferredFullbrightAlphaMaskProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gDeferredFullbrightShinyProgram.mName = "Deferred FullbrightShiny Shader";
gDeferredFullbrightShinyProgram.mFeatures.calculatesAtmospherics = true;
gDeferredFullbrightShinyProgram.mFeatures.hasGamma = true;
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
index ed8167947d..f3a419b1f2 100755
--- a/indra/newview/llviewershadermgr.h
+++ b/indra/newview/llviewershadermgr.h
@@ -363,6 +363,7 @@ extern LLGLSLShader gDeferredAvatarShadowProgram;
extern LLGLSLShader gDeferredAttachmentShadowProgram;
extern LLGLSLShader gDeferredAlphaProgram;
extern LLGLSLShader gDeferredFullbrightProgram;
+extern LLGLSLShader gDeferredFullbrightAlphaMaskProgram;
extern LLGLSLShader gDeferredEmissiveProgram;
extern LLGLSLShader gDeferredAvatarEyesProgram;
extern LLGLSLShader gDeferredAvatarAlphaProgram;