summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/app_settings/settings.xml3
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/alphaF.glsl21
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/alphaV.glsl10
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl47
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl48
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl112
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl29
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl29
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl2
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl47
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl34
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/downsampleDepthF.glsl67
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl69
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/downsampleDepthV.glsl59
-rwxr-xr-xindra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl32
-rwxr-xr-xindra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl54
-rwxr-xr-xindra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl34
-rwxr-xr-xindra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl17
-rwxr-xr-xindra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl17
-rwxr-xr-xindra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl7
-rwxr-xr-xindra/newview/featuretable_mac.txt4
-rwxr-xr-xindra/newview/llfloatertools.h2
-rw-r--r--indra/newview/llmaterialmgr.cpp86
-rw-r--r--indra/newview/llmaterialmgr.h2
-rwxr-xr-xindra/newview/llmeshrepository.cpp1
-rwxr-xr-xindra/newview/llpanelface.cpp37
-rwxr-xr-xindra/newview/llpanelface.h21
-rwxr-xr-xindra/newview/llselectmgr.cpp6
-rwxr-xr-xindra/newview/llspatialpartition.cpp180
-rwxr-xr-xindra/newview/lltooldraganddrop.cpp47
-rwxr-xr-xindra/newview/llviewerdisplay.cpp3
-rwxr-xr-xindra/newview/llviewerregion.cpp2
-rwxr-xr-xindra/newview/llviewerregion.h2
-rwxr-xr-xindra/newview/llviewershadermgr.cpp84
-rwxr-xr-xindra/newview/llviewershadermgr.h8
-rwxr-xr-xindra/newview/llvovolume.cpp9
-rwxr-xr-xindra/newview/pipeline.cpp226
-rwxr-xr-xindra/newview/pipeline.h10
-rwxr-xr-xindra/newview/viewer_manifest.py8
41 files changed, 934 insertions, 565 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index baf46eec31..29ad355f75 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -7743,7 +7743,7 @@
<key>Type</key>
<string>S32</string>
<key>Value</key>
- <integer>4</integer>
+ <integer>3</integer>
</map>
<key>OctreeAlphaDistanceFactor</key>
@@ -8527,7 +8527,6 @@
<key>Value</key>
<real>1.0</real>
</map>
-
<key>RenderDeferredTreeShadowBias</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 77a53a71aa..143af0576c 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -78,6 +78,7 @@ uniform vec2 screen_res;
vec3 calcDirectionalLight(vec3 n, vec3 l)
{
float a = max(dot(n,l),0.0);
+ a = pow(a, 1.0/1.3);
return vec3(a,a,a);
}
@@ -87,7 +88,7 @@ vec3 calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float
vec3 lv = lp.xyz-v;
//get distance
- float d = dot(lv,lv);
+ float d = length(lv);
float da = 0.0;
@@ -97,9 +98,11 @@ vec3 calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float
lv = normalize(lv);
//distance attenuation
- float dist2 = d/la;
- da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
- da = pow(da, 2.2) * 2.2;
+ float dist = d/la;
+ da = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
+ da *= da;
+ da *= 2.0;
+
// spotlight coefficient.
float spot = max(dot(-ln, lv), is_pointlight);
@@ -212,6 +215,7 @@ void main()
#else
vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy);
#endif
+ vec4 gamma_diff = diff;
diff.rgb = pow(diff.rgb, vec3(2.2f, 2.2f, 2.2f));
@@ -224,7 +228,7 @@ void main()
vec3 normal = vary_norm;
vec3 l = light_position[0].xyz;
- vec3 dlight = calcDirectionalLight(normal, l) * 2.6;
+ vec3 dlight = calcDirectionalLight(normal, l);
dlight = dlight * vary_directional.rgb * vary_pointlight_col;
#if HAS_SHADOW
@@ -233,13 +237,16 @@ void main()
vec4 col = vec4(vary_ambient + dlight, vertex_color_alpha);
#endif
- vec4 color = diff * col;
+ vec4 color = gamma_diff * col;
color.rgb = atmosLighting(color.rgb);
color.rgb = scaleSoftClip(color.rgb);
+
+ color.rgb = pow(color.rgb, vec3(2.2));
col = vec4(0,0,0,0);
+
#define LIGHT_LOOP(i) col.rgb += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, normal, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
LIGHT_LOOP(1)
@@ -250,7 +257,7 @@ void main()
LIGHT_LOOP(6)
LIGHT_LOOP(7)
- color.rgb += diff.rgb * vary_pointlight_col * col.rgb;
+ color.rgb += diff.rgb * pow(vary_pointlight_col, vec3(2.2)) * col.rgb;
color.rgb = pow(color.rgb, vec3(1.0/2.2));
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
index 247ee0a34f..9d3ba564cd 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
@@ -58,8 +58,6 @@ mat4 getSkinnedTransform();
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
-vec3 calcDirectionalLight(vec3 n, vec3 l);
-
vec3 atmosAmbient(vec3 light);
vec3 atmosAffectDirectionalLight(float lightIntensity);
vec3 scaleDownLight(vec3 light);
@@ -88,12 +86,6 @@ uniform vec3 light_diffuse[8];
uniform vec3 sun_dir;
-vec3 calcDirectionalLight(vec3 n, vec3 l)
-{
- float a = max(dot(n,l),0.0);
- return vec3(a,a,a);
-}
-
vec3 calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
{
//get light vector
@@ -184,7 +176,7 @@ void main()
//vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
- vec3 diff = pow(diffuse_color.rgb, vec3(2.2));
+ vec3 diff = diffuse_color.rgb;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
index eebeb91bf8..a4f54dff70 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
@@ -46,11 +46,6 @@ VARYING vec2 vary_fragcoord;
uniform mat4 inv_proj;
uniform vec2 screen_res;
-vec3 getKern(int i)
-{
- return kern[i];
-}
-
vec4 getPosition(vec2 pos_screen)
{
float depth = texture2DRect(depthMap, pos_screen.xy).r;
@@ -64,22 +59,6 @@ vec4 getPosition(vec2 pos_screen)
return pos;
}
-#ifdef SINGLE_FP_ONLY
-vec2 encode_normal(vec3 n)
-{
- vec2 sn;
- sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
- return sn;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec3 n;
- n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
- n.z = sqrt(1.0f - dot(n.xy,n.xy));
- return n;
-}
-#else
vec2 encode_normal(vec3 n)
{
float f = sqrt(8 * n.z + 8);
@@ -96,7 +75,6 @@ vec3 decode_normal (vec2 enc)
n.z = 1-f/2;
return n;
}
-#endif
void main()
{
@@ -110,7 +88,7 @@ void main()
vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy);
dlt /= max(-pos.z*dist_factor, 1.0);
- vec2 defined_weight = getKern(0).xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free'
+ vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free'
vec4 col = defined_weight.xyxx * ccol;
// relax tolerance according to distance to avoid speckling artifacts, as angles and distances are a lot more abrupt within a small screen area at larger distances
@@ -120,28 +98,33 @@ void main()
float tc_mod = 0.5*(tc.x + tc.y); // mod(tc.x+tc.y,2)
tc_mod -= floor(tc_mod);
tc_mod *= 2.0;
- tc += ( (tc_mod - 0.5) * getKern(1).z * dlt * 0.5 );
+ tc += ( (tc_mod - 0.5) * kern[1].z * dlt * 0.5 );
for (int i = 1; i < 4; i++)
{
- vec2 samptc = tc + getKern(i).z*dlt;
- vec3 samppos = getPosition(samptc).xyz;
+ vec2 samptc = tc + kern[i].z*dlt;
+ vec3 samppos = getPosition(samptc).xyz;
+
float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
+
if (d*d <= pointplanedist_tolerance_pow2)
{
- col += texture2DRect(lightMap, samptc)*getKern(i).xyxx;
- defined_weight += getKern(i).xy;
+ col += texture2DRect(lightMap, samptc)*kern[i].xyxx;
+ defined_weight += kern[i].xy;
}
}
+
for (int i = 1; i < 4; i++)
{
- vec2 samptc = tc - getKern(i).z*dlt;
- vec3 samppos = getPosition(samptc).xyz;
+ vec2 samptc = tc - kern[i].z*dlt;
+ vec3 samppos = getPosition(samptc).xyz;
+
float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
+
if (d*d <= pointplanedist_tolerance_pow2)
{
- col += texture2DRect(lightMap, samptc)*getKern(i).xyxx;
- defined_weight += getKern(i).xy;
+ col += texture2DRect(lightMap, samptc)*kern[i].xyxx;
+ defined_weight += kern[i].xy;
}
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
index a2c3ec3355..adc361d7a2 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
@@ -43,10 +43,12 @@ vec2 encode_normal(vec3 n)
void main()
{
vec3 col = vertex_color.rgb * diffuseLookup(vary_texcoord0.xy).rgb;
+
+ vec3 spec;
+ spec.rgb = vec3(vertex_color.a);
frag_data[0] = vec4(col, 0.0);
- frag_data[1] = vertex_color.aaaa; // spec
- frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
+ frag_data[1] = vec4(spec, vertex_color.a); // spec
vec3 nvn = normalize(vary_normal);
frag_data[2] = vec4(encode_normal(nvn.xyz), vertex_color.a, 0.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index de2f74b681..53ade8ea64 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -127,7 +127,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
vec3 lv = lp.xyz-v;
//get distance
- float d = dot(lv,lv);
+ float d = length(lv);
float da = 1.0;
@@ -139,8 +139,10 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
lv = normalize(lv);
//distance attenuation
- float dist2 = d/la;
- float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
+ float dist = d/la;
+ float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
+ dist_atten *= dist_atten;
+ dist_atten *= 2.0;
// spotlight coefficient.
float spot = max(dot(-ln, lv), is_pointlight);
@@ -321,9 +323,9 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
+ tmpAmbient)));
//brightness of surface both sunlight and ambient
- setSunlitColor(pow(vec3(sunlight * .5), vec3(2.2)) * 2.2);
- setAmblitColor(pow(vec3(tmpAmbient * .25), vec3(2.2)) * 2.2);
- setAdditiveColor(pow(getAdditiveColor() * vec3(1.0 - temp1), vec3(2.2)) * 2.2);
+ setSunlitColor(vec3(sunlight * .5));
+ setAmblitColor(vec3(tmpAmbient * .25));
+ setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1));
}
vec3 atmosLighting(vec3 light)
@@ -426,22 +428,6 @@ VARYING vec3 vary_normal;
VARYING vec4 vertex_color;
VARYING vec2 vary_texcoord0;
-#ifdef SINGLE_FP_ONLY
-vec2 encode_normal(vec3 n)
-{
- vec2 sn;
- sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
- return sn;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec3 n;
- n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
- n.z = sqrt(1.0f - dot(n.xy,n.xy));
- return n;
-}
-#else
vec2 encode_normal(vec3 n)
{
float f = sqrt(8 * n.z + 8);
@@ -458,7 +444,6 @@ vec3 decode_normal (vec2 enc)
n.z = 1-f/2;
return n;
}
-#endif
void main()
{
@@ -617,8 +602,8 @@ void main()
col.rgb *= ambient;
- col.rgb = col.rgb + atmosAffectDirectionalLight(final_da * 2.6);
- col.rgb *= diffuse.rgb;
+ col.rgb = col.rgb + atmosAffectDirectionalLight(pow(final_da, 1.0/1.3));
+ col.rgb *= old_diffcol.rgb;
float glare = 0.0;
@@ -647,9 +632,8 @@ void main()
{
//add environmentmap
vec3 env_vec = env_mat * refnormpersp;
- float exponent = mix(2.2, 1.0, diffuse.a);
-
- vec3 refcol = pow(textureCube(environmentMap, env_vec).rgb, vec3(exponent))*exponent;
+
+ vec3 refcol = textureCube(environmentMap, env_vec).rgb;
col = mix(col.rgb, refcol,
envIntensity);
@@ -660,13 +644,12 @@ void main()
glare += cur_glare;
}
- float exponent = mix(1.0, 2.2, diffuse.a);
- col = pow(col, vec3(exponent));
-
-
col = mix(atmosLighting(col), fullbrightAtmosTransport(col), diffuse.a);
col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a);
+ //convert to linear space before adding local lights
+ col = pow(col, vec3(2.2));
+
vec3 npos = normalize(-pos.xyz);
@@ -681,6 +664,7 @@ void main()
LIGHT_LOOP(7)
+ //convert to gamma space for display on screen
col.rgb = pow(col.rgb, vec3(1.0/2.2));
frag_color.rgb = col.rgb;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
index b35ba549f6..a955ef6e9d 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
@@ -45,9 +45,8 @@ uniform float sun_wash;
uniform int light_count;
-#define MAX_LIGHT_COUNT 16
-uniform vec4 light[MAX_LIGHT_COUNT];
-uniform vec4 light_col[MAX_LIGHT_COUNT];
+uniform vec4 light[LIGHT_COUNT];
+uniform vec4 light_col[LIGHT_COUNT];
VARYING vec4 vary_fragcoord;
uniform vec2 screen_res;
@@ -56,22 +55,6 @@ uniform float far_z;
uniform mat4 inv_proj;
-#ifdef SINGLE_FP_ONLY
-vec2 encode_normal(vec3 n)
-{
- vec2 sn;
- sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
- return sn;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec3 n;
- n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
- n.z = sqrt(1.0f - dot(n.xy,n.xy));
- return n;
-}
-#else
vec2 encode_normal(vec3 n)
{
float f = sqrt(8 * n.z + 8);
@@ -88,7 +71,6 @@ vec3 decode_normal (vec2 enc)
n.z = 1-f/2;
return n;
}
-#endif
vec4 getPosition(vec2 pos_screen)
{
@@ -122,73 +104,59 @@ void main()
vec3 npos = normalize(-pos);
// As of OSX 10.6.7 ATI Apple's crash when using a variable size loop
- for (int i = 0; i < MAX_LIGHT_COUNT; ++i)
+ for (int i = 0; i < LIGHT_COUNT; ++i)
{
- bool light_contrib = (i < light_count);
-
vec3 lv = light[i].xyz-pos;
- float dist2 = dot(lv,lv);
- dist2 /= light[i].w;
- if (dist2 > 1.0)
- {
- light_contrib = false;
- }
-
- float da = dot(norm, lv);
- if (da < 0.0)
- {
- light_contrib = false;
- }
-
- if (light_contrib)
+ float dist = length(lv);
+ dist /= light[i].w;
+ if (dist <= 1.0)
{
- lv = normalize(lv);
- da = dot(norm, lv);
+ float da = dot(norm, lv);
+ if (da > 0.0)
+ {
+ lv = normalize(lv);
+ da = dot(norm, lv);
- float fa = light_col[i].a+1.0;
- float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
+ float fa = light_col[i].a+1.0;
+ float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
+ dist_atten *= dist_atten;
+ dist_atten *= 2.0;
- dist_atten = pow(dist_atten, 2.2) * 2.2;
-
- dist_atten *= noise;
+ dist_atten *= noise;
- float lit = da * dist_atten;
+ float lit = da * dist_atten;
- vec3 col = light_col[i].rgb*lit*diff;
+ vec3 col = light_col[i].rgb*lit*diff;
- //vec3 col = vec3(dist2, light_col[i].a, lit);
+ //vec3 col = vec3(dist2, light_col[i].a, lit);
- if (spec.a > 0.0)
- {
- lit = min(da*6.0, 1.0) * dist_atten;
- //vec3 ref = dot(pos+lv, norm);
- vec3 h = normalize(lv+npos);
- float nh = dot(norm, h);
- float nv = dot(norm, npos);
- float vh = dot(npos, h);
- float sa = nh;
- float fres = pow(1 - dot(h, npos), 5)*0.4+0.5;
-
- float gtdenom = 2 * nh;
- float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh));
-
- if (nh > 0.0)
+ if (spec.a > 0.0)
{
- float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
- col += lit*scol*light_col[i].rgb*spec.rgb;
- //col += spec.rgb;
+ lit = min(da*6.0, 1.0) * dist_atten;
+ //vec3 ref = dot(pos+lv, norm);
+ vec3 h = normalize(lv+npos);
+ float nh = dot(norm, h);
+ float nv = dot(norm, npos);
+ float vh = dot(npos, h);
+ float sa = nh;
+ float fres = pow(1 - dot(h, npos), 5)*0.4+0.5;
+
+ float gtdenom = 2 * nh;
+ float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh));
+
+ if (nh > 0.0)
+ {
+ float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
+ col += lit*scol*light_col[i].rgb*spec.rgb;
+ //col += spec.rgb;
+ }
}
- }
- out_col += col;
+ out_col += col;
+ }
}
}
- if (dot(out_col, out_col) <= 0.0)
- {
- discard;
- }
-
frag_color.rgb = out_col;
frag_color.a = 0.0;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
index 36fb4afa52..7d39ad7bc1 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
@@ -67,22 +67,6 @@ uniform vec2 screen_res;
uniform mat4 inv_proj;
-#ifdef SINGLE_FP_ONLY
-vec2 encode_normal(vec3 n)
-{
- vec2 sn;
- sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
- return sn;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec3 n;
- n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
- n.z = sqrt(1.0f - dot(n.xy,n.xy));
- return n;
-}
-#else
vec2 encode_normal(vec3 n)
{
float f = sqrt(8 * n.z + 8);
@@ -99,7 +83,6 @@ vec3 decode_normal (vec2 enc)
n.z = 1-f/2;
return n;
}
-#endif
vec4 correctWithGamma(vec4 col)
{
@@ -177,9 +160,9 @@ void main()
vec3 pos = getPosition(frag.xy).xyz;
vec3 lv = center.xyz-pos.xyz;
- float dist2 = dot(lv,lv);
- dist2 /= size;
- if (dist2 > 1.0)
+ float dist = length(lv);
+ dist /= size;
+ if (dist > 1.0)
{
discard;
}
@@ -201,8 +184,10 @@ void main()
proj_tc.xyz /= proj_tc.w;
float fa = falloff+1.0;
- float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
- dist_atten = pow(dist_atten, 2.2) * 2.2;
+ float dist_atten = min(1.0-(dist-1.0*(1.0-fa))/fa, 1.0);
+ dist_atten *= dist_atten;
+ dist_atten *= 2.0;
+
if (dist_atten <= 0.0)
{
discard;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
index c6b1eb7c8d..106d48bd71 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
@@ -54,22 +54,6 @@ uniform vec2 screen_res;
uniform mat4 inv_proj;
uniform vec4 viewport;
-#ifdef SINGLE_FP_ONLY
-vec2 encode_normal(vec3 n)
-{
- vec2 sn;
- sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
- return sn;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec3 n;
- n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
- n.z = sqrt(1.0f - dot(n.xy,n.xy));
- return n;
-}
-#else
vec2 encode_normal(vec3 n)
{
float f = sqrt(8 * n.z + 8);
@@ -86,7 +70,6 @@ vec3 decode_normal (vec2 enc)
n.z = 1-f/2;
return n;
}
-#endif
vec4 getPosition(vec2 pos_screen)
{
@@ -110,9 +93,9 @@ void main()
vec3 pos = getPosition(frag.xy).xyz;
vec3 lv = trans_center.xyz-pos;
- float dist2 = dot(lv,lv);
- dist2 /= size;
- if (dist2 > 1.0)
+ float dist = length(lv);
+ dist /= size;
+ if (dist > 1.0)
{
discard;
}
@@ -133,8 +116,10 @@ void main()
vec3 col = texture2DRect(diffuseRect, frag.xy).rgb;
float fa = falloff+1.0;
- float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
- dist_atten = pow(dist_atten, 2.2) * 2.2;
+ float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
+ dist_atten *= dist_atten;
+ dist_atten *= 2.0;
+
float lit = da * dist_atten * noise;
col = color.rgb*lit*col;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
index 9491421236..a5625fbc16 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
@@ -37,7 +37,7 @@ VARYING vec3 trans_center;
void main()
{
//transform vertex
- vec3 p = position*sqrt(size)+center;
+ vec3 p = position*size+center;
vec4 pos = modelview_projection_matrix * vec4(p.xyz, 1.0);
vary_fragcoord = pos;
trans_center = (modelview_matrix*vec4(center.xyz, 1.0)).xyz;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index b40850e769..f0d2746700 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -78,22 +78,6 @@ vec3 vary_AtmosAttenuation;
uniform mat4 inv_proj;
uniform vec2 screen_res;
-#ifdef SINGLE_FP_ONLY
-vec2 encode_normal(vec3 n)
-{
- vec2 sn;
- sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
- return sn;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec3 n;
- n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
- n.z = sqrt(1.0f - dot(n.xy,n.xy));
- return n;
-}
-#else
vec3 decode_normal (vec2 enc)
{
vec2 fenc = enc*4-2;
@@ -104,7 +88,6 @@ vec3 decode_normal (vec2 enc)
n.z = 1-f/2;
return n;
}
-#endif
vec4 getPosition_d(vec2 pos_screen, float depth)
{
@@ -248,9 +231,9 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
+ tmpAmbient)));
//brightness of surface both sunlight and ambient
- setSunlitColor(pow(vec3(sunlight * .5), vec3(global_gamma)) * global_gamma);
- setAmblitColor(pow(vec3(tmpAmbient * .25), vec3(global_gamma)) * global_gamma);
- setAdditiveColor(pow(getAdditiveColor() * vec3(1.0 - temp1), vec3(global_gamma)) * global_gamma);
+ setSunlitColor(vec3(sunlight * .5));
+ setAmblitColor(vec3(tmpAmbient * .25));
+ setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1));
}
vec3 atmosLighting(vec3 light)
@@ -325,8 +308,13 @@ void main()
norm.xyz = decode_normal(norm.xy); // unpack norm
float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
+ da = pow(da, 1.0/1.3);
vec4 diffuse = texture2DRect(diffuseRect, tc);
+
+ //convert to gamma space
+ diffuse.rgb = pow(diffuse.rgb, vec3(1.0/2.2));
+
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
vec3 col;
float bloom = 0.0;
@@ -341,7 +329,7 @@ void main()
col.rgb *= ambient;
- col += atmosAffectDirectionalLight(max(min(da, 1.0) * 2.6, 0.0));
+ col += atmosAffectDirectionalLight(max(min(da, 1.0), 0.0));
col *= diffuse.rgb;
@@ -362,23 +350,18 @@ void main()
}
- col = mix(col.rgb, pow(diffuse.rgb, vec3(1.0/2.2)), diffuse.a);
-
-
+ col = mix(col.rgb, diffuse.rgb, diffuse.a);
+
if (envIntensity > 0.0)
{ //add environmentmap
vec3 env_vec = env_mat * refnormpersp;
- float exponent = mix(2.2, 1.0, diffuse.a);
- vec3 refcol = pow(textureCube(environmentMap, env_vec).rgb, vec3(exponent))*exponent;
+
+ vec3 refcol = textureCube(environmentMap, env_vec).rgb;
col = mix(col.rgb, refcol,
envIntensity);
-
}
-
- float exponent = mix(1.0, 2.2, diffuse.a);
- col = pow(col, vec3(exponent));
if (norm.w < 0.5)
{
@@ -386,10 +369,12 @@ void main()
col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a);
}
+ col = pow(col, vec3(2.2));
+
//col = vec3(1,0,1);
//col.g = envIntensity;
}
-
+
frag_color.rgb = col;
frag_color.a = bloom;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
index 3539c8d2b2..045d1a00cd 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
@@ -65,22 +65,6 @@ uniform vec2 screen_res;
uniform mat4 inv_proj;
-#ifdef SINGLE_FP_ONLY
-vec2 encode_normal(vec3 n)
-{
- vec2 sn;
- sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
- return sn;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec3 n;
- n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
- n.z = sqrt(1.0f - dot(n.xy,n.xy));
- return n;
-}
-#else
vec2 encode_normal(vec3 n)
{
float f = sqrt(8 * n.z + 8);
@@ -97,7 +81,6 @@ vec3 decode_normal (vec2 enc)
n.z = 1-f/2;
return n;
}
-#endif
vec4 correctWithGamma(vec4 col)
{
@@ -175,9 +158,9 @@ void main()
vec3 pos = getPosition(frag.xy).xyz;
vec3 lv = trans_center.xyz-pos.xyz;
- float dist2 = dot(lv,lv);
- dist2 /= size;
- if (dist2 > 1.0)
+ float dist = length(lv);
+ dist /= size;
+ if (dist > 1.0)
{
discard;
}
@@ -199,8 +182,10 @@ void main()
proj_tc.xyz /= proj_tc.w;
float fa = falloff+1.0;
- float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
- dist_atten = pow(dist_atten, 2.2) * 2.2;
+ float dist_atten = min(1.0-(dist-1.0*(1.0-fa))/fa, 1.0);
+ dist_atten *= dist_atten;
+ dist_atten *= 2.0;
+
if (dist_atten <= 0.0)
{
discard;
@@ -279,10 +264,7 @@ void main()
//col += spec.rgb;
}
}
-
-
-
-
+
if (envIntensity > 0.0)
{
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
index 6653f57ee1..c0a5865bef 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
@@ -49,22 +49,6 @@ VARYING vec2 vary_fragcoord;
uniform mat4 inv_proj;
uniform vec2 screen_res;
-#ifdef SINGLE_FP_ONLY
-vec2 encode_normal(vec3 n)
-{
- vec2 sn;
- sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
- return sn;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec3 n;
- n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
- n.z = sqrt(1.0f - dot(n.xy,n.xy));
- return n;
-}
-#else
vec2 encode_normal(vec3 n)
{
float f = sqrt(8 * n.z + 8);
@@ -81,7 +65,6 @@ vec3 decode_normal (vec2 enc)
n.z = 1-f/2;
return n;
}
-#endif
vec4 getPosition(vec2 pos_screen)
{
diff --git a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthF.glsl b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthF.glsl
new file mode 100644
index 0000000000..6523a06d22
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthF.glsl
@@ -0,0 +1,67 @@
+/**
+ * @file debugF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, 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$
+ */
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+uniform sampler2D depthMap;
+
+uniform float delta;
+
+VARYING vec2 tc0;
+VARYING vec2 tc1;
+VARYING vec2 tc2;
+VARYING vec2 tc3;
+VARYING vec2 tc4;
+VARYING vec2 tc5;
+VARYING vec2 tc6;
+VARYING vec2 tc7;
+VARYING vec2 tc8;
+
+void main()
+{
+ vec4 depth1 =
+ vec4(texture2D(depthMap, tc0).r,
+ texture2D(depthMap, tc1).r,
+ texture2D(depthMap, tc2).r,
+ texture2D(depthMap, tc3).r);
+
+ vec4 depth2 =
+ vec4(texture2D(depthMap, tc4).r,
+ texture2D(depthMap, tc5).r,
+ texture2D(depthMap, tc6).r,
+ texture2D(depthMap, tc7).r);
+
+ depth1 = min(depth1, depth2);
+ float depth = min(depth1.x, depth1.y);
+ depth = min(depth, depth1.z);
+ depth = min(depth, depth1.w);
+ depth = min(depth, texture2D(depthMap, tc8).r);
+
+ gl_FragDepth = depth;
+}
diff --git a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl
new file mode 100644
index 0000000000..0e5dc08183
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl
@@ -0,0 +1,69 @@
+/**
+ * @file debugF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, 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
+
+uniform sampler2DRect depthMap;
+
+uniform float delta;
+
+VARYING vec2 tc0;
+VARYING vec2 tc1;
+VARYING vec2 tc2;
+VARYING vec2 tc3;
+VARYING vec2 tc4;
+VARYING vec2 tc5;
+VARYING vec2 tc6;
+VARYING vec2 tc7;
+VARYING vec2 tc8;
+
+void main()
+{
+ vec4 depth1 =
+ vec4(texture2DRect(depthMap, tc0).r,
+ texture2DRect(depthMap, tc1).r,
+ texture2DRect(depthMap, tc2).r,
+ texture2DRect(depthMap, tc3).r);
+
+ vec4 depth2 =
+ vec4(texture2DRect(depthMap, tc4).r,
+ texture2DRect(depthMap, tc5).r,
+ texture2DRect(depthMap, tc6).r,
+ texture2DRect(depthMap, tc7).r);
+
+ depth1 = min(depth1, depth2);
+ float depth = min(depth1.x, depth1.y);
+ depth = min(depth, depth1.z);
+ depth = min(depth, depth1.w);
+ depth = min(depth, texture2DRect(depthMap, tc8).r);
+
+ gl_FragDepth = depth;
+}
diff --git a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthV.glsl b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthV.glsl
new file mode 100644
index 0000000000..71d80911d6
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthV.glsl
@@ -0,0 +1,59 @@
+/**
+ * @file debugV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, 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$
+ */
+
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+
+uniform vec2 screen_res;
+
+uniform vec2 delta;
+
+VARYING vec2 tc0;
+VARYING vec2 tc1;
+VARYING vec2 tc2;
+VARYING vec2 tc3;
+VARYING vec2 tc4;
+VARYING vec2 tc5;
+VARYING vec2 tc6;
+VARYING vec2 tc7;
+VARYING vec2 tc8;
+
+void main()
+{
+ gl_Position = vec4(position, 1.0);
+
+ vec2 tc = (position.xy*0.5+0.5)*screen_res;
+ tc0 = tc+vec2(-delta.x,-delta.y);
+ tc1 = tc+vec2(0,-delta.y);
+ tc2 = tc+vec2(delta.x,-delta.y);
+ tc3 = tc+vec2(-delta.x,0);
+ tc4 = tc+vec2(0,0);
+ tc5 = tc+vec2(delta.x,0);
+ tc6 = tc+vec2(-delta.x,delta.y);
+ tc7 = tc+vec2(0,delta.y);
+ tc8 = tc+vec2(delta.x,delta.y);
+}
+
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index eaacb93cb9..14f6afc8c2 100755
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -68,22 +68,6 @@ uniform vec2 screen_res;
uniform mat4 inv_proj;
-#ifdef SINGLE_FP_ONLY
-vec2 encode_normal(vec3 n)
-{
- vec2 sn;
- sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
- return sn;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec3 n;
- n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
- n.z = sqrt(1.0f - dot(n.xy,n.xy));
- return n;
-}
-#else
vec2 encode_normal(vec3 n)
{
float f = sqrt(8 * n.z + 8);
@@ -100,7 +84,6 @@ vec3 decode_normal (vec2 enc)
n.z = 1-f/2;
return n;
}
-#endif
vec4 correctWithGamma(vec4 col)
{
@@ -179,9 +162,9 @@ void main()
vec3 pos = getPosition(frag.xy).xyz;
vec3 lv = center.xyz-pos.xyz;
- float dist2 = dot(lv,lv);
- dist2 /= size;
- if (dist2 > 1.0)
+ float dist = length(lv);
+ dist /= size;
+ if (dist > 1.0)
{
discard;
}
@@ -215,8 +198,9 @@ void main()
proj_tc.xyz /= proj_tc.w;
float fa = falloff+1.0;
- float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
- dist_atten = pow(dist_atten, 2.2) * 2.2;
+ float dist_atten = min(1.0-(dist-1.0*(1.0-fa))/fa, 1.0);
+ dist_atten *= dist_atten;
+ dist_atten *= 2.0;
if (dist_atten <= 0.0)
{
discard;
@@ -334,6 +318,10 @@ void main()
}
}
+
+ //not sure why, but this line prevents MATBUG-194
+ col = max(col, vec3(0.0));
+
frag_color.rgb = col;
frag_color.a = 0.0;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 4fe2f1551e..6e05091b57 100755
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -78,22 +78,6 @@ vec3 vary_AtmosAttenuation;
uniform mat4 inv_proj;
uniform vec2 screen_res;
-#ifdef SINGLE_FP_ONLY
-vec2 encode_normal(vec3 n)
-{
- vec2 sn;
- sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
- return sn;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec3 n;
- n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
- n.z = sqrt(1.0f - dot(n.xy,n.xy));
- return n;
-}
-#else
vec2 encode_normal(vec3 n)
{
float f = sqrt(8 * n.z + 8);
@@ -110,7 +94,6 @@ vec3 decode_normal (vec2 enc)
n.z = 1-f/2;
return n;
}
-#endif
vec4 getPosition_d(vec2 pos_screen, float depth)
{
@@ -254,9 +237,13 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
+ tmpAmbient)));
//brightness of surface both sunlight and ambient
- setSunlitColor(pow(vec3(sunlight * .5), vec3(global_gamma)) * global_gamma);
+ /*setSunlitColor(pow(vec3(sunlight * .5), vec3(global_gamma)) * global_gamma);
setAmblitColor(pow(vec3(tmpAmbient * .25), vec3(global_gamma)) * global_gamma);
- setAdditiveColor(pow(getAdditiveColor() * vec3(1.0 - temp1), vec3(global_gamma)) * global_gamma);
+ setAdditiveColor(pow(getAdditiveColor() * vec3(1.0 - temp1), vec3(global_gamma)) * global_gamma);*/
+
+ setSunlitColor(vec3(sunlight * .5));
+ setAmblitColor(vec3(tmpAmbient * .25));
+ setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1));
}
vec3 atmosLighting(vec3 light)
@@ -332,7 +319,14 @@ void main()
float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
+ float light_gamma = 1.0/1.3;
+ da = pow(da, light_gamma);
+
+
vec4 diffuse = texture2DRect(diffuseRect, tc);
+
+ //convert to gamma space
+ diffuse.rgb = pow(diffuse.rgb, vec3(1.0/2.2));
vec3 col;
float bloom = 0.0;
@@ -340,7 +334,12 @@ void main()
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
+ scol_ambocc = pow(scol_ambocc, vec2(light_gamma));
+
float scol = max(scol_ambocc.r, diffuse.a);
+
+
+
float ambocc = scol_ambocc.g;
calcAtmospherics(pos.xyz, ambocc);
@@ -353,7 +352,7 @@ void main()
col.rgb *= ambient;
- col += atmosAffectDirectionalLight(max(min(da, scol) * 2.6, 0.0));
+ col += atmosAffectDirectionalLight(max(min(da, scol), 0.0));
col *= diffuse.rgb;
@@ -374,30 +373,27 @@ void main()
}
- col = mix(col.rgb, pow(diffuse.rgb, vec3(1.0/2.2)), diffuse.a);
-
-
+ col = mix(col, diffuse.rgb, diffuse.a);
+
if (envIntensity > 0.0)
{ //add environmentmap
vec3 env_vec = env_mat * refnormpersp;
- float exponent = mix(2.2, 1.0, diffuse.a);
- vec3 refcol = pow(textureCube(environmentMap, env_vec).rgb, vec3(exponent))*exponent;
+ vec3 refcol = textureCube(environmentMap, env_vec).rgb;
col = mix(col.rgb, refcol,
envIntensity);
}
-
- float exponent = mix(1.0, 2.2, diffuse.a);
- col = pow(col, vec3(exponent));
-
+
if (norm.w < 0.5)
{
col = mix(atmosLighting(col), fullbrightAtmosTransport(col), diffuse.a);
col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a);
}
+ col = pow(col, vec3(2.2));
+
//col = vec3(1,0,1);
//col.g = envIntensity;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
index bdb713d682..6e0218cb9c 100755
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
@@ -68,22 +68,6 @@ uniform vec2 screen_res;
uniform mat4 inv_proj;
-#ifdef SINGLE_FP_ONLY
-vec2 encode_normal(vec3 n)
-{
- vec2 sn;
- sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
- return sn;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec3 n;
- n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
- n.z = sqrt(1.0f - dot(n.xy,n.xy));
- return n;
-}
-#else
vec2 encode_normal(vec3 n)
{
float f = sqrt(8 * n.z + 8);
@@ -100,7 +84,6 @@ vec3 decode_normal (vec2 enc)
n.z = 1-f/2;
return n;
}
-#endif
vec4 correctWithGamma(vec4 col)
{
@@ -178,9 +161,9 @@ void main()
vec3 pos = getPosition(frag.xy).xyz;
vec3 lv = trans_center.xyz-pos.xyz;
- float dist2 = dot(lv,lv);
- dist2 /= size;
- if (dist2 > 1.0)
+ float dist = length(lv);
+ dist /= size;
+ if (dist > 1.0)
{
discard;
}
@@ -212,8 +195,10 @@ void main()
proj_tc.xyz /= proj_tc.w;
float fa = falloff+1.0;
- float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
- dist_atten = pow(dist_atten, 2.2) * 2.2;
+ float dist_atten = min(1.0-(dist-1.0*(1.0-fa))/fa, 1.0);
+ dist_atten *= dist_atten;
+ dist_atten *= 2.0;
+
if (dist_atten <= 0.0)
{
discard;
@@ -330,7 +315,10 @@ void main()
}
}
}
-
+
+ //not sure why, but this line prevents MATBUG-194
+ col = max(col, vec3(0.0));
+
frag_color.rgb = col;
frag_color.a = 0.0;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
index 7b09dd29dd..95c09d3238 100755
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
@@ -65,22 +65,6 @@ uniform float shadow_offset;
uniform float spot_shadow_bias;
uniform float spot_shadow_offset;
-#ifdef SINGLE_FP_ONLY
-vec2 encode_normal(vec3 n)
-{
- vec2 sn;
- sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
- return sn;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec3 n;
- n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
- n.z = sqrt(1.0f - dot(n.xy,n.xy));
- return n;
-}
-#else
vec2 encode_normal(vec3 n)
{
float f = sqrt(8 * n.z + 8);
@@ -97,7 +81,6 @@ vec3 decode_normal (vec2 enc)
n.z = 1-f/2;
return n;
}
-#endif
vec4 getPosition(vec2 pos_screen)
{
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
index 01e34ed792..b5ff6404ea 100755
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
@@ -66,22 +66,6 @@ uniform float shadow_offset;
uniform float spot_shadow_bias;
uniform float spot_shadow_offset;
-#ifdef SINGLE_FP_ONLY
-vec2 encode_normal(vec3 n)
-{
- vec2 sn;
- sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
- return sn;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec3 n;
- n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
- n.z = sqrt(1.0f - dot(n.xy,n.xy));
- return n;
-}
-#else
vec2 encode_normal(vec3 n)
{
float f = sqrt(8 * n.z + 8);
@@ -98,7 +82,6 @@ vec3 decode_normal (vec2 enc)
n.z = 1-f/2;
return n;
}
-#endif
vec4 getPosition(vec2 pos_screen)
{
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
index 8fd06c7e2f..d174805cc0 100755
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
@@ -54,7 +54,6 @@ uniform float density_multiplier;
uniform float distance_multiplier;
uniform float max_y;
uniform vec4 glow;
-uniform float global_gamma;
void calcAtmospherics(vec3 inPositionEye) {
@@ -132,9 +131,9 @@ void calcAtmospherics(vec3 inPositionEye) {
+ tmpAmbient)));
//brightness of surface both sunlight and ambient
- setSunlitColor(pow(vec3(sunlight * .5), vec3(global_gamma)) * global_gamma);
- setAmblitColor(pow(vec3(tmpAmbient * .25), vec3(global_gamma)) * global_gamma);
- setAdditiveColor(pow(getAdditiveColor() * vec3(1.0 - temp1), vec3(global_gamma)) * global_gamma);
+ setSunlitColor(vec3(sunlight * .5));
+ setAmblitColor(vec3(tmpAmbient * .25));
+ setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1));
// vary_SunlitColor = vec3(0);
// vary_AmblitColor = vec3(0);
diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt
index 1c0d45c11b..0bdd425504 100755
--- a/indra/newview/featuretable_mac.txt
+++ b/indra/newview/featuretable_mac.txt
@@ -309,8 +309,8 @@ RenderVolumeLODFactor 1 2.0
VertexShaderEnable 1 1
WindLightUseAtmosShaders 1 1
WLSkyDetail 1 128
-RenderDeferred 1 0
-RenderDeferredSSAO 1 0
+RenderDeferred 1 1
+RenderDeferredSSAO 1 1
RenderShadowDetail 1 2
RenderFSAASamples 1 2
diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h
index ecb0092a6f..189bae46c2 100755
--- a/indra/newview/llfloatertools.h
+++ b/indra/newview/llfloatertools.h
@@ -109,6 +109,8 @@ public:
static void setGridMode(S32 mode);
+ LLPanelFace* getPanelFace() { return mPanelFace; }
+
private:
void refresh();
void refreshMedia();
diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp
index 16871adc4d..ad9958546c 100644
--- a/indra/newview/llmaterialmgr.cpp
+++ b/indra/newview/llmaterialmgr.cpp
@@ -50,13 +50,12 @@
#define MATERIALS_CAP_MATERIAL_FIELD "Material"
#define MATERIALS_CAP_OBJECT_ID_FIELD "ID"
#define MATERIALS_CAP_MATERIAL_ID_FIELD "MaterialID"
+#define SIM_FEATURE_MAX_MATERIALS_PER_TRANSACTION "MaxMaterialsPerTransaction"
-#define MATERIALS_GET_MAX_ENTRIES 50
+#define MATERIALS_DEFAULT_MAX_ENTRIES 50
#define MATERIALS_GET_TIMEOUT (60.f * 20)
-#define MATERIALS_POST_MAX_ENTRIES 50
#define MATERIALS_POST_TIMEOUT (60.f * 5)
#define MATERIALS_PUT_THROTTLE_SECS 1.f
-#define MATERIALS_PUT_MAX_ENTRIES 50
/**
* LLMaterialsResponder helper class
@@ -595,8 +594,9 @@ void LLMaterialMgr::processGetQueue()
LLSD materialsData = LLSD::emptyArray();
material_queue_t& materials = itRegionQueue->second;
- material_queue_t::iterator loopMaterial = materials.begin();
- while ( (materials.end() != loopMaterial) && (materialsData.size() <= MATERIALS_GET_MAX_ENTRIES) )
+ U32 max_entries = getMaxEntries(regionp);
+ material_queue_t::iterator loopMaterial = materials.begin();
+ while ( (materials.end() != loopMaterial) && (materialsData.size() < max_entries) )
{
material_queue_t::iterator itMaterial = loopMaterial++;
materialsData.append((*itMaterial).asLLSD());
@@ -680,39 +680,43 @@ void LLMaterialMgr::processPutQueue()
const LLUUID& object_id = itQueue->first;
const LLViewerObject* objectp = gObjectList.findObject(object_id);
- if ( (!objectp) || (!objectp->getRegion()) )
+ if ( !objectp )
{
- LL_WARNS("Materials") << "Object or object region is NULL" << LL_ENDL;
-
+ LL_WARNS("Materials") << "Object is NULL" << LL_ENDL;
mPutQueue.erase(itQueue);
- continue;
- }
-
- const LLViewerRegion* regionp = objectp->getRegion();
- if (!regionp->capabilitiesReceived())
- {
- continue;
}
-
- LLSD& facesData = requests[regionp];
-
- facematerial_map_t& face_map = itQueue->second;
- facematerial_map_t::iterator itFace = face_map.begin();
- while ( (face_map.end() != itFace) && (facesData.size() < MATERIALS_GET_MAX_ENTRIES) )
+ else
{
- LLSD faceData = LLSD::emptyMap();
- faceData[MATERIALS_CAP_FACE_FIELD] = static_cast<LLSD::Integer>(itFace->first);
- faceData[MATERIALS_CAP_OBJECT_ID_FIELD] = static_cast<LLSD::Integer>(objectp->getLocalID());
- if (!itFace->second.isNull())
+ const LLViewerRegion* regionp = objectp->getRegion();
+ if ( !regionp )
{
- faceData[MATERIALS_CAP_MATERIAL_FIELD] = itFace->second.asLLSD();
+ LL_WARNS("Materials") << "Object region is NULL" << LL_ENDL;
+ mPutQueue.erase(itQueue);
+ }
+ else if ( regionp->capabilitiesReceived())
+ {
+ LLSD& facesData = requests[regionp];
+
+ facematerial_map_t& face_map = itQueue->second;
+ U32 max_entries = getMaxEntries(regionp);
+ facematerial_map_t::iterator itFace = face_map.begin();
+ while ( (face_map.end() != itFace) && (facesData.size() < max_entries) )
+ {
+ LLSD faceData = LLSD::emptyMap();
+ faceData[MATERIALS_CAP_FACE_FIELD] = static_cast<LLSD::Integer>(itFace->first);
+ faceData[MATERIALS_CAP_OBJECT_ID_FIELD] = static_cast<LLSD::Integer>(objectp->getLocalID());
+ if (!itFace->second.isNull())
+ {
+ faceData[MATERIALS_CAP_MATERIAL_FIELD] = itFace->second.asLLSD();
+ }
+ facesData.append(faceData);
+ face_map.erase(itFace++);
+ }
+ if (face_map.empty())
+ {
+ mPutQueue.erase(itQueue);
+ }
}
- facesData.append(faceData);
- face_map.erase(itFace++);
- }
- if (face_map.empty())
- {
- mPutQueue.erase(itQueue);
}
}
@@ -773,10 +777,26 @@ void LLMaterialMgr::clearGetQueues(const LLUUID& region_id)
mGetAllPending.erase(region_id);
mGetAllCallbacks.erase(region_id);
}
-
void LLMaterialMgr::onRegionRemoved(LLViewerRegion* regionp)
{
clearGetQueues(regionp->getRegionID());
// Put doesn't need clearing: objects that can't be found will clean up in processPutQueue()
}
+U32 LLMaterialMgr::getMaxEntries(const LLViewerRegion* regionp)
+{
+ LLSD sim_features;
+ regionp->getSimulatorFeatures(sim_features);
+ U32 max_entries;
+ if ( sim_features.has( SIM_FEATURE_MAX_MATERIALS_PER_TRANSACTION )
+ && sim_features[ SIM_FEATURE_MAX_MATERIALS_PER_TRANSACTION ].isInteger())
+ {
+ max_entries = sim_features[ SIM_FEATURE_MAX_MATERIALS_PER_TRANSACTION ].asInteger();
+ }
+ else
+ {
+ max_entries = MATERIALS_DEFAULT_MAX_ENTRIES;
+ }
+ return max_entries;
+}
+
diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h
index e317a791ad..e83f1f4e01 100644
--- a/indra/newview/llmaterialmgr.h
+++ b/indra/newview/llmaterialmgr.h
@@ -124,6 +124,8 @@ protected:
put_queue_t mPutQueue;
material_map_t mMaterials;
+
+ U32 getMaxEntries(const LLViewerRegion* regionp);
};
#endif // LL_LLMATERIALMGR_H
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 83b7cae347..2e02805c02 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -1,3 +1,4 @@
+
/**
* @file llmeshrepository.cpp
* @brief Mesh repository implementation.
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 911af9df04..3869219da6 100755
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -66,7 +66,7 @@
#include "llvovolume.h"
#include "lluictrlfactory.h"
#include "llpluginclassmedia.h"
-#include "llviewertexturelist.h"
+#include "llviewertexturelist.h"// Update sel manager as to which channel we're editing so it can reflect the correct overlay UI
//
// Constant definitions for comboboxes
@@ -89,6 +89,19 @@ const S32 SHINY_TEXTURE = 4; // use supplied specular map
//
std::string USE_TEXTURE;
+LLRender::eTexIndex LLPanelFace::getTextureChannelToEdit()
+{
+ LLComboBox* combobox_matmedia = getChild<LLComboBox>("combobox matmedia");
+ LLComboBox* combobox_mattype = getChild<LLComboBox>("combobox mattype");
+
+ LLRender::eTexIndex channel_to_edit = (combobox_matmedia && combobox_matmedia->getCurrentIndex() == MATMEDIA_MATERIAL) ?
+ (combobox_mattype ? (LLRender::eTexIndex)combobox_mattype->getCurrentIndex() : LLRender::DIFFUSE_MAP) : LLRender::DIFFUSE_MAP;
+
+ channel_to_edit = (channel_to_edit == LLRender::NORMAL_MAP) ? (getCurrentNormalMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit;
+ channel_to_edit = (channel_to_edit == LLRender::SPECULAR_MAP) ? (getCurrentSpecularMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit;
+ return channel_to_edit;
+}
+
// Things the UI provides...
//
LLUUID LLPanelFace::getCurrentNormalMap() { return getChild<LLTextureCtrl>("bumpytexture control")->getImageAssetID(); }
@@ -1194,7 +1207,8 @@ void LLPanelFace::updateUI()
getChildView("checkbox fullbright")->setEnabled(editable);
getChild<LLUICtrl>("checkbox fullbright")->setTentative(!identical_fullbright);
}
-
+
+
// Repeats per meter
{
F32 repeats_diff = 1.f;
@@ -1218,6 +1232,9 @@ void LLPanelFace::updateUI()
F32 repeats = 1.0f;
U32 material_type = (combobox_matmedia->getCurrentIndex() == MATMEDIA_MATERIAL) ? combobox_mattype->getCurrentIndex() : MATTYPE_DIFFUSE;
+
+ LLSelectMgr::getInstance()->setTextureChannel(LLRender::eTexIndex(material_type));
+
switch (material_type)
{
default:
@@ -1328,18 +1345,6 @@ void LLPanelFace::updateUI()
getChild<LLColorSwatchCtrl>("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE);
}
- // Update sel manager as to which channel we're editing so it can reflect the correct overlay UI
- // NORSPEC-103
- LLRender::eTexIndex channel_to_edit = (combobox_matmedia->getCurrentIndex() == MATMEDIA_MATERIAL) ? (LLRender::eTexIndex)combobox_mattype->getCurrentIndex() : LLRender::DIFFUSE_MAP;
-
- if ( ((channel_to_edit == LLRender::NORMAL_MAP) && material->getNormalID().isNull())
- ||((channel_to_edit == LLRender::SPECULAR_MAP) && material->getSpecularID().isNull()))
- {
- channel_to_edit = LLRender::DIFFUSE_MAP;
- }
-
- LLSelectMgr::getInstance()->setTextureChannel(channel_to_edit);
-
// Bumpy (normal)
texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control");
texture_ctrl->setImageAssetID(material->getNormalID());
@@ -1365,10 +1370,6 @@ void LLPanelFace::updateUI()
updateBumpyControls(!material->getNormalID().isNull(), true);
}
}
- else
- {
- LLSelectMgr::getInstance()->setTextureChannel(LLRender::DIFFUSE_MAP);
- }
}
// Set variable values for numeric expressions
diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h
index 42c1f6bd48..834ad9e14c 100755
--- a/indra/newview/llpanelface.h
+++ b/indra/newview/llpanelface.h
@@ -100,6 +100,19 @@ public:
void setMediaURL(const std::string& url);
void setMediaType(const std::string& mime_type);
+ LLMaterialPtr createDefaultMaterial(LLMaterialPtr current_material)
+ {
+ LLMaterialPtr new_material(!current_material.isNull() ? new LLMaterial(current_material->asLLSD()) : new LLMaterial());
+ llassert_always(new_material);
+
+ // Preserve old diffuse alpha mode or assert correct default blend mode as appropriate for the alpha channel content of the diffuse texture
+ //
+ new_material->setDiffuseAlphaMode(current_material.isNull() ? (isAlpha() ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE) : current_material->getDiffuseAlphaMode());
+ return new_material;
+ }
+
+ LLRender::eTexIndex getTextureChannelToEdit();
+
protected:
void getState();
@@ -178,6 +191,8 @@ protected:
static F32 valueGlow(LLViewerObject* object, S32 face);
+
+
private:
bool isAlpha() { return mIsAlpha; }
@@ -234,7 +249,7 @@ private:
{
if (_edit)
{
- LLMaterialPtr new_material(!current_material.isNull() ? new LLMaterial(current_material->asLLSD()) : new LLMaterial());
+ LLMaterialPtr new_material = _panel->createDefaultMaterial(current_material);
llassert_always(new_material);
// Determine correct alpha mode for current diffuse texture
@@ -242,10 +257,6 @@ private:
//
U8 default_alpha_mode = (_panel->isAlpha() ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE);
- // Default to matching expected state of UI
- //
- new_material->setDiffuseAlphaMode(current_material.isNull() ? default_alpha_mode : current_material->getDiffuseAlphaMode());
-
// Do "It"!
//
_edit->apply(new_material);
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 0cbdbe16a3..7b397d46f3 100755
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -91,7 +91,7 @@
#include "llvovolume.h"
#include "pipeline.h"
#include "llviewershadermgr.h"
-
+#include "llpanelface.h"
#include "llglheaders.h"
LLViewerObject* getSelectedParentObject(LLViewerObject *object) ;
@@ -2534,7 +2534,7 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch)
if (tep && !tep->getMaterialParams().isNull())
{
LLMaterialPtr orig = tep->getMaterialParams();
- LLMaterialPtr p = new LLMaterial(orig->asLLSD());
+ LLMaterialPtr p = gFloaterTools->getPanelFace()->createDefaultMaterial(orig);
p->setNormalRepeat(normal_scale_s, normal_scale_t);
p->setSpecularRepeat(specular_scale_s, specular_scale_t);
@@ -2560,8 +2560,8 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch)
if (tep && !tep->getMaterialParams().isNull())
{
LLMaterialPtr orig = tep->getMaterialParams();
+ LLMaterialPtr p = gFloaterTools->getPanelFace()->createDefaultMaterial(orig);
- LLMaterialPtr p = new LLMaterial(orig->asLLSD());
p->setNormalRepeat(normal_scale_s, normal_scale_t);
p->setSpecularRepeat(specular_scale_s, specular_scale_t);
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 4752e72de0..d7ae897604 100755
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -1500,6 +1500,8 @@ BOOL LLSpatialGroup::rebound()
if (mOctreeNode->getChildCount() == 1 && mOctreeNode->getElementCount() == 0)
{
LLSpatialGroup* group = (LLSpatialGroup*) mOctreeNode->getChild(0)->getListener(0);
+
+ //rebound single child
group->rebound();
//copy single child's bounding box
@@ -1508,10 +1510,11 @@ BOOL LLSpatialGroup::rebound()
mExtents[0] = group->mExtents[0];
mExtents[1] = group->mExtents[1];
+ //treat this node as a "chute" to a deeper level of the tree
group->setState(SKIP_FRUSTUM_CHECK);
}
else if (mOctreeNode->isLeaf())
- { //copy object bounding box if this is a leaf
+ { //copy object bounding box if this is a leaf
boundObjects(TRUE, mExtents[0], mExtents[1]);
mBounds[0] = mObjectBounds[0];
mBounds[1] = mObjectBounds[1];
@@ -1520,14 +1523,17 @@ BOOL LLSpatialGroup::rebound()
{
LLVector4a& newMin = mExtents[0];
LLVector4a& newMax = mExtents[1];
+
+ //get bounding box of first child
LLSpatialGroup* group = (LLSpatialGroup*) mOctreeNode->getChild(0)->getListener(0);
group->clearState(SKIP_FRUSTUM_CHECK);
group->rebound();
+
//initialize to first child
newMin = group->mExtents[0];
newMax = group->mExtents[1];
- //first, rebound children
+ //rebound remaining children, expanding bounding box to encompass children
for (U32 i = 1; i < mOctreeNode->getChildCount(); i++)
{
group = (LLSpatialGroup*) mOctreeNode->getChild(i)->getListener(0);
@@ -2520,7 +2526,7 @@ void pushBufferVerts(LLVertexBuffer* buffer, U32 mask)
}
}
-void pushBufferVerts(LLSpatialGroup* group, U32 mask)
+void pushBufferVerts(LLSpatialGroup* group, U32 mask, bool push_alpha = true)
{
if (group->mSpatialPartition->mRenderByGroup)
{
@@ -2529,7 +2535,10 @@ void pushBufferVerts(LLSpatialGroup* group, U32 mask)
LLDrawInfo* params = *(group->mDrawMap.begin()->second.begin());
LLRenderPass::applyModelMatrix(*params);
- pushBufferVerts(group->mVertexBuffer, mask);
+ if (push_alpha)
+ {
+ pushBufferVerts(group->mVertexBuffer, mask);
+ }
for (LLSpatialGroup::buffer_map_t::iterator i = group->mBufferMap.begin(); i != group->mBufferMap.end(); ++i)
{
@@ -2543,10 +2552,10 @@ void pushBufferVerts(LLSpatialGroup* group, U32 mask)
}
}
}
- else
+ /*else
{
- drawBox(group->mBounds[0], group->mBounds[1]);
- }
+ //drawBox(group->mBounds[0], group->mBounds[1]);
+ }*/
}
void pushVertsColorCoded(LLSpatialGroup* group, U32 mask)
@@ -2719,18 +2728,54 @@ void renderOctree(LLSpatialGroup* group)
// drawBoxOutline(LLVector3(node->getCenter()), LLVector3(node->getSize()));
}
+std::set<LLSpatialGroup*> visible_selected_groups;
+
void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
{
- LLGLEnable blend(GL_BLEND);
+ /*LLGLEnable blend(GL_BLEND);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
LLGLEnable cull(GL_CULL_FACE);
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);*/
- BOOL render_objects = (!LLPipeline::sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && group->isVisible() &&
+ /*BOOL render_objects = (!LLPipeline::sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && group->isVisible() &&
!group->isEmpty();
+
if (render_objects)
{
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE);
+
+ LLGLDisable blend(GL_BLEND);
+ gGL.diffuseColor4f(0.f, 0.75f, 0.f,0.5f);
+ pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX, false);
+
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ glLineWidth(4.f);
+ gGL.diffuseColor4f(0.f, 0.5f, 0.f, 1.f);
+ pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX, false);
+ glLineWidth(1.f);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+
+ bool selected = false;
+
+ for (LLSpatialGroup::element_iter iter = group->getDataBegin(); iter != group->getDataEnd(); ++iter)
+ {
+ LLDrawable* drawable = *iter;
+ if (drawable->getVObj().notNull() && drawable->getVObj()->isSelected())
+ {
+ selected = true;
+ break;
+ }
+ }
+
+ if (selected)
+ { //store for rendering occlusion volume as overlay
+ visible_selected_groups.insert(group);
+ }
+ }*/
+
+ /*if (render_objects)
+ {
LLGLDepthTest depth_under(GL_TRUE, GL_FALSE, GL_GREATER);
gGL.diffuseColor4f(0, 0.5f, 0, 0.5f);
gGL.diffuseColor4f(0, 0.5f, 0, 0.5f);
@@ -2754,6 +2799,59 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
gGL.diffuseColor4f(0.f, 0.75f, 0.f,0.5f);
gGL.diffuseColor4f(0.f, 0.75f, 0.f, 0.5f);
pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX);
+
+ bool selected = false;
+
+ for (LLSpatialGroup::element_iter iter = group->getDataBegin(); iter != group->getDataEnd(); ++iter)
+ {
+ LLDrawable* drawable = *iter;
+ if (drawable->getVObj().notNull() && drawable->getVObj()->isSelected())
+ {
+ selected = true;
+ break;
+ }
+ }
+
+ if (selected)
+ { //store for rendering occlusion volume as overlay
+ visible_selected_groups.insert(group);
+ }
+ }
+ }*/
+}
+
+void renderXRay(LLSpatialGroup* group, LLCamera* camera)
+{
+ BOOL render_objects = (!LLPipeline::sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && group->isVisible() &&
+ !group->isEmpty();
+
+ if (render_objects)
+ {
+ pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX, false);
+
+ bool selected = false;
+
+ for (LLSpatialGroup::element_iter iter = group->getDataBegin(); iter != group->getDataEnd(); ++iter)
+ {
+ LLDrawable* drawable = *iter;
+ if (drawable->getVObj().notNull() && drawable->getVObj()->isSelected())
+ {
+ selected = true;
+ break;
+ }
+ }
+
+ if (selected)
+ { //store for rendering occlusion volume as overlay
+
+ if (!group->mSpatialPartition->isBridge())
+ {
+ visible_selected_groups.insert(group);
+ }
+ else
+ {
+ visible_selected_groups.insert(group->mSpatialPartition->asBridge()->getSpatialGroup());
+ }
}
}
}
@@ -4247,6 +4345,48 @@ public:
}
};
+class LLOctreeRenderXRay : public LLOctreeTraveler<LLDrawable>
+{
+public:
+ LLCamera* mCamera;
+ LLOctreeRenderXRay(LLCamera* camera): mCamera(camera) {}
+
+ virtual void traverse(const LLSpatialGroup::OctreeNode* node)
+ {
+ LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
+
+ if (!mCamera || mCamera->AABBInFrustumNoFarClip(group->mBounds[0], group->mBounds[1]))
+ {
+ node->accept(this);
+ stop_glerror();
+
+ for (U32 i = 0; i < node->getChildCount(); i++)
+ {
+ traverse(node->getChild(i));
+ stop_glerror();
+ }
+
+ //render visibility wireframe
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION))
+ {
+ group->rebuildGeom();
+ group->rebuildMesh();
+
+ gGL.flush();
+ gGL.pushMatrix();
+ gGLLastMatrix = NULL;
+ gGL.loadMatrix(gGLModelView);
+ renderXRay(group, mCamera);
+ stop_glerror();
+ gGLLastMatrix = NULL;
+ gGL.popMatrix();
+ }
+ }
+ }
+
+ virtual void visit(const LLSpatialGroup::OctreeNode* node) {}
+
+};
class LLOctreeRenderPhysicsShapes : public LLOctreeTraveler<LLDrawable>
{
@@ -4474,6 +4614,26 @@ void LLSpatialPartition::renderDebug()
LLOctreeRenderNonOccluded render_debug(camera);
render_debug.traverse(mOctree);
+
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION))
+ {
+ {
+ LLGLEnable cull(GL_CULL_FACE);
+
+ LLGLEnable blend(GL_BLEND);
+ LLGLDepthTest depth_under(GL_TRUE, GL_FALSE, GL_GREATER);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ gGL.diffuseColor4f(0.5f, 0.0f, 0, 0.25f);
+
+ LLGLEnable offset(GL_POLYGON_OFFSET_LINE);
+ glPolygonOffset(-1.f, -1.f);
+
+ LLOctreeRenderXRay xray(camera);
+ xray.traverse(mOctree);
+
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ }
+ }
if (LLGLSLShader::sNoFixedFunction)
{
gDebugProgram.unbind();
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index e085834326..ef7d0cd81b 100755
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -58,6 +58,7 @@
#include "llviewerwindow.h"
#include "llvoavatarself.h"
#include "llworld.h"
+#include "llpanelface.h"
// syntactic sugar
#define callMemberFunction(object,ptrToMember) ((object).*(ptrToMember))
@@ -1163,7 +1164,51 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj,
// update viewer side image in anticipation of update from simulator
LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(asset_id);
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT );
- hit_obj->setTEImage(hit_face, image);
+
+ LLTextureEntry* tep = hit_obj ? (hit_obj->getTE(hit_face)) : NULL;
+
+ LLPanelFace* panel_face = gFloaterTools->getPanelFace();
+
+ if (gFloaterTools->getVisible() && panel_face)
+ {
+ switch (LLSelectMgr::getInstance()->getTextureChannel())
+ {
+
+ case 0:
+ default:
+ {
+ hit_obj->setTEImage(hit_face, image);
+ }
+ break;
+
+ case 1:
+ {
+ LLMaterialPtr old_mat = tep->getMaterialParams();
+ LLMaterialPtr new_mat = panel_face->createDefaultMaterial(old_mat);
+ new_mat->setNormalID(asset_id);
+ tep->setMaterialParams(new_mat);
+ hit_obj->setTENormalMap(hit_face, asset_id);
+ LLMaterialMgr::getInstance()->put(hit_obj->getID(), hit_face, *new_mat);
+ }
+ break;
+
+ case 2:
+ {
+ LLMaterialPtr old_mat = tep->getMaterialParams();
+ LLMaterialPtr new_mat = panel_face->createDefaultMaterial(old_mat);
+ new_mat->setSpecularID(asset_id);
+ tep->setMaterialParams(new_mat);
+ hit_obj->setTESpecularMap(hit_face, asset_id);
+ LLMaterialMgr::getInstance()->put(hit_obj->getID(), hit_face, *new_mat);
+ }
+ break;
+ }
+ }
+ else
+ {
+ hit_obj->setTEImage(hit_face, image);
+ }
+
dialog_refresh_all();
// send the update to the simulator
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index eb7b467855..422f18566f 100755
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -673,6 +673,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
static LLCullResult result;
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
+ LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE;
gPipeline.updateCull(*LLViewerCamera::getInstance(), result, water_clip);
stop_glerror();
@@ -879,7 +880,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
//}
LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE;
-
+
LLGLState::checkStates();
LLGLState::checkClientArrays();
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 8caa91c8c9..778c0ee61a 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -1227,7 +1227,7 @@ void LLViewerRegion::getInfo(LLSD& info)
info["Region"]["Handle"]["y"] = (LLSD::Integer)y;
}
-void LLViewerRegion::getSimulatorFeatures(LLSD& sim_features)
+void LLViewerRegion::getSimulatorFeatures(LLSD& sim_features) const
{
sim_features = mSimulatorFeatures;
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index e20ad0942c..e2cc95f232 100755
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -293,7 +293,7 @@ public:
bool meshRezEnabled() const;
bool meshUploadEnabled() const;
- void getSimulatorFeatures(LLSD& info);
+ void getSimulatorFeatures(LLSD& info) const;
void setSimulatorFeatures(const LLSD& info);
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index ca0077bf27..dfe4147d94 100755
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -42,22 +42,6 @@
#include "llvosky.h"
#include "llrender.h"
-#if LL_DARWIN
-#include "OpenGL/OpenGL.h"
-
-// include spec exp clamp to fix older mac rendering artifacts
-//
-#define SINGLE_FP_PERMUTATION(shader) \
- if (gGLManager.mIsMobileGF) \
- { \
- shader.addPermutation("SINGLE_FP_ONLY","1"); \
- }
-
-
-#else
-#define SINGLE_FP_PERMUTATION(shader)
-#endif
-
#ifdef LL_RELEASE_FOR_DOWNLOAD
#define UNIFORM_ERRS LL_WARNS_ONCE("Shader")
#else
@@ -100,6 +84,8 @@ LLGLSLShader gTwoTextureAddProgram;
LLGLSLShader gOneTextureNoColorProgram;
LLGLSLShader gDebugProgram;
LLGLSLShader gClipProgram;
+LLGLSLShader gDownsampleDepthProgram;
+LLGLSLShader gDownsampleDepthRectProgram;
LLGLSLShader gAlphaMaskProgram;
//object shaders
@@ -204,7 +190,7 @@ LLGLSLShader gDeferredTreeShadowProgram;
LLGLSLShader gDeferredAvatarProgram;
LLGLSLShader gDeferredAvatarAlphaProgram;
LLGLSLShader gDeferredLightProgram;
-LLGLSLShader gDeferredMultiLightProgram;
+LLGLSLShader gDeferredMultiLightProgram[16];
LLGLSLShader gDeferredSpotLightProgram;
LLGLSLShader gDeferredMultiSpotLightProgram;
LLGLSLShader gDeferredSunProgram;
@@ -668,6 +654,8 @@ void LLViewerShaderMgr::unloadShaders()
gOcclusionCubeProgram.unload();
gDebugProgram.unload();
gClipProgram.unload();
+ gDownsampleDepthProgram.unload();
+ gDownsampleDepthRectProgram.unload();
gAlphaMaskProgram.unload();
gUIProgram.unload();
gPathfindingProgram.unload();
@@ -1090,7 +1078,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredImpostorProgram.unload();
gDeferredTerrainProgram.unload();
gDeferredLightProgram.unload();
- gDeferredMultiLightProgram.unload();
+ for (U32 i = 0; i < LL_DEFERRED_MULTI_LIGHT_COUNT; ++i)
+ {
+ gDeferredMultiLightProgram[i].unload();
+ }
gDeferredSpotLightProgram.unload();
gDeferredMultiSpotLightProgram.unload();
gDeferredSunProgram.unload();
@@ -1270,8 +1261,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
bool has_skin = i & 0x10;
gDeferredMaterialProgram[i].addPermutation("HAS_SKIN",has_skin ? "1" : "0");
- SINGLE_FP_PERMUTATION(gDeferredMaterialProgram[i]);
-
if (has_skin)
{
gDeferredMaterialProgram[i].mFeatures.hasObjectSkinning = true;
@@ -1330,22 +1319,21 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
- SINGLE_FP_PERMUTATION(gDeferredLightProgram);
-
success = gDeferredLightProgram.createShader(NULL, NULL);
}
- if (success)
+ for (U32 i = 0; i < LL_DEFERRED_MULTI_LIGHT_COUNT; i++)
{
- gDeferredMultiLightProgram.mName = "Deferred MultiLight Shader";
- gDeferredMultiLightProgram.mShaderFiles.clear();
- gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair("deferred/multiPointLightV.glsl", GL_VERTEX_SHADER_ARB));
- gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair("deferred/multiPointLightF.glsl", GL_FRAGMENT_SHADER_ARB));
- gDeferredMultiLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
-
- SINGLE_FP_PERMUTATION(gDeferredMultiLightProgram);
-
- success = gDeferredMultiLightProgram.createShader(NULL, NULL);
+ if (success)
+ {
+ gDeferredMultiLightProgram[i].mName = llformat("Deferred MultiLight Shader %d", i);
+ gDeferredMultiLightProgram[i].mShaderFiles.clear();
+ gDeferredMultiLightProgram[i].mShaderFiles.push_back(make_pair("deferred/multiPointLightV.glsl", GL_VERTEX_SHADER_ARB));
+ gDeferredMultiLightProgram[i].mShaderFiles.push_back(make_pair("deferred/multiPointLightF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDeferredMultiLightProgram[i].mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+ gDeferredMultiLightProgram[i].addPermutation("LIGHT_COUNT", llformat("%d", i+1));
+ success = gDeferredMultiLightProgram[i].createShader(NULL, NULL);
+ }
}
if (success)
@@ -1356,8 +1344,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/spotLightF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredSpotLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
- SINGLE_FP_PERMUTATION(gDeferredSpotLightProgram);
-
success = gDeferredSpotLightProgram.createShader(NULL, NULL);
}
@@ -1369,8 +1355,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/multiSpotLightF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredMultiSpotLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
- SINGLE_FP_PERMUTATION(gDeferredMultiSpotLightProgram);
-
success = gDeferredMultiSpotLightProgram.createShader(NULL, NULL);
}
@@ -1398,8 +1382,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSunProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
gDeferredSunProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
- SINGLE_FP_PERMUTATION(gDeferredSunProgram);
-
success = gDeferredSunProgram.createShader(NULL, NULL);
}
@@ -1411,8 +1393,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair("deferred/blurLightF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredBlurLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
- SINGLE_FP_PERMUTATION(gDeferredBlurLightProgram);
-
success = gDeferredBlurLightProgram.createShader(NULL, NULL);
}
@@ -1444,8 +1424,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAlphaProgram.addPermutation("HAS_SHADOW", mVertexShaderLevel[SHADER_DEFERRED] > 1 ? "1" : "0");
gDeferredAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
- SINGLE_FP_PERMUTATION(gDeferredAlphaProgram);
-
success = gDeferredAlphaProgram.createShader(NULL, NULL);
// Hack
@@ -1562,8 +1540,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSoftenProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
- SINGLE_FP_PERMUTATION(gDeferredSoftenProgram);
-
if (gSavedSettings.getBOOL("RenderDeferredSSAO"))
{ //if using SSAO, take screen space light map into account as if shadows are enabled
gDeferredSoftenProgram.mShaderLevel = llmax(gDeferredSoftenProgram.mShaderLevel, 2);
@@ -2968,6 +2944,26 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
if (success)
{
+ gDownsampleDepthProgram.mName = "DownsampleDepth Shader";
+ gDownsampleDepthProgram.mShaderFiles.clear();
+ gDownsampleDepthProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthV.glsl", GL_VERTEX_SHADER_ARB));
+ gDownsampleDepthProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDownsampleDepthProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
+ success = gDownsampleDepthProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gDownsampleDepthRectProgram.mName = "DownsampleDepthRect Shader";
+ gDownsampleDepthRectProgram.mShaderFiles.clear();
+ gDownsampleDepthRectProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthV.glsl", GL_VERTEX_SHADER_ARB));
+ gDownsampleDepthRectProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthRectF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDownsampleDepthRectProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
+ success = gDownsampleDepthRectProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gAlphaMaskProgram.mName = "Alpha Mask Shader";
gAlphaMaskProgram.mShaderFiles.clear();
gAlphaMaskProgram.mShaderFiles.push_back(make_pair("interface/alphamaskV.glsl", GL_VERTEX_SHADER_ARB));
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
index 1076f4778f..a685ce5914 100755
--- a/indra/newview/llviewershadermgr.h
+++ b/indra/newview/llviewershadermgr.h
@@ -30,6 +30,8 @@
#include "llshadermgr.h"
#include "llmaterial.h"
+#define LL_DEFERRED_MULTI_LIGHT_COUNT 16
+
class LLViewerShaderMgr: public LLShaderMgr
{
public:
@@ -164,6 +166,8 @@ extern LLGLSLShader gSplatTextureRectProgram;
extern LLGLSLShader gGlowCombineFXAAProgram;
extern LLGLSLShader gDebugProgram;
extern LLGLSLShader gClipProgram;
+extern LLGLSLShader gDownsampleDepthProgram;
+extern LLGLSLShader gDownsampleDepthRectProgram;
//output tex0[tc0] + tex1[tc1]
extern LLGLSLShader gTwoTextureAddProgram;
@@ -256,6 +260,7 @@ extern LLGLSLShader gWLCloudProgram;
extern LLGLSLShader gPostColorFilterProgram;
extern LLGLSLShader gPostNightVisionProgram;
+
// Deferred rendering shaders
extern LLGLSLShader gDeferredImpostorProgram;
extern LLGLSLShader gDeferredWaterProgram;
@@ -272,7 +277,7 @@ extern LLGLSLShader gDeferredTerrainProgram;
extern LLGLSLShader gDeferredTreeProgram;
extern LLGLSLShader gDeferredTreeShadowProgram;
extern LLGLSLShader gDeferredLightProgram;
-extern LLGLSLShader gDeferredMultiLightProgram;
+extern LLGLSLShader gDeferredMultiLightProgram[LL_DEFERRED_MULTI_LIGHT_COUNT];
extern LLGLSLShader gDeferredSpotLightProgram;
extern LLGLSLShader gDeferredMultiSpotLightProgram;
extern LLGLSLShader gDeferredSunProgram;
@@ -303,7 +308,6 @@ extern LLGLSLShader gDeferredSkinnedFullbrightShinyProgram;
extern LLGLSLShader gDeferredSkinnedFullbrightProgram;
extern LLGLSLShader gNormalMapGenProgram;
-
// Deferred materials shaders
extern LLGLSLShader gDeferredMaterialProgram[LLMaterial::SHADER_COUNT*2];
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index e26c54c23c..4835ffcd8f 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3546,7 +3546,12 @@ F32 LLVOVolume::getBinRadius()
}
else if (mDrawable->isStatic())
{
- radius = llmax((S32) mDrawable->getRadius(), 1)*size_factor;
+ F32 szf = size_factor;
+
+ radius = llmax(mDrawable->getRadius(), szf);
+
+ radius = powf(radius, 1.f+szf/radius);
+
radius *= 1.f + mDrawable->mDistanceWRTCamera * distance_factor[1];
radius += mDrawable->mDistanceWRTCamera * distance_factor[0];
}
@@ -5483,7 +5488,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac
mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE;
}
- bool use_legacy_bump = te->getBumpmap() && (!mat || mat->getNormalID().isNull());
+ bool use_legacy_bump = te->getBumpmap() && (te->getBumpmap() < 18) && (!mat || mat->getNormalID().isNull());
if (mat && LLPipeline::sRenderDeferred && !hud_group)
{
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index c59f05ef0d..231508e253 100755
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -111,6 +111,8 @@
#include "llpathinglib.h"
#include "llfloaterpathfindingconsole.h"
#include "llfloaterpathfindingcharacters.h"
+#include "llfloatertools.h"
+#include "llpanelface.h"
#include "llpathfindingpathtool.h"
#ifdef _DEBUG
@@ -291,7 +293,7 @@ std::string gPoolNames[] =
"POOL_ALPHA"
};
-void drawBox(const LLVector3& c, const LLVector3& r);
+void drawBox(const LLVector4a& c, const LLVector4a& r);
void drawBoxOutline(const LLVector3& pos, const LLVector3& size);
U32 nhpo2(U32 v);
LLVertexBuffer* ll_create_cube_vb(U32 type_mask, U32 usage);
@@ -942,9 +944,12 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
S32 shadow_detail = RenderShadowDetail;
BOOL ssao = RenderDeferredSSAO;
+ const U32 occlusion_divisor = 3;
+
//allocate deferred rendering color buffers
if (!mDeferredScreen.allocate(resX, resY, GL_SRGB8_ALPHA8, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
if (!mDeferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
+ if (!mOcclusionDepth.allocate(resX/occlusion_divisor, resY/occlusion_divisor, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
if (!addDeferredAttachments(mDeferredScreen)) return false;
GLuint screenFormat = GL_RGBA16;
@@ -985,6 +990,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
for (U32 i = 0; i < 4; i++)
{
if (!mShadow[i].allocate(sun_shadow_map_width,U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_TEXTURE)) return false;
+ if (!mShadowOcclusion[i].allocate(mShadow[i].getWidth()/occlusion_divisor, mShadow[i].getHeight()/occlusion_divisor, 0, TRUE, FALSE, LLTexUnit::TT_TEXTURE)) return false;
}
}
else
@@ -992,6 +998,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
for (U32 i = 0; i < 4; i++)
{
mShadow[i].release();
+ mShadowOcclusion[i].release();
}
}
@@ -1004,6 +1011,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
for (U32 i = 4; i < 6; i++)
{
if (!mShadow[i].allocate(spot_shadow_map_width, height, 0, TRUE, FALSE)) return false;
+ if (!mShadowOcclusion[i].allocate(mShadow[i].getWidth()/occlusion_divisor, mShadow[i].getHeight()/occlusion_divisor, 0, TRUE, FALSE)) return false;
}
}
else
@@ -1011,6 +1019,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
for (U32 i = 4; i < 6; i++)
{
mShadow[i].release();
+ mShadowOcclusion[i].release();
}
}
@@ -1027,11 +1036,13 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
for (U32 i = 0; i < 6; i++)
{
mShadow[i].release();
+ mShadowOcclusion[i].release();
}
mFXAABuffer.release();
mScreen.release();
mDeferredScreen.release(); //make sure to release any render targets that share a depth buffer with mDeferredScreen first
mDeferredDepth.release();
+ mOcclusionDepth.release();
if (!mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
}
@@ -1404,12 +1415,20 @@ void LLPipeline::createLUTBuffers()
}
}
- LLImageGL::generateTextures(LLTexUnit::TT_TEXTURE, GL_R16F, 1, &mLightFunc);
+ U32 pix_format = GL_R16F;
+#if LL_DARWIN
+ // Need to work around limited precision with 10.6.8 and older drivers
+ //
+ pix_format = GL_R32F;
+#endif
+ LLImageGL::generateTextures(LLTexUnit::TT_TEXTURE, pix_format, 1, &mLightFunc);
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mLightFunc);
- LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_R16F, lightResX, lightResY, GL_RED, GL_FLOAT, ls, false);
+ LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, pix_format, lightResX, lightResY, GL_RED, GL_FLOAT, ls, false);
//LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_UNSIGNED_BYTE, lightResX, lightResY, GL_RED, GL_UNSIGNED_BYTE, ls, false);
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_TRILINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
delete [] ls;
}
@@ -2443,7 +2462,14 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
if (to_texture)
{
- mScreen.bindTarget();
+ if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender)
+ {
+ mOcclusionDepth.bindTarget();
+ }
+ else
+ {
+ mScreen.bindTarget();
+ }
}
if (sUseOcclusion > 1)
@@ -2581,7 +2607,14 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
if (to_texture)
{
- mScreen.flush();
+ if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender)
+ {
+ mOcclusionDepth.flush();
+ }
+ else
+ {
+ mScreen.flush();
+ }
}
}
@@ -2649,6 +2682,73 @@ void LLPipeline::markOccluder(LLSpatialGroup* group)
}
}
+void LLPipeline::downsampleDepthBuffer(LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space)
+{
+ LLGLSLShader* last_shader = LLGLSLShader::sCurBoundShaderPtr;
+
+ LLGLSLShader* shader = NULL;
+
+ if (scratch_space)
+ {
+ scratch_space->copyContents(source,
+ 0, 0, source.getWidth(), source.getHeight(),
+ 0, 0, scratch_space->getWidth(), scratch_space->getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST);
+ }
+
+ dest.bindTarget();
+ dest.clear(GL_DEPTH_BUFFER_BIT);
+
+ LLStrider<LLVector3> vert;
+ mDeferredVB->getVertexStrider(vert);
+ LLStrider<LLVector2> tc0;
+
+ vert[0].set(-1,1,0);
+ vert[1].set(-1,-3,0);
+ vert[2].set(3,1,0);
+
+ if (source.getUsage() == LLTexUnit::TT_RECT_TEXTURE)
+ {
+ shader = &gDownsampleDepthRectProgram;
+ shader->bind();
+ shader->uniform2f("delta", 1.f, 1.f);
+ shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, source.getWidth(), source.getHeight());
+ }
+ else
+ {
+ shader = &gDownsampleDepthProgram;
+ shader->bind();
+ shader->uniform2f("delta", 1.f/source.getWidth(), 1.f/source.getHeight());
+ shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, 1.f, 1.f);
+ }
+
+ gGL.getTexUnit(0)->bind(scratch_space ? scratch_space : &source, TRUE);
+
+ {
+ LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+ }
+
+ dest.flush();
+
+ if (last_shader)
+ {
+ last_shader->bind();
+ }
+ else
+ {
+ shader->unbind();
+ }
+}
+
+void LLPipeline::doOcclusion(LLCamera& camera, LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space)
+{
+ downsampleDepthBuffer(source, dest, scratch_space);
+ dest.bindTarget();
+ doOcclusion(camera);
+ dest.flush();
+}
+
void LLPipeline::doOcclusion(LLCamera& camera)
{
if (LLPipeline::sUseOcclusion > 1 && sCull->hasOcclusionGroups())
@@ -3878,7 +3978,7 @@ void LLPipeline::postSort(LLCamera& camera)
{
mSelectedFaces.clear();
- LLPipeline::setRenderHighlightTextureChannel(LLSelectMgr::getInstance()->getTextureChannel());
+ LLPipeline::setRenderHighlightTextureChannel(gFloaterTools->getPanelFace()->getTextureChannelToEdit());
// Draw face highlights for selected faces.
if (LLSelectMgr::getInstance()->getTEMode())
@@ -4561,7 +4661,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
gGL.setColorMask(true, false);
}
-void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
+void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion)
{
LLFastTimer t(FTM_POST_DEFERRED_POOLS);
U32 cur_type = 0;
@@ -4576,7 +4676,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
gGL.setColorMask(true, false);
pool_set_t::iterator iter1 = mPools.begin();
- BOOL occlude = LLPipeline::sUseOcclusion > 1;
+ BOOL occlude = LLPipeline::sUseOcclusion > 1 && do_occlusion;
while ( iter1 != mPools.end() )
{
@@ -4590,7 +4690,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
gGLLastMatrix = NULL;
gGL.loadMatrix(gGLModelView);
LLGLSLShader::bindNoShader();
- doOcclusion(camera);
+ doOcclusion(camera, mScreen, mOcclusionDepth, &mDeferredDepth);
gGL.setColorMask(true, false);
}
@@ -4796,6 +4896,7 @@ void LLPipeline::renderPhysicsDisplay()
mPhysicsDisplay.flush();
}
+extern std::set<LLSpatialGroup*> visible_selected_groups;
void LLPipeline::renderDebug()
{
@@ -5206,6 +5307,27 @@ void LLPipeline::renderDebug()
}
}
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION) && LLGLSLShader::sNoFixedFunction)
+ { //render visible selected group occlusion geometry
+ gDebugProgram.bind();
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE);
+ gGL.diffuseColor3f(1,0,1);
+ for (std::set<LLSpatialGroup*>::iterator iter = visible_selected_groups.begin(); iter != visible_selected_groups.end(); ++iter)
+ {
+ LLSpatialGroup* group = *iter;
+
+ LLVector4a fudge;
+ fudge.splat(0.25f); //SG_OCCLUSION_FUDGE
+
+ LLVector4a size;
+ size.setAdd(fudge, group->mBounds[1]);
+
+ drawBox(group->mBounds[0], size);
+ }
+ }
+
+ visible_selected_groups.clear();
+
if (LLGLSLShader::sNoFixedFunction)
{
gUIProgram.bind();
@@ -5860,9 +5982,9 @@ void LLPipeline::setupAvatarLights(BOOL for_edit)
if (LLPipeline::sRenderDeferred)
{
- diffuse.mV[0] = powf(diffuse.mV[0], 2.2f);
+ /*diffuse.mV[0] = powf(diffuse.mV[0], 2.2f);
diffuse.mV[1] = powf(diffuse.mV[1], 2.2f);
- diffuse.mV[2] = powf(diffuse.mV[2], 2.2f);
+ diffuse.mV[2] = powf(diffuse.mV[2], 2.2f);*/
}
mHWLightColors[1] = diffuse;
@@ -5907,9 +6029,9 @@ void LLPipeline::setupAvatarLights(BOOL for_edit)
if (LLPipeline::sRenderDeferred)
{
- backlight_diffuse.mV[0] = powf(backlight_diffuse.mV[0], 2.2f);
+ /*backlight_diffuse.mV[0] = powf(backlight_diffuse.mV[0], 2.2f);
backlight_diffuse.mV[1] = powf(backlight_diffuse.mV[1], 2.2f);
- backlight_diffuse.mV[2] = powf(backlight_diffuse.mV[2], 2.2f);
+ backlight_diffuse.mV[2] = powf(backlight_diffuse.mV[2], 2.2f);*/
}
mHWLightColors[1] = backlight_diffuse;
@@ -6121,9 +6243,9 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
if (LLPipeline::sRenderDeferred)
{
- light_diffuse.mV[0] = powf(light_diffuse.mV[0], 2.2f);
+ /*light_diffuse.mV[0] = powf(light_diffuse.mV[0], 2.2f);
light_diffuse.mV[1] = powf(light_diffuse.mV[1], 2.2f);
- light_diffuse.mV[2] = powf(light_diffuse.mV[2], 2.2f);
+ light_diffuse.mV[2] = powf(light_diffuse.mV[2], 2.2f);*/
}
mHWLightColors[0] = light_diffuse;
@@ -6196,9 +6318,9 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
if (LLPipeline::sRenderDeferred)
{
- light_color.mV[0] = powf(light_color.mV[0], 2.2f);
+ /*light_color.mV[0] = powf(light_color.mV[0], 2.2f);
light_color.mV[1] = powf(light_color.mV[1], 2.2f);
- light_color.mV[2] = powf(light_color.mV[2], 2.2f);
+ light_color.mV[2] = powf(light_color.mV[2], 2.2f);*/
}
mHWLightColors[cur_light] = light_color;
@@ -6211,7 +6333,7 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
if (sRenderDeferred)
{
F32 size = light_radius*1.5f;
- light_state->setLinearAttenuation(size*size);
+ light_state->setLinearAttenuation(size);
light_state->setQuadraticAttenuation(light->getLightFalloff()*0.5f+1.f);
}
else
@@ -6276,9 +6398,9 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
if (LLPipeline::sRenderDeferred)
{
- light_color.mV[0] = powf(light_color.mV[0], 2.2f);
+ /*light_color.mV[0] = powf(light_color.mV[0], 2.2f);
light_color.mV[1] = powf(light_color.mV[1], 2.2f);
- light_color.mV[2] = powf(light_color.mV[2], 2.2f);
+ light_color.mV[2] = powf(light_color.mV[2], 2.2f);*/
}
mHWLightColors[2] = light_color;
@@ -8278,11 +8400,7 @@ void LLPipeline::renderDeferredLighting()
LLStrider<LLVector3> vert;
mDeferredVB->getVertexStrider(vert);
- LLStrider<LLVector2> tc0;
- LLStrider<LLVector2> tc1;
- mDeferredVB->getTexCoord0Strider(tc0);
- mDeferredVB->getTexCoord1Strider(tc1);
-
+
vert[0].set(-1,1,0);
vert[1].set(-1,-3,0);
vert[2].set(3,1,0);
@@ -8462,7 +8580,7 @@ void LLPipeline::renderDeferredLighting()
LLPipeline::END_RENDER_TYPES);
- renderGeomPostDeferred(*LLViewerCamera::getInstance());
+ renderGeomPostDeferred(*LLViewerCamera::getInstance(), false);
gPipeline.popRenderTypeMask();
}
@@ -8556,13 +8674,13 @@ void LLPipeline::renderDeferredLighting()
continue;
}
- col.mV[0] = powf(col.mV[0], 2.2f);
+ /*col.mV[0] = powf(col.mV[0], 2.2f);
col.mV[1] = powf(col.mV[1], 2.2f);
- col.mV[2] = powf(col.mV[2], 2.2f);
+ col.mV[2] = powf(col.mV[2], 2.2f);*/
LLFastTimer ftm(FTM_LOCAL_LIGHTS);
gDeferredLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c);
- gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s*s);
+ gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s);
gDeferredLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f);
gGL.syncMatrices();
@@ -8583,7 +8701,7 @@ void LLPipeline::renderDeferredLighting()
glh::vec3f tc(c);
mat.mult_matrix_vec(tc);
- fullscreen_lights.push_back(LLVector4(tc.v[0], tc.v[1], tc.v[2], s*s));
+ fullscreen_lights.push_back(LLVector4(tc.v[0], tc.v[1], tc.v[2], s));
light_colors.push_back(LLVector4(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f));
}
}
@@ -8616,12 +8734,12 @@ void LLPipeline::renderDeferredLighting()
setupSpotLight(gDeferredSpotLightProgram, drawablep);
LLColor3 col = volume->getLightColor();
- col.mV[0] = powf(col.mV[0], 2.2f);
+ /*col.mV[0] = powf(col.mV[0], 2.2f);
col.mV[1] = powf(col.mV[1], 2.2f);
- col.mV[2] = powf(col.mV[2], 2.2f);
+ col.mV[2] = powf(col.mV[2], 2.2f);*/
gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c);
- gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s*s);
+ gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s);
gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f);
gGL.syncMatrices();
@@ -8639,10 +8757,6 @@ void LLPipeline::renderDeferredLighting()
vert[2].set(3,1,0);
{
- bindDeferredShader(gDeferredMultiLightProgram);
-
- mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
-
LLGLDepthTest depth(GL_FALSE);
//full screen blit
@@ -8654,7 +8768,7 @@ void LLPipeline::renderDeferredLighting()
U32 count = 0;
- const U32 max_count = 8;
+ const U32 max_count = LL_DEFERRED_MULTI_LIGHT_COUNT;
LLVector4 light[max_count];
LLVector4 col[max_count];
@@ -8668,26 +8782,29 @@ void LLPipeline::renderDeferredLighting()
col[count] = light_colors.front();
light_colors.pop_front();
- col[count].mV[0] = powf(col[count].mV[0], 2.2f);
+ /*col[count].mV[0] = powf(col[count].mV[0], 2.2f);
col[count].mV[1] = powf(col[count].mV[1], 2.2f);
- col[count].mV[2] = powf(col[count].mV[2], 2.2f);
+ col[count].mV[2] = powf(col[count].mV[2], 2.2f);*/
- far_z = llmin(light[count].mV[2]-sqrtf(light[count].mV[3]), far_z);
+ far_z = llmin(light[count].mV[2]-light[count].mV[3], far_z);
//col[count] = pow4fsrgb(col[count], 2.2f);
count++;
if (count == max_count || fullscreen_lights.empty())
{
- gDeferredMultiLightProgram.uniform1i(LLShaderMgr::MULTI_LIGHT_COUNT, count);
- gDeferredMultiLightProgram.uniform4fv(LLShaderMgr::MULTI_LIGHT, count, (GLfloat*) light);
- gDeferredMultiLightProgram.uniform4fv(LLShaderMgr::MULTI_LIGHT_COL, count, (GLfloat*) col);
- gDeferredMultiLightProgram.uniform1f(LLShaderMgr::MULTI_LIGHT_FAR_Z, far_z);
+ U32 idx = count-1;
+ bindDeferredShader(gDeferredMultiLightProgram[idx]);
+ gDeferredMultiLightProgram[idx].uniform1i(LLShaderMgr::MULTI_LIGHT_COUNT, count);
+ gDeferredMultiLightProgram[idx].uniform4fv(LLShaderMgr::MULTI_LIGHT, count, (GLfloat*) light);
+ gDeferredMultiLightProgram[idx].uniform4fv(LLShaderMgr::MULTI_LIGHT_COL, count, (GLfloat*) col);
+ gDeferredMultiLightProgram[idx].uniform1f(LLShaderMgr::MULTI_LIGHT_FAR_Z, far_z);
far_z = 0.f;
count = 0;
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
}
}
- unbindDeferredShader(gDeferredMultiLightProgram);
+ unbindDeferredShader(gDeferredMultiLightProgram[0]);
bindDeferredShader(gDeferredMultiSpotLightProgram);
@@ -8715,12 +8832,12 @@ void LLPipeline::renderDeferredLighting()
LLColor3 col = volume->getLightColor();
- col.mV[0] = powf(col.mV[0], 2.2f);
+ /*col.mV[0] = powf(col.mV[0], 2.2f);
col.mV[1] = powf(col.mV[1], 2.2f);
- col.mV[2] = powf(col.mV[2], 2.2f);
+ col.mV[2] = powf(col.mV[2], 2.2f);*/
gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v);
- gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s*s);
+ gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s);
gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f);
mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
@@ -9396,9 +9513,15 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
gDeferredShadowCubeProgram.bind();
}
+ LLRenderTarget& occlusion_target = mShadowOcclusion[LLViewerCamera::sCurCameraID-1];
+
+ occlusion_target.bindTarget();
updateCull(shadow_cam, result);
+ occlusion_target.flush();
+
stateSort(shadow_cam, result);
+
//generate shadow map
gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.pushMatrix();
@@ -9486,7 +9609,10 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
gDeferredShadowCubeProgram.bind();
gGLLastMatrix = NULL;
gGL.loadMatrix(gGLModelView);
- doOcclusion(shadow_cam);
+
+ LLRenderTarget& occlusion_source = mShadow[LLViewerCamera::sCurCameraID-1];
+
+ doOcclusion(shadow_cam, occlusion_source, occlusion_target);
if (use_shader)
{
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 0f2a807f7a..f0bebbe20d 100755
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -177,6 +177,12 @@ public:
// Object related methods
void markVisible(LLDrawable *drawablep, LLCamera& camera);
void markOccluder(LLSpatialGroup* group);
+
+ //downsample source to dest, taking the maximum depth value per pixel in source and writing to dest
+ // if source's depth buffer cannot be bound for reading, a scratch space depth buffer must be provided
+ void downsampleDepthBuffer(LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space = NULL);
+
+ void doOcclusion(LLCamera& camera, LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space = NULL);
void doOcclusion(LLCamera& camera);
void markNotCulled(LLSpatialGroup* group, LLCamera &camera);
void markMoved(LLDrawable *drawablep, BOOL damped_motion = FALSE);
@@ -282,7 +288,7 @@ public:
void renderGeom(LLCamera& camera, BOOL forceVBOUpdate = FALSE);
void renderGeomDeferred(LLCamera& camera);
- void renderGeomPostDeferred(LLCamera& camera);
+ void renderGeomPostDeferred(LLCamera& camera, bool do_occlusion=true);
void renderGeomShadow(LLCamera& camera);
void bindDeferredShader(LLGLSLShader& shader, U32 light_index = 0, U32 noise_map = 0xFFFFFFFF);
void setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep);
@@ -610,6 +616,7 @@ public:
LLRenderTarget mFXAABuffer;
LLRenderTarget mEdgeMap;
LLRenderTarget mDeferredDepth;
+ LLRenderTarget mOcclusionDepth;
LLRenderTarget mDeferredLight;
LLRenderTarget mHighlight;
LLRenderTarget mPhysicsDisplay;
@@ -622,6 +629,7 @@ public:
//sun shadow map
LLRenderTarget mShadow[6];
+ LLRenderTarget mShadowOcclusion[6];
std::vector<LLVector3> mShadowFrustPoints[4];
LLVector4 mShadowError;
LLVector4 mShadowFOV;
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 35451c9621..53a3e732ca 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -172,7 +172,7 @@ class ViewerManifest(LLManifest):
def app_name(self):
app_suffix='Test'
channel_type=self.channel_lowerword()
- if channel_type == 'release' :
+ if channel_type.startswith('release') :
app_suffix='Viewer'
elif re.match('^(beta|project).*',channel_type) :
app_suffix=self.channel_unique()
@@ -182,8 +182,8 @@ class ViewerManifest(LLManifest):
icon_path="icons/"
channel_type=self.channel_lowerword()
print "Icon channel type '%s'" % channel_type
- if channel_type == 'release' :
- icon_path += channel_type
+ if channel_type.startswith('release') :
+ icon_path += 'release'
elif re.match('^beta.*',channel_type) :
icon_path += 'beta'
elif re.match('^project.*',channel_type) :
@@ -242,7 +242,7 @@ class WindowsManifest(ViewerManifest):
def final_exe(self):
app_suffix="Test"
channel_type=self.channel_lowerword()
- if channel_type == 'release' :
+ if channel_type.startswith('release') :
app_suffix=''
elif re.match('^(beta|project).*',channel_type) :
app_suffix=''.join(self.channel_unique().split())