summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Madarasz <graham@lindenlab.com>2013-04-19 13:08:57 -0700
committerGraham Madarasz <graham@lindenlab.com>2013-04-19 13:08:57 -0700
commit7c0bea5bb4fe60c009a7f262297990f4792b9ae4 (patch)
tree153e71c697d9ef39dda6e0ccb012465d32111704
parentc5410a5d22ac5234226ab8f67144a753ef2d3019 (diff)
Rework ifdefing and fix windows shader compiler warnings from materialF
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl16
-rw-r--r--indra/newview/llviewershadermgr.cpp10
6 files changed, 52 insertions, 29 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index ac8393edf8..7c58749929 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -35,7 +35,7 @@ out vec4 frag_color;
#define frag_color gl_FragColor
#endif
-#if (INDEX_MODE != INDEXED)
+#if USE_DIFFUSE_TEX
uniform sampler2D diffuseMap;
#endif
@@ -52,7 +52,7 @@ VARYING vec3 vary_pointlight_col;
VARYING vec2 vary_texcoord0;
VARYING vec3 vary_norm;
-#if (INDEX_MODE != NON_INDEXED_NO_COLOR)
+#if USE_VERTEX_COLOR
VARYING vec4 vertex_color;
#endif
@@ -104,16 +104,18 @@ void main()
vec4 pos = vec4(vary_position, 1.0);
-#if (INDEX_MODE == INDEXED)
+#if USE_INDEXED_TEX
vec4 diff = diffuseLookup(vary_texcoord0.xy);
#else
vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy);
#endif
+
diff.rgb = pow(diff.rgb, vec3(2.2));
-#if (INDEX_MODE == NON_INDEXED_NO_COLOR)
- float vertex_color_alpha = 1.0;
+
+#if USE_VERTEX_COLOR
+ float vertex_color_alpha = vertex_color.a;
#else
- float vertex_color_alpha = vertex_color.a;
+ float vertex_color_alpha = 1.0;
#endif
vec3 normal = vary_norm;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
index 141a817991..b8d43c0586 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
@@ -34,13 +34,17 @@ uniform mat4 modelview_matrix;
uniform mat4 modelview_projection_matrix;
ATTRIBUTE vec3 position;
-#if (INDEX_MODE == INDEXED)
+
+#if USE_INDEXED_TEX
void passTextureIndex();
#endif
+
ATTRIBUTE vec3 normal;
-#if (INDEX_MODE != NON_INDEXED_NO_COLOR)
+
+#if USE_VERTEX_COLOR
ATTRIBUTE vec4 diffuse_color;
#endif
+
ATTRIBUTE vec2 texcoord0;
#if HAS_SKIN
@@ -65,7 +69,7 @@ VARYING vec3 vary_fragcoord;
VARYING vec3 vary_position;
VARYING vec3 vary_pointlight_col;
-#if INDEX_MODE != NON_INDEXED_NO_COLOR
+#if USE_VERTEX_COLOR
VARYING vec4 vertex_color;
#endif
@@ -158,7 +162,7 @@ void main()
#endif
-#if (INDEX_MODE == INDEXED)
+#if USE_INDEXED_TEX
passTextureIndex();
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
#else
@@ -170,9 +174,10 @@ void main()
calcAtmospherics(pos.xyz);
-#if (INDEX_MODE == NON_INDEXED_NO_COLOR)
+#if !USE_VERTEX_COLOR
vec4 diffuse_color = vec4(1,1,1,1);
#endif
+
//vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
@@ -188,7 +193,8 @@ void main()
vary_directional.rgb = atmosAffectDirectionalLight(1.0f);
col.rgb = col.rgb*diffuse_color.rgb;
-#if (INDEX_MODE != NON_INDEXED_NO_COLOR)
+
+#if USE_VERTEX_COLOR
vertex_color = col;
#endif
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index 43848761b3..7752189e1d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -607,7 +607,7 @@ void main()
vec3 npos = normalize(-pos.xyz);
#define LIGHT_LOOP(i) \
- frag_color.rgb = frag_color.rgb + calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
+ col.rgb = col.rgb + calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
LIGHT_LOOP(1)
LIGHT_LOOP(2)
@@ -617,6 +617,7 @@ void main()
LIGHT_LOOP(6)
LIGHT_LOOP(7)
+ frag_color.rgb = col.rgb;
frag_color.a = diffcol.a*vertex_color.a;
#else
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index e72f9449f1..034b3523ca 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -40,7 +40,7 @@ uniform sampler2DShadow shadowMap1;
uniform sampler2DShadow shadowMap2;
uniform sampler2DShadow shadowMap3;
-#if (INDEX_MODE != INDEXED)
+#if USE_DIFFUSE_TEX
uniform sampler2D diffuseMap;
#endif
@@ -58,7 +58,7 @@ VARYING vec3 vary_pointlight_col;
VARYING vec2 vary_texcoord0;
VARYING vec3 vary_norm;
-#if (INDEX_MODE != NON_INDEXED_NO_COLOR)
+#if USE_VERTEX_COLOR
VARYING vec4 vertex_color;
#endif
@@ -198,16 +198,21 @@ void main()
}
vec4 diff;
-#if (INDEX_MODE == INDEXED)
+
+#if USE_INDEXED_TEX
diff = diffuseLookup(vary_texcoord0.xy);
-#else
+#endif
+
+#if USE_DIFFUSE_TEX
diff = texture2D(diffuseMap,vary_texcoord0.xy);
#endif
+
diff.rgb = pow(diff.rgb, vec3(2.2));
-#if (INDEX_MODE == NON_INDEXED_NO_COLOR)
+
float vertex_color_alpha = 1.0;
-#else
- float vertex_color_alpha = vertex_color.a;
+
+#if USE_VERTEX_COLOR
+ vertex_color_alpha = vertex_color.a;
#endif
vec3 normal = vary_norm;
@@ -239,4 +244,3 @@ void main()
frag_color = color;
}
-
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
index 95fd634c12..d59cf9b89a 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
@@ -34,13 +34,17 @@ uniform mat4 modelview_matrix;
uniform mat4 modelview_projection_matrix;
ATTRIBUTE vec3 position;
-#if (INDEX_MODE == INDEXED)
+
+#if USE_INDEXED_TEX
void passTextureIndex();
#endif
+
ATTRIBUTE vec3 normal;
-#if (INDEX_MODE != NON_INDEXED_NO_COLOR)
+
+#if USE_VERTEX_COLOR
ATTRIBUTE vec4 diffuse_color;
#endif
+
ATTRIBUTE vec2 texcoord0;
#if HAS_SKIN
@@ -69,7 +73,7 @@ VARYING vec3 vary_fragcoord;
VARYING vec3 vary_position;
VARYING vec3 vary_pointlight_col;
-#if (INDEX_MODE != NON_INDEXED_NO_COLOR)
+#if USE_VERTEX_COLOR
VARYING vec4 vertex_color;
#endif
@@ -164,7 +168,7 @@ void main()
#endif
-#if (INDEX_MODE == INDEXED)
+#if USE_INDEXED_TEX
passTextureIndex();
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
#else
@@ -177,7 +181,7 @@ void main()
calcAtmospherics(pos.xyz);
-#if (INDEX_MODE == NON_INDEXED_NO_COLOR)
+#if !USE_VERTEX_COLOR
vec4 diffuse_color = vec4(1,1,1,1);
#endif
@@ -198,7 +202,7 @@ void main()
col.rgb = col.rgb*dff;
-#if (INDEX_MODE != NON_INDEXED_NO_COLOR)
+#if USE_VERTEX_COLOR
vertex_color = col;
#endif
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 6c94f81c3d..3743d8fe2e 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -1213,7 +1213,9 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSkinnedAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredSkinnedAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredSkinnedAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
- gDeferredSkinnedAlphaProgram.addPermutation("INDEX_MODE", "2");
+ gDeferredSkinnedAlphaProgram.addPermutation("USE_DIFFUSE_TEX", "1");
+ gDeferredSkinnedAlphaProgram.addPermutation("USE_INDEXED_TEX", "0");
+ gDeferredSkinnedAlphaProgram.addPermutation("USE_VERTEX_COLOR", "1");
gDeferredSkinnedAlphaProgram.addPermutation("HAS_SKIN", "1");
gDeferredSkinnedAlphaProgram.addPermutation("IS_AVATAR_SKIN", "0");
success = gDeferredSkinnedAlphaProgram.createShader(NULL, NULL);
@@ -1409,7 +1411,11 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAlphaProgram.mShaderFiles.clear();
gDeferredAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER_ARB));
- gDeferredSkinnedAlphaProgram.addPermutation("INDEX_MODE","0");
+
+ gDeferredSkinnedAlphaProgram.addPermutation("USE_DIFFUSE_TEX", "0");
+ gDeferredSkinnedAlphaProgram.addPermutation("USE_INDEXED_TEX", "1");
+ gDeferredSkinnedAlphaProgram.addPermutation("USE_VERTEX_COLOR", "1");
+
gDeferredSkinnedAlphaProgram.addPermutation("HAS_SKIN","1");
gDeferredSkinnedAlphaProgram.addPermutation("IS_AVATAR_SKIN","0");