summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llrender/llshadermgr.cpp193
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/cofF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/waterF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl2
30 files changed, 196 insertions, 67 deletions
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 55f0791174..19a9ced321 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -575,10 +575,13 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
//we can't have any lines longer than 1024 characters
//or any shaders longer than 4096 lines... deal - DaveP
- GLcharARB buff[1024];
- GLcharARB* text[4096];
- GLuint count = 0;
-
+ GLcharARB buff[1024];
+ GLcharARB *extra_code_text[1024];
+ GLcharARB *shader_code_text[4096 + LL_ARRAY_SIZE(extra_code_text)] = { NULL };
+ GLuint extra_code_count = 0, shader_code_count = 0;
+ BOOST_STATIC_ASSERT(LL_ARRAY_SIZE(extra_code_text) < LL_ARRAY_SIZE(shader_code_text));
+
+
S32 major_version = gGLManager.mGLSLVersionMajor;
S32 minor_version = gGLManager.mGLSLVersionMinor;
@@ -593,20 +596,20 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
if (minor_version <= 19)
{
- text[count++] = strdup("#version 110\n");
- text[count++] = strdup("#define ATTRIBUTE attribute\n");
- text[count++] = strdup("#define VARYING varying\n");
- text[count++] = strdup("#define VARYING_FLAT varying\n");
+ shader_code_text[shader_code_count++] = strdup("#version 110\n");
+ extra_code_text[extra_code_count++] = strdup("#define ATTRIBUTE attribute\n");
+ extra_code_text[extra_code_count++] = strdup("#define VARYING varying\n");
+ extra_code_text[extra_code_count++] = strdup("#define VARYING_FLAT varying\n");
}
else if (minor_version <= 29)
{
//set version to 1.20
- text[count++] = strdup("#version 120\n");
- text[count++] = strdup("#define FXAA_GLSL_120 1\n");
- text[count++] = strdup("#define FXAA_FAST_PIXEL_OFFSET 0\n");
- text[count++] = strdup("#define ATTRIBUTE attribute\n");
- text[count++] = strdup("#define VARYING varying\n");
- text[count++] = strdup("#define VARYING_FLAT varying\n");
+ shader_code_text[shader_code_count++] = strdup("#version 120\n");
+ extra_code_text[extra_code_count++] = strdup("#define FXAA_GLSL_120 1\n");
+ extra_code_text[extra_code_count++] = strdup("#define FXAA_FAST_PIXEL_OFFSET 0\n");
+ extra_code_text[extra_code_count++] = strdup("#define ATTRIBUTE attribute\n");
+ extra_code_text[extra_code_count++] = strdup("#define VARYING varying\n");
+ extra_code_text[extra_code_count++] = strdup("#define VARYING_FLAT varying\n");
}
}
else
@@ -614,44 +617,43 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
if (major_version < 4)
{
//set version to 1.30
- text[count++] = strdup("#version 130\n");
-
+ shader_code_text[shader_code_count++] = strdup("#version 130\n");
//some implementations of GLSL 1.30 require integer precision be explicitly declared
- text[count++] = strdup("precision mediump int;\n");
- text[count++] = strdup("precision highp float;\n");
+ extra_code_text[extra_code_count++] = strdup("precision mediump int;\n");
+ extra_code_text[extra_code_count++] = strdup("precision highp float;\n");
}
else
{ //set version to 400
- text[count++] = strdup("#version 400\n");
+ shader_code_text[shader_code_count++] = strdup("#version 400\n");
}
- text[count++] = strdup("#define DEFINE_GL_FRAGCOLOR 1\n");
- text[count++] = strdup("#define FXAA_GLSL_130 1\n");
+ extra_code_text[extra_code_count++] = strdup("#define DEFINE_GL_FRAGCOLOR 1\n");
+ extra_code_text[extra_code_count++] = strdup("#define FXAA_GLSL_130 1\n");
- text[count++] = strdup("#define ATTRIBUTE in\n");
+ extra_code_text[extra_code_count++] = strdup("#define ATTRIBUTE in\n");
if (type == GL_VERTEX_SHADER_ARB)
{ //"varying" state is "out" in a vertex program, "in" in a fragment program
// ("varying" is deprecated after version 1.20)
- text[count++] = strdup("#define VARYING out\n");
- text[count++] = strdup("#define VARYING_FLAT flat out\n");
+ extra_code_text[extra_code_count++] = strdup("#define VARYING out\n");
+ extra_code_text[extra_code_count++] = strdup("#define VARYING_FLAT flat out\n");
}
else
{
- text[count++] = strdup("#define VARYING in\n");
- text[count++] = strdup("#define VARYING_FLAT flat in\n");
+ extra_code_text[extra_code_count++] = strdup("#define VARYING in\n");
+ extra_code_text[extra_code_count++] = strdup("#define VARYING_FLAT flat in\n");
}
//backwards compatibility with legacy texture lookup syntax
- text[count++] = strdup("#define texture2D texture\n");
- text[count++] = strdup("#define textureCube texture\n");
- text[count++] = strdup("#define texture2DLod textureLod\n");
- text[count++] = strdup("#define shadow2D(a,b) vec2(texture(a,b))\n");
+ extra_code_text[extra_code_count++] = strdup("#define texture2D texture\n");
+ extra_code_text[extra_code_count++] = strdup("#define textureCube texture\n");
+ extra_code_text[extra_code_count++] = strdup("#define texture2DLod textureLod\n");
+ extra_code_text[extra_code_count++] = strdup("#define shadow2D(a,b) vec2(texture(a,b))\n");
if (major_version > 1 || minor_version >= 40)
{ //GLSL 1.40 replaces texture2DRect et al with texture
- text[count++] = strdup("#define texture2DRect texture\n");
- text[count++] = strdup("#define shadow2DRect(a,b) vec2(texture(a,b))\n");
+ extra_code_text[extra_code_count++] = strdup("#define texture2DRect texture\n");
+ extra_code_text[extra_code_count++] = strdup("#define shadow2DRect(a,b) vec2(texture(a,b))\n");
}
}
@@ -660,13 +662,13 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
for (boost::unordered_map<std::string,std::string>::iterator iter = defines->begin(); iter != defines->end(); ++iter)
{
std::string define = "#define " + iter->first + " " + iter->second + "\n";
- text[count++] = (GLcharARB *) strdup(define.c_str());
+ extra_code_text[extra_code_count++] = (GLcharARB *) strdup(define.c_str());
}
}
if( gGLManager.mIsATI )
{
- text[ count++ ] = strdup( "#define IS_AMD_CARD 1\n" );
+ extra_code_text[extra_code_count++] = strdup( "#define IS_AMD_CARD 1\n" );
}
if (texture_index_channels > 0 && type == GL_FRAGMENT_SHADER_ARB)
@@ -704,28 +706,28 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
}
*/
- text[count++] = strdup("#define HAS_DIFFUSE_LOOKUP 1\n");
+ extra_code_text[extra_code_count++] = strdup("#define HAS_DIFFUSE_LOOKUP 1\n");
//uniform declartion
for (S32 i = 0; i < texture_index_channels; ++i)
{
std::string decl = llformat("uniform sampler2D tex%d;\n", i);
- text[count++] = strdup(decl.c_str());
+ extra_code_text[extra_code_count++] = strdup(decl.c_str());
}
if (texture_index_channels > 1)
{
- text[count++] = strdup("VARYING_FLAT int vary_texture_index;\n");
+ extra_code_text[extra_code_count++] = strdup("VARYING_FLAT int vary_texture_index;\n");
}
- text[count++] = strdup("vec4 diffuseLookup(vec2 texcoord)\n");
- text[count++] = strdup("{\n");
+ extra_code_text[extra_code_count++] = strdup("vec4 diffuseLookup(vec2 texcoord)\n");
+ extra_code_text[extra_code_count++] = strdup("{\n");
if (texture_index_channels == 1)
{ //don't use flow control, that's silly
- text[count++] = strdup("return texture2D(tex0, texcoord);\n");
- text[count++] = strdup("}\n");
+ extra_code_text[extra_code_count++] = strdup("return texture2D(tex0, texcoord);\n");
+ extra_code_text[extra_code_count++] = strdup("}\n");
}
else if (major_version > 1 || minor_version >= 30)
{ //switches are supported in GLSL 1.30 and later
@@ -734,27 +736,27 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
for (U32 i = 0; i < texture_index_channels; ++i)
{
std::string if_string = llformat("\t%sif (vary_texture_index == %d) { return texture2D(tex%d, texcoord); }\n", i > 0 ? "else " : "", i, i);
- text[count++] = strdup(if_string.c_str());
+ extra_code_text[extra_code_count++] = strdup(if_string.c_str());
}
- text[count++] = strdup("\treturn vec4(1,0,1,1);\n");
- text[count++] = strdup("}\n");
+ extra_code_text[extra_code_count++] = strdup("\treturn vec4(1,0,1,1);\n");
+ extra_code_text[extra_code_count++] = strdup("}\n");
}
else
{
- text[count++] = strdup("\tvec4 ret = vec4(1,0,1,1);\n");
- text[count++] = strdup("\tswitch (vary_texture_index)\n");
- text[count++] = strdup("\t{\n");
+ extra_code_text[extra_code_count++] = strdup("\tvec4 ret = vec4(1,0,1,1);\n");
+ extra_code_text[extra_code_count++] = strdup("\tswitch (vary_texture_index)\n");
+ extra_code_text[extra_code_count++] = strdup("\t{\n");
//switch body
for (S32 i = 0; i < texture_index_channels; ++i)
{
std::string case_str = llformat("\t\tcase %d: return texture2D(tex%d, texcoord);\n", i, i);
- text[count++] = strdup(case_str.c_str());
+ extra_code_text[extra_code_count++] = strdup(case_str.c_str());
}
- text[count++] = strdup("\t}\n");
- text[count++] = strdup("\treturn ret;\n");
- text[count++] = strdup("}\n");
+ extra_code_text[extra_code_count++] = strdup("\t}\n");
+ extra_code_text[extra_code_count++] = strdup("\treturn ret;\n");
+ extra_code_text[extra_code_count++] = strdup("}\n");
}
}
else
@@ -765,14 +767,81 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
}
else
{
- text[count++] = strdup("#define HAS_DIFFUSE_LOOKUP 0\n");
+ extra_code_text[extra_code_count++] = strdup("#define HAS_DIFFUSE_LOOKUP 0\n");
}
+
//copy file into memory
- while( fgets((char *)buff, 1024, file) != NULL && count < LL_ARRAY_SIZE(text) )
+ enum {
+ flag_write_to_out_of_extra_block_area = 0x01
+ , flag_extra_block_marker_was_found = 0x02
+ };
+
+ unsigned char flags = flag_write_to_out_of_extra_block_area;
+
+ GLuint out_of_extra_block_counter = 0, start_shader_code = shader_code_count;
+
+ while(NULL != fgets((char *)buff, 1024, file)
+ && shader_code_count < (LL_ARRAY_SIZE(shader_code_text) - LL_ARRAY_SIZE(extra_code_text)))
{
- text[count++] = (GLcharARB *)strdup((char *)buff);
+ bool extra_block_area_found = NULL != strstr((const char*)buff, "[EXTRA_CODE_HERE]");
+
+ if(extra_block_area_found && !(flag_extra_block_marker_was_found & flags))
+ {
+ if(!(flag_write_to_out_of_extra_block_area & flags))
+ {
+ //shift
+ for(GLuint to = start_shader_code, from = extra_code_count + start_shader_code;
+ from < shader_code_count; ++to, ++from)
+ {
+ shader_code_text[to] = shader_code_text[from];
+ }
+
+ shader_code_count -= extra_code_count;
+ }
+
+ //copy extra code
+ for(GLuint n = 0; n < extra_code_count
+ && shader_code_count < (LL_ARRAY_SIZE(shader_code_text) - LL_ARRAY_SIZE(extra_code_text)); ++n)
+ {
+ shader_code_text[shader_code_count++] = extra_code_text[n];
+ }
+
+ extra_code_count = 0;
+
+ flags &= ~flag_write_to_out_of_extra_block_area;
+ flags |= flag_extra_block_marker_was_found;
+ continue;
+ }
+
+ shader_code_text[shader_code_count] = (GLcharARB *)strdup((char *)buff);
+
+ if(flag_write_to_out_of_extra_block_area & flags)
+ {
+ shader_code_text[extra_code_count + start_shader_code + out_of_extra_block_counter]
+ = shader_code_text[shader_code_count];
+ out_of_extra_block_counter++;
+
+ if(out_of_extra_block_counter == extra_code_count)
+ {
+ shader_code_count += extra_code_count;
+ flags &= ~flag_write_to_out_of_extra_block_area;
+ }
+ }
+
+ ++shader_code_count;
+ } //while
+
+ if(!(flag_extra_block_marker_was_found & flags))
+ {
+ for(GLuint n = start_shader_code; n < extra_code_count + start_shader_code; ++n)
+ {
+ shader_code_text[n] = extra_code_text[n - start_shader_code];
+ }
+
+ extra_code_count = 0;
}
+
fclose(file);
//create shader object
@@ -787,7 +856,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
}
//load source
- glShaderSourceARB(ret, count, (const GLcharARB**) text, NULL);
+ glShaderSourceARB(ret, shader_code_count, (const GLcharARB**) shader_code_text, NULL);
if (gDebugGL)
{
@@ -826,9 +895,9 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
#if LL_WINDOWS
std::stringstream ostr;
//dump shader source for debugging
- for (GLuint i = 0; i < count; i++)
+ for (GLuint i = 0; i < shader_code_count; i++)
{
- ostr << i << ": " << text[i];
+ ostr << i << ": " << shader_code_text[i];
if (i % 128 == 0)
{ //dump every 128 lines
@@ -843,8 +912,8 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
#else
std::string str;
- for (GLuint i = 0; i < count; i++) {
- str.append(text[i]);
+ for (GLuint i = 0; i < shader_code_count; i++) {
+ str.append(shader_code_text[i]);
if (i % 128 == 0)
{
@@ -853,7 +922,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
}
}
#endif
-
+
ret = 0;
}
}
@@ -865,9 +934,9 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
stop_glerror();
//free memory
- for (GLuint i = 0; i < count; i++)
+ for (GLuint i = 0; i < shader_code_count; i++)
{
- free(text[i]);
+ free(shader_code_text[i]);
}
//successfully loaded, save results
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 2b5f001873..b9c8f34cb0 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#define INDEXED 1
#define NON_INDEXED 2
#define NON_INDEXED_NO_COLOR 3
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
index 5264d6e1b4..cbd8d2ebfc 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl
index ccbc3c557c..fef1c5a584 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl
index a425e5062e..8d48bb016b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
index ed02c4a481..0ffca8515c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
index f22b16965c..756e625d07 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl
index a2b4b3b8c8..226e63cdda 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl
@@ -26,6 +26,8 @@
#extension GL_ARB_texture_rectangle : enable
#extension GL_ARB_shader_texture_lod : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
index 1a464fec5d..9974f8f31b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
index c08e9d361a..3a3e871ade 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
@@ -23,16 +23,20 @@
* $/LicenseInfo$
*/
+
+
+//class 1 -- no shadows
+
+#extension GL_ARB_texture_rectangle : enable
+#extension GL_ARB_shader_texture_lod : enable
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
-//class 1 -- no shadows
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_shader_texture_lod : enable
+/*[EXTRA_CODE_HERE]*/
uniform sampler2DRect diffuseRect;
uniform sampler2DRect specularRect;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl b/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl
index 62cfa5c316..d0c06cd51f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
index 106d48bd71..aba4a01754 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
index bf362e21a4..f06f8c870b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
index 4e2f98aa29..6669947d1b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
index eb5beeef39..058941bfb2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 760d52a9ce..03bdb754b5 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -26,6 +26,8 @@
#extension GL_ARB_texture_rectangle : enable
#extension GL_ARB_shader_texture_lod : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
index f50635a139..f1aec315cc 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
@@ -26,6 +26,8 @@
#extension GL_ARB_texture_rectangle : enable
#extension GL_ARB_shader_texture_lod : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl
index 5ca817aff6..7329efe3f7 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl
@@ -27,6 +27,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
index c0a5865bef..930255729b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
index 1c3ad49a21..37dcd3ad34 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_data[3];
#else
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
index 0f5eb288fd..36563982ba 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl
index 942c5888e7..cff8d9d50f 100644
--- a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
index ed803de277..5c088b3a3c 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
@@ -23,13 +23,15 @@
* $/LicenseInfo$
*/
+#extension GL_ARB_texture_rectangle : enable
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
-#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
uniform sampler2D glowMap;
uniform sampler2DRect screenMap;
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
index 59520bb99f..a9e7ea1de8 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl
index 772bb374e8..7614075cfd 100644
--- a/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index 94bd07bec6..b9bb522842 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -26,6 +26,8 @@
#extension GL_ARB_texture_rectangle : enable
#extension GL_ARB_shader_texture_lod : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 1022c23f7b..f7832521fa 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
index 92e1ac95a6..81af1fdc8a 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
@@ -26,6 +26,8 @@
#extension GL_ARB_texture_rectangle : enable
#extension GL_ARB_shader_texture_lod : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
index 95c09d3238..265da8df99 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
@@ -25,6 +25,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
index b5ff6404ea..5c6fe30daa 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
@@ -24,6 +24,8 @@
#extension GL_ARB_texture_rectangle : enable
+/*[EXTRA_CODE_HERE]*/
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else