summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl25
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl11
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl14
-rw-r--r--indra/newview/lldrawpoolavatar.cpp4
-rw-r--r--indra/newview/llviewershadermgr.cpp47
-rw-r--r--indra/newview/llviewershadermgr.h3
-rw-r--r--indra/newview/llvovolume.cpp9
9 files changed, 30 insertions, 115 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 00717cd6a9..fc628e60cf 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -83,11 +83,11 @@ uniform float shadow_offset;
vec3 calcDirectionalLight(vec3 n, vec3 l)
{
- float a = pow(max(dot(n,l),0.0), 0.7);
+ float a = pow(max(dot(n,l),0.0), 0.7);
return vec3(a,a,a);
}
-float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
+vec3 calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
{
//get light vector
vec3 lv = lp.xyz-v;
@@ -114,7 +114,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
da *= max(pow(dot(n, lv), 0.7), 0.0);
}
- return da;
+ return vec3(da,da,da);
}
void main()
@@ -125,7 +125,7 @@ void main()
vec4 pos = vec4(vary_position, 1.0);
#if INDEX_MODE == INDEXED
- vec4 diff = diffuseLookup(vary_texcoord0.xy);
+ vec4 diff= diffuseLookup(vary_texcoord0.xy);
#else
vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy);
#endif
@@ -141,10 +141,10 @@ void main()
normal = vec3(dot(normal.xyz, vary_rotation[0]),
dot(normal.xyz, vary_rotation[1]),
dot(normal.xyz, vary_rotation[2]));
-
+
vec3 l = light_position[0].xyz;
vec3 dlight = calcDirectionalLight(normal, l);
- dlight = dlight * vary_directional.rgb * vary_pointlight_col;
+ dlight = dlight * vary_directional.rgb * vary_pointlight_col;
vec4 col = vec4(vary_ambient + dlight, vertex_color_alpha);
vec4 color = diff * col;
@@ -154,10 +154,9 @@ void main()
color.rgb = scaleSoftClip(color.rgb);
vec3 light_col = vec3(0,0,0);
-#ifdef MAC_GEFORCE_HACK
- #define LIGHT_LOOP(i) \
- light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, normal, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
-
+ #define LIGHT_LOOP(i) \
+ light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
+
LIGHT_LOOP(1)
LIGHT_LOOP(2)
LIGHT_LOOP(3)
@@ -165,12 +164,6 @@ void main()
LIGHT_LOOP(5)
LIGHT_LOOP(6)
LIGHT_LOOP(7)
-#else
- for (int i = 2; i < 8; i++)
- {
- light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, normal, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
- }
-#endif
color.rgb += diff.rgb * vary_pointlight_col * light_col;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl
index e872dadcc1..cccc7275ab 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl
@@ -56,13 +56,13 @@ uniform vec3 light_direction[8];
uniform vec3 light_attenuation[8];
uniform vec3 light_diffuse[8];
-float calcDirectionalLight(vec3 n, vec3 l)
+vec3 calcDirectionalLight(vec3 n, vec3 l)
{
float a = pow(max(dot(n,l),0.0), 0.7);
- return a;
+ return vec3(a,a,a);
}
-float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
+vec3 calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
{
//get light vector
vec3 lv = lp.xyz-v;
@@ -89,7 +89,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
da *= max(pow(dot(n, lv), 0.7), 0.0);
}
- return da;
+ return vec3(da,da,da);
}
vec4 getPosition(vec2 pos_screen)
@@ -126,7 +126,7 @@ void main()
color.rgb = scaleSoftClip(color.rgb);
vec3 light_col = vec3(0,0,0);
-#if MAC_GEFORCE_HACK
+
#define LIGHT_LOOP(i) \
light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
@@ -137,12 +137,7 @@ void main()
LIGHT_LOOP(5)
LIGHT_LOOP(6)
LIGHT_LOOP(7)
-#else
- for (int i = 2; i < 8; i++)
- {
- light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
- }
-#endif
+
color.rgb += diff.rgb * vary_pointlight_col * light_col;
frag_color = color;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index 486e806434..42467a1b60 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -46,6 +46,7 @@ uniform sampler2D diffuseMap;
#endif
uniform vec2 screen_res;
+uniform vec2 shadow_res;
vec3 atmosLighting(vec3 light);
vec3 scaleSoftClip(vec3 light);
@@ -89,7 +90,7 @@ vec3 calcDirectionalLight(vec3 n, vec3 l)
return vec3(a,a,a);
}
-float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
+vec3 calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
{
//get light vector
vec3 lv = lp.xyz-v;
@@ -116,7 +117,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
da *= max(pow(dot(n, lv), 0.7), 0.0);
}
- return da;
+ return vec3(da,da,da);
}
float pcfShadow(sampler2DShadow shadowMap, vec4 stc)
@@ -231,6 +232,7 @@ void main()
vec3 l = light_position[0].xyz;
vec3 dlight = calcDirectionalLight(normal, l);
dlight = dlight * vary_directional.rgb * vary_pointlight_col;
+ vec4 diff = diffuseLookup(vary_texcoord0.xy);
vec4 col = vec4(vary_ambient + dlight *shadow, vertex_color_alpha);
vec4 color = diff * col;
@@ -240,9 +242,8 @@ void main()
color.rgb = scaleSoftClip(color.rgb);
vec3 light_col = vec3(0,0,0);
-#ifdef MAC_GEFORCE_HACK
#define LIGHT_LOOP(i) \
- light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, normal, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
+ light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
LIGHT_LOOP(1)
LIGHT_LOOP(2)
@@ -251,12 +252,6 @@ void main()
LIGHT_LOOP(5)
LIGHT_LOOP(6)
LIGHT_LOOP(7)
-#else
- for (int i = 2; i < 8; i++)
- {
- light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, normal, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
- }
-#endif
color.rgb += diff.rgb * vary_pointlight_col * light_col;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl
index 39a5a9894d..9670d59399 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl
@@ -70,7 +70,7 @@ vec3 calcDirectionalLight(vec3 n, vec3 l)
return vec3(a,a,a);
}
-float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
+vec3 calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
{
//get light vector
vec3 lv = lp.xyz-v;
@@ -97,7 +97,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
da *= max(pow(dot(n, lv), 0.7), 0.0);
}
- return da;
+ return vec3(da,da,da);
}
vec4 getPosition(vec2 pos_screen)
@@ -217,7 +217,6 @@ void main()
color.rgb = scaleSoftClip(color.rgb);
vec3 light_col = vec3(0,0,0);
-#if MAC_GEFORCE_HACK
#define LIGHT_LOOP(i) \
light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
@@ -228,12 +227,6 @@ void main()
LIGHT_LOOP(5)
LIGHT_LOOP(6)
LIGHT_LOOP(7)
-#else
- for (int i = 2; i < 8; i++)
- {
- light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
- }
-#endif
color.rgb += diff.rgb * vary_pointlight_col * light_col;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl
index 566aefea6a..fae279fba0 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl
@@ -72,7 +72,7 @@ vec3 calcDirectionalLight(vec3 n, vec3 l)
return vec3(a, a, a);
}
-float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
+vec3 calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
{
//get light vector
vec3 lv = lp.xyz-v;
@@ -99,7 +99,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
da *= max(pow(dot(n, lv), 0.7), 0.0);
}
- return da;
+ return vec3(da,da,da);
}
vec4 getPosition(vec2 pos_screen)
@@ -224,8 +224,7 @@ void main()
color.rgb = scaleSoftClip(color.rgb);
vec3 light_col = vec3(0,0,0);
-#if MAC_GEFORCE_HACK
- #define LIGHT_LOOP(i)
+ #define LIGHT_LOOP(i) \
light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
LIGHT_LOOP(1)
@@ -235,12 +234,7 @@ void main()
LIGHT_LOOP(5)
LIGHT_LOOP(6)
LIGHT_LOOP(7)
-#else
- for (int i = 2; i < 8; i++)
- {
- light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
- }
-#endif
+
color.rgb += diff.rgb * vary_pointlight_col * light_col;
frag_color = color;
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index 0ceb7c6c45..aa5687f338 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -274,11 +274,7 @@ void LLDrawPoolAvatar::beginPostDeferredAlpha()
void LLDrawPoolAvatar::beginDeferredRiggedAlpha()
{
-#if LL_DARWIN
- sVertexProgram = gGLManager.mIsMobileGF ? &gDeferredSkinnedAlphaProgramMac : &gDeferredSkinnedAlphaProgram;
-#else
sVertexProgram = &gDeferredSkinnedAlphaProgram;
-#endif
gPipeline.bindDeferredShader(*sVertexProgram);
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
gPipeline.enableLightsDynamic();
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 0fd37a4090..c7e422139d 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -1224,8 +1224,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSkinnedAlphaProgram.addPermutation("INDEX_MODE", "2");
gDeferredSkinnedAlphaProgram.addPermutation("HAS_SKIN", "1");
gDeferredSkinnedAlphaProgram.addPermutation("IS_AVATAR_SKIN", "0");
- gDeferredSkinnedAlphaProgram.addPermutation("MAC_GEFORCE_HACK","0");
-
success = gDeferredSkinnedAlphaProgram.createShader(NULL, NULL);
// Hack to include uniforms for lighting without linking in lighting file
@@ -1233,36 +1231,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSkinnedAlphaProgram.mFeatures.hasLighting = true;
}
-#if LL_DARWIN
- if (success)
- {
- gDeferredSkinnedAlphaProgramMac.mName = "Deferred Skinned Alpha Shader";
- gDeferredSkinnedAlphaProgramMac.mFeatures.atmosphericHelpers = true;
- gDeferredSkinnedAlphaProgramMac.mFeatures.hasObjectSkinning = true;
- gDeferredSkinnedAlphaProgramMac.mFeatures.calculatesAtmospherics = true;
- gDeferredSkinnedAlphaProgramMac.mFeatures.hasGamma = true;
- gDeferredSkinnedAlphaProgramMac.mFeatures.hasAtmospherics = true;
- gDeferredSkinnedAlphaProgramMac.mFeatures.calculatesLighting = false;
- gDeferredSkinnedAlphaProgramMac.mFeatures.hasLighting = false;
- gDeferredSkinnedAlphaProgramMac.mFeatures.isAlphaLighting = true;
- gDeferredSkinnedAlphaProgramMac.mFeatures.disableTextureIndex = true;
- gDeferredSkinnedAlphaProgramMac.mShaderFiles.clear();
- gDeferredSkinnedAlphaProgramMac.mShaderFiles.push_back(make_pair("deferred/alphaV.glsl", GL_VERTEX_SHADER_ARB));
- gDeferredSkinnedAlphaProgramMac.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER_ARB));
- gDeferredSkinnedAlphaProgramMac.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
- gDeferredSkinnedAlphaProgramMac.addPermutation("INDEX_MODE", "2");
- gDeferredSkinnedAlphaProgramMac.addPermutation("HAS_SKIN", "1");
- gDeferredSkinnedAlphaProgramMac.addPermutation("IS_AVATAR_SKIN", "0");
- gDeferredSkinnedAlphaProgramMac.addPermutation("MAC_GEFORCE_HACK","1");
-
- success = gDeferredSkinnedAlphaProgramMac.createShader(NULL, NULL);
-
- // Hack to include uniforms for lighting without linking in lighting file
- gDeferredSkinnedAlphaProgramMac.mFeatures.calculatesLighting = true;
- gDeferredSkinnedAlphaProgramMac.mFeatures.hasLighting = true;
- }
-#endif
-
if (success)
{
gDeferredBumpProgram.mName = "Deferred Bump Shader";
@@ -1432,10 +1400,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
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));
gDeferredAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
- gDeferredAlphaProgram.addPermutation("INDEX_MODE", "1");
- gDeferredAlphaProgram.addPermutation("HAS_SKIN", "0");
- gDeferredAlphaProgram.addPermutation("IS_AVATAR_SKIN", "0");
- gDeferredAlphaProgram.addPermutation("MAC_GEFORCE_HACK","0");
+
success = gDeferredAlphaProgram.createShader(NULL, NULL);
// Hack
@@ -1608,14 +1573,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarAlphaProgram.mFeatures.isAlphaLighting = true;
gDeferredAvatarAlphaProgram.mFeatures.disableTextureIndex = true;
gDeferredAvatarAlphaProgram.mShaderFiles.clear();
- gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaV.glsl", GL_VERTEX_SHADER_ARB));
- gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaNoColorV.glsl", GL_VERTEX_SHADER_ARB));
+ gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedNoColorF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredAvatarAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
- gDeferredAvatarAlphaProgram.addPermutation("INDEX_MODE", "3");
- gDeferredAvatarAlphaProgram.addPermutation("HAS_SKIN", "0");
- gDeferredAvatarAlphaProgram.addPermutation("IS_AVATAR_SKIN", "1");
- gDeferredAvatarAlphaProgram.addPermutation("MAC_GEFORCE_HACK","0");
-
+
success = gDeferredAvatarAlphaProgram.createShader(NULL, &mAvatarUniforms);
gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = true;
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
index 38310ed7cf..e9283d8bad 100644
--- a/indra/newview/llviewershadermgr.h
+++ b/indra/newview/llviewershadermgr.h
@@ -331,9 +331,6 @@ extern LLGLSLShader gDeferredNonIndexedDiffuseProgram;
extern LLGLSLShader gDeferredSkinnedDiffuseProgram;
extern LLGLSLShader gDeferredSkinnedBumpProgram;
extern LLGLSLShader gDeferredSkinnedAlphaProgram;
-#if LL_DARWIN
-extern LLGLSLShader gDeferredSkinnedAlphaProgramMac;
-#endif
extern LLGLSLShader gDeferredBumpProgram;
extern LLGLSLShader gDeferredTerrainProgram;
extern LLGLSLShader gDeferredTreeProgram;
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 56aa69b25c..f77869ee91 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4104,15 +4104,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
}
}
- //DEBUG
- LLVertexBuffer* buff = facep->getVertexBuffer();
-
- if (type == LLRenderPass::PASS_ALPHA && !buff->hasDataType(LLVertexBuffer::TYPE_BINORMAL))
- {
- llerrs << "WTF?" << llendl;
- }
-
-
if (idx >= 0 &&
draw_vec[idx]->mVertexBuffer == facep->getVertexBuffer() &&
draw_vec[idx]->mEnd == facep->getGeomIndex()-1 &&