summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/transportF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/transportF.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class3/windlight/transportF.glsl24
-rw-r--r--indra/newview/lldrawpoolalpha.cpp621
-rw-r--r--indra/newview/lldrawpoolavatar.cpp105
-rw-r--r--indra/newview/lldrawpoolbump.cpp16
-rw-r--r--indra/newview/lldrawpoolmaterials.cpp9
-rw-r--r--indra/newview/lldrawpoolsimple.cpp115
-rw-r--r--indra/newview/lldrawpoolwater.cpp2
-rw-r--r--indra/newview/llviewershadermgr.cpp36
-rw-r--r--indra/newview/pipeline.cpp53
-rw-r--r--indra/newview/pipeline.h5
23 files changed, 430 insertions, 635 deletions
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
index c4caed4d71..767fad016c 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
@@ -38,5 +38,12 @@ mat4 getSkinnedTransform()
ret[1] = mix(matrixPalette[i+15],matrixPalette[i+16], x);
ret[2] = mix(matrixPalette[i+30],matrixPalette[i+31], x);
ret[3] = vec4(0,0,0,1);
+
return ret;
+
+#ifdef IS_AMD_CARD
+ // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts.
+ vec4 dummy1 = matrixPalette[0];
+ vec4 dummy2 = matrixPalette[44];
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
index 94de2f7b53..90bf2851c9 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
@@ -61,5 +61,12 @@ mat4 getObjectSkinnedTransform()
ret[3] = vec4(trans, 1.0);
return ret;
+
+#ifdef IS_AMD_CARD
+ // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts.
+ mat3x4 dummy1 = matrixPalette[0];
+ mat3x4 dummy2 = matrixPalette[MAX_JOINTS_PER_MESH_OBJECT-1];
+#endif
+
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl
index 10407eeb02..3572331d74 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl
@@ -25,11 +25,9 @@
uniform vec4 sunlight_color;
uniform vec4 light_ambient;
-uniform int no_atmo;
vec3 atmosAmbient(vec3 light)
{
- if (no_atmo == 1) return light + vec3(0.66);
return light + light_ambient.rgb;
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
index 14034bccae..7e4855b7c6 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
@@ -25,11 +25,9 @@
uniform vec4 sunlight_color;
uniform vec4 light_ambient;
-uniform int no_atmo;
vec3 atmosAmbient(vec3 light)
{
- if (no_atmo == 1) return light + vec3(0.66);
return light + light_ambient.rgb;
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl
index 667301443a..9917ba8d3b 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl
@@ -23,7 +23,6 @@
* $/LicenseInfo$
*/
-uniform int no_atmo;
uniform vec4 gamma;
vec3 scaleSoftClipFrag(vec3 light)
diff --git a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl
index e2b391cb7a..f61194db6d 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl
@@ -23,8 +23,6 @@
* $/LicenseInfo$
*/
-uniform int no_atmo;
-
vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten)
{
/* stub function for fallback compatibility on class1 hardware */
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index 142b03e095..0f6bf38388 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -212,6 +212,7 @@ void main()
col = dlit*lit*diff_tex*shadow;
amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance;
+ amb_da = min(amb_da,shadow);
}
//float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0);
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
index 565c00ba79..ebb06e0f23 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
@@ -43,17 +43,12 @@ uniform float max_y;
uniform vec4 glow;
uniform float scene_light_strength;
uniform mat3 ssao_effect_mat;
-uniform int no_atmo;
uniform float sun_moon_glow_factor;
vec3 scaleSoftClipFrag(vec3 light);
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten)
{
- if (no_atmo == 1)
- {
- return light;
- }
light *= atten.r;
light += additive;
return light * 2.0;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl
index 86743dc306..c836ca98c5 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl
@@ -26,11 +26,9 @@
// Output variables
uniform float scene_light_strength;
-uniform int no_atmo;
vec3 atmosFragAmbient(vec3 light, vec3 amblit)
{
- if (no_atmo == 1) return light;
return amblit + light / 2.0;
}
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl
index 95b4a76880..589c95bc96 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl
@@ -33,11 +33,9 @@ vec3 getAtmosAttenuation();
vec3 getPositionEye();
uniform float scene_light_strength;
-uniform int no_atmo;
vec3 atmosAmbient(vec3 light)
{
- if (no_atmo == 1) return light + vec3(0.66);
return getAmblitColor() + light / 2.0;
}
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
index a26752f741..bef7a8827a 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
@@ -64,8 +64,8 @@ void calcAtmospherics(vec3 inPositionEye) {
setPositionEye(P);
//(TERRAIN) limit altitude
- //if (P.y > max_y) P *= (max_y / P.y);
- //if (P.y < -max_y) P *= (-max_y / P.y);
+ if (P.y > max_y) P *= (max_y / P.y);
+ if (P.y < -max_y) P *= (-max_y / P.y);
vec3 tmpLightnorm = lightnorm.xyz;
@@ -134,21 +134,11 @@ void calcAtmospherics(vec3 inPositionEye) {
+ tmpAmbient));
additive = normalize(additive);
- //haze color
- //setAdditiveColor(
- // vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient)
- // + (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x
- // + tmpAmbient)));
-
//brightness of surface both sunlight and ambient
setSunlitColor(vec3(sunlight * .5));
setAmblitColor(vec3(tmpAmbient * .25));
setAdditiveColor(additive * vec3(1.0 - exp(-temp2.z * distance_multiplier)) * 0.5);
- // vary_SunlitColor = vec3(0);
- // vary_AmblitColor = vec3(0);
- // vary_AdditiveColor = vec4(Pn, 1.0);
-
/*
const float cloudShadowScale = 100.;
// Get cloud uvs for shadowing
diff --git a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
index 143bafc9c9..e985c50c67 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
@@ -26,16 +26,12 @@
uniform vec4 gamma;
-uniform int no_atmo;
vec3 getAtmosAttenuation();
+vec3 getAdditiveColor();
vec3 scaleSoftClipFrag(vec3 light)
{
- if (no_atmo == 1)
- {
- return light;
- }
//soft clip effect:
light = 1. - clamp(light, vec3(0.), vec3(1.));
light = 1. - pow(light, gamma.xxx);
@@ -47,12 +43,13 @@ vec3 scaleSoftClip(vec3 light)
return scaleSoftClipFrag(light);
}
-vec3 fullbrightScaleSoftClipFrag(vec3 light, vec3 add, vec3 atten) {
- return scaleSoftClipFrag(light.rgb);
+vec3 fullbrightScaleSoftClipFrag(vec3 light, vec3 add, vec3 atten)
+{
+ return mix(scaleSoftClipFrag(light.rgb), add, atten);
}
vec3 fullbrightScaleSoftClip(vec3 light)
{
- return scaleSoftClipFrag(light);
+ return fullbrightScaleSoftClipFrag(light, getAdditiveColor(), getAtmosAttenuation());
}
diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl
index df731662e8..d799453712 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl
@@ -30,34 +30,21 @@
vec3 getAdditiveColor();
vec3 getAtmosAttenuation();
-uniform int no_atmo;
-
vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten)
{
- if (no_atmo == 1)
- {
- return light;
- }
light *= atten.r;
- light += additive * 2.0;
- return light;
+ light += additive;
+ return light * 2.0;
}
vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten)
{
- if (no_atmo == 1)
- {
- return light;
- }
float brightness = dot(light.rgb, vec3(0.33333));
return mix(atmosTransportFrag(light.rgb, additive, atten), light.rgb + additive.rgb, brightness * brightness);
}
-vec3 fullbrightShinyAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) {
- if (no_atmo == 1)
- {
- return light;
- }
+vec3 fullbrightShinyAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten)
+{
float brightness = dot(light.rgb, vec3(0.33333));
return mix(atmosTransportFrag(light.rgb, additive, atten), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness);
}
diff --git a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl
index 90ab5d2793..7f74122665 100644
--- a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl
+++ b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl
@@ -30,35 +30,21 @@
vec3 getAdditiveColor();
vec3 getAtmosAttenuation();
-uniform int no_atmo;
-
vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten)
{
- if (no_atmo == 1)
- {
- return light;
- }
- return (light + additive) * atten * 2.0;
+ return (light + additive) * atten * 2.0;
}
vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten)
{
- if (no_atmo == 1)
- {
- return light;
- }
- float brightness = dot(light.rgb, vec3(0.33333));
- return mix(atmosTransportFrag(light.rgb, additive,atten), light.rgb + additive.rgb, brightness * brightness);
+ float brightness = dot(light.rgb, vec3(0.33333));
+ return mix(atmosTransportFrag(light.rgb, additive,atten), light.rgb + additive.rgb, brightness * brightness);
}
vec3 fullbrightShinyAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten)
{
- if (no_atmo == 1)
- {
- return light;
- }
- float brightness = dot(light.rgb, vec3(0.33333));
- return mix(atmosTransportFrag(light.rgb, additive, atten), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness);
+ float brightness = dot(light.rgb, vec3(0.33333));
+ return mix(atmosTransportFrag(light.rgb, additive, atten), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness);
}
vec3 atmosTransport(vec3 light)
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index b896ecde30..5396a8fdd2 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -53,6 +53,19 @@ BOOL LLDrawPoolAlpha::sShowDebugAlpha = FALSE;
static BOOL deferred_render = FALSE;
+static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_SETUP("Alpha Setup");
+static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_GROUP_LOOP("Alpha Group");
+static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_PUSH("Alpha Push Verts");
+static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_DEFERRED("Alpha Deferred");
+static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_SETBUFFER("Alpha SetBuffer");
+static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_DRAW("Alpha Draw");
+static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_TEX_BINDS("Alpha Tex Binds");
+static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_MATS("Alpha Mat Tex Binds");
+static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_GLOW("Alpha Glow Binds");
+static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_SHADER_BINDS("Alpha Shader Binds");
+static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_DEFERRED_SHADER_BINDS("Alpha Def Binds");
+static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_MESH_REBUILD("Alpha Mesh Rebuild");
+
LLDrawPoolAlpha::LLDrawPoolAlpha(U32 type) :
LLRenderPass(type), current_shader(NULL), target_shader(NULL),
simple_shader(NULL), fullbright_shader(NULL), emissive_shader(NULL),
@@ -115,7 +128,6 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass)
fullbright_shader->bind();
fullbright_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
fullbright_shader->uniform1f(LLShaderMgr::DISPLAY_GAMMA, (gamma > 0.1f) ? 1.0f / gamma : (1.0f/2.2f));
- fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, LLPipeline::sRenderingHUDs ? 1 : 0);
fullbright_shader->setMinimumAlpha(LLPipeline::sImpostorRender ? 0.5f : 0.0f);
fullbright_shader->unbind();
@@ -185,25 +197,13 @@ void LLDrawPoolAlpha::renderPostDeferred(S32 pass)
void LLDrawPoolAlpha::beginRenderPass(S32 pass)
{
- LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA);
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_SETUP);
if (LLPipeline::sImpostorRender)
{
simple_shader = &gObjectSimpleImpostorProgram;
fullbright_shader = &gObjectFullbrightProgram;
emissive_shader = &gObjectEmissiveProgram;
-
- if (mShaderLevel > 0)
- {
- fullbright_shader->bind();
- fullbright_shader->setMinimumAlpha(0.5f);
- simple_shader->bind();
- simple_shader->setMinimumAlpha(0.5f);
- }
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); //OK
- }
}
else if (LLPipeline::sUnderWaterRender)
{
@@ -218,26 +218,18 @@ void LLDrawPoolAlpha::beginRenderPass(S32 pass)
emissive_shader = &gObjectEmissiveProgram;
}
- if (!LLPipeline::sImpostorRender)
+ if (mShaderLevel > 0)
{
- if (mShaderLevel > 0)
- {
- fullbright_shader->bind();
- fullbright_shader->setMinimumAlpha(0.f);
- simple_shader->bind();
- simple_shader->setMinimumAlpha(0.f);
- }
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); //OK
- }
- }
+ // Start out with no shaders.
+ current_shader = target_shader = NULL;
+ LLGLSLShader::bindNoShader();
+ }
gPipeline.enableLightsDynamic();
}
void LLDrawPoolAlpha::endRenderPass( S32 pass )
{
- LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA);
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_SETUP);
LLRenderPass::endRenderPass(pass);
if(gPipeline.canUseWindLightShaders())
@@ -281,7 +273,34 @@ void LLDrawPoolAlpha::render(S32 pass)
mAlphaDFactor = LLRender::BF_ONE_MINUS_SOURCE_ALPHA; // }
gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
-
+ if (mShaderLevel > 0)
+ {
+ if (LLPipeline::sImpostorRender)
+ {
+ fullbright_shader->bind();
+ fullbright_shader->setMinimumAlpha(0.5f);
+ simple_shader->bind();
+ simple_shader->setMinimumAlpha(0.5f);
+ }
+ else
+ {
+ fullbright_shader->bind();
+ fullbright_shader->setMinimumAlpha(0.f);
+ simple_shader->bind();
+ simple_shader->setMinimumAlpha(0.f);
+ }
+ }
+ else
+ {
+ if (LLPipeline::sImpostorRender)
+ {
+ gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); //OK
+ }
+ else
+ {
+ gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); //OK
+ }
+ }
}
if (mShaderLevel > 0)
@@ -368,268 +387,328 @@ void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask)
}
}
-static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_GROUP_LOOP("Alpha Group");
-static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_PUSH("Alpha Push Verts");
-
void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
{
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA);
+
BOOL initialized_lighting = FALSE;
BOOL light_enabled = TRUE;
BOOL use_shaders = gPipeline.canUseVertexShaders();
-
- for (LLCullResult::sg_iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i)
- {
- LLSpatialGroup* group = *i;
- llassert(group);
- llassert(group->getSpatialPartition());
-
- if (group->getSpatialPartition()->mRenderByGroup &&
- !group->isDead())
- {
- bool is_particle_or_hud_particle = group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_PARTICLE
- || group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_HUD_PARTICLE;
-
- bool draw_glow_for_this_partition = mShaderLevel > 0; // no shaders = no glow.
-
-
- LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_GROUP_LOOP);
-
- bool disable_cull = is_particle_or_hud_particle;
- LLGLDisable cull(disable_cull ? GL_CULL_FACE : 0);
-
- LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[LLRenderPass::PASS_ALPHA];
-
- for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
- {
- LLDrawInfo& params = **k;
-
- if ((params.mVertexBuffer->getTypeMask() & mask) != mask)
- { //FIXME!
- LL_WARNS_ONCE() << "Missing required components, expected mask: " << mask
- << " present: " << (params.mVertexBuffer->getTypeMask() & mask)
- << ". Skipping render batch." << LL_ENDL;
- continue;
- }
-
- // Fix for bug - NORSPEC-271
- // If the face is more than 90% transparent, then don't update the Depth buffer for Dof
- // We don't want the nearly invisible objects to cause of DoF effects
- if(pass == 1 && !LLPipeline::sImpostorRender)
- {
- LLFace* face = params.mFace;
- if(face)
- {
- const LLTextureEntry* tep = face->getTextureEntry();
- if(tep)
- {
- if(tep->getColor().mV[3] < 0.1f)
- continue;
- }
- }
- }
- LLRenderPass::applyModelMatrix(params);
-
- LLMaterial* mat = NULL;
+ {
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_GROUP_LOOP);
- if (deferred_render)
- {
- mat = params.mMaterial;
- }
+ for (LLCullResult::sg_iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i)
+ {
+ LLSpatialGroup* group = *i;
+ llassert(group);
+ llassert(group->getSpatialPartition());
+
+ if (group->getSpatialPartition()->mRenderByGroup &&
+ !group->isDead())
+ {
+ bool is_particle_or_hud_particle = group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_PARTICLE
+ || group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_HUD_PARTICLE;
+
+ bool disable_cull = is_particle_or_hud_particle;
+ LLGLDisable cull(disable_cull ? GL_CULL_FACE : 0);
+
+ LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[LLRenderPass::PASS_ALPHA];
+
+ for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
+ {
+ LLDrawInfo& params = **k;
+
+ if ((params.mVertexBuffer->getTypeMask() & mask) != mask)
+ { //FIXME!
+ LL_WARNS_ONCE() << "Missing required components, expected mask: " << mask
+ << " present: " << (params.mVertexBuffer->getTypeMask() & mask)
+ << ". Skipping render batch." << LL_ENDL;
+ continue;
+ }
+
+ // Fix for bug - NORSPEC-271
+ // If the face is more than 90% transparent, then don't update the Depth buffer for Dof
+ // We don't want the nearly invisible objects to cause of DoF effects
+ if(pass == 1 && !LLPipeline::sImpostorRender)
+ {
+ LLFace* face = params.mFace;
+ if(face)
+ {
+ const LLTextureEntry* tep = face->getTextureEntry();
+ if(tep)
+ {
+ if(tep->getColor().mV[3] < 0.1f)
+ continue;
+ }
+ }
+ }
+
+ LLRenderPass::applyModelMatrix(params);
+
+ LLMaterial* mat = NULL;
+
+ if (deferred_render)
+ {
+ mat = params.mMaterial;
+ }
- if (params.mFullbright)
- {
- // Turn off lighting if it hasn't already been so.
- if (light_enabled || !initialized_lighting)
- {
- initialized_lighting = TRUE;
- if (use_shaders)
- {
- target_shader = fullbright_shader;
- }
- else
- {
- gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
- }
- light_enabled = FALSE;
- }
- }
- // Turn on lighting if it isn't already.
- else if (!light_enabled || !initialized_lighting)
- {
- initialized_lighting = TRUE;
- if (use_shaders)
- {
- target_shader = simple_shader;
- }
- else
- {
- gPipeline.enableLightsDynamic();
- }
- light_enabled = TRUE;
- }
-
- if (deferred_render && mat)
- {
- U32 mask = params.mShaderMask;
-
- llassert(mask < LLMaterial::SHADER_COUNT);
- target_shader = &(gDeferredMaterialProgram[mask]);
-
- if (LLPipeline::sUnderWaterRender)
- {
- target_shader = &(gDeferredMaterialWaterProgram[mask]);
- }
-
- if (current_shader != target_shader)
- {
- gPipeline.bindDeferredShader(*target_shader);
- }
- }
- else if (!params.mFullbright)
- {
- target_shader = simple_shader;
- }
- else
- {
- target_shader = fullbright_shader;
- }
+ if (params.mFullbright)
+ {
+ // Turn off lighting if it hasn't already been so.
+ if (light_enabled || !initialized_lighting)
+ {
+ initialized_lighting = TRUE;
+ if (use_shaders)
+ {
+ target_shader = fullbright_shader;
+ }
+ else
+ {
+ gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
+ }
+ light_enabled = FALSE;
+ }
+ }
+ // Turn on lighting if it isn't already.
+ else if (!light_enabled || !initialized_lighting)
+ {
+ initialized_lighting = TRUE;
+ if (use_shaders)
+ {
+ target_shader = simple_shader;
+ }
+ else
+ {
+ gPipeline.enableLightsDynamic();
+ }
+ light_enabled = TRUE;
+ }
+
+ if (deferred_render && mat)
+ {
+ U32 mask = params.mShaderMask;
+
+ llassert(mask < LLMaterial::SHADER_COUNT);
+ target_shader = &(gDeferredMaterialProgram[mask]);
+
+ if (LLPipeline::sUnderWaterRender)
+ {
+ target_shader = &(gDeferredMaterialWaterProgram[mask]);
+ }
+
+ if (current_shader != target_shader)
+ {
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_DEFERRED_SHADER_BINDS);
+ gPipeline.bindDeferredShader(*target_shader);
+ current_shader = target_shader;
+ }
+ }
+ else if (!params.mFullbright)
+ {
+ target_shader = simple_shader;
+ }
+ else
+ {
+ target_shader = fullbright_shader;
+ }
- if(use_shaders && (current_shader != target_shader))
- {// If we need shaders, and we're not ALREADY using the proper shader, then bind it
- // (this way we won't rebind shaders unnecessarily).
- current_shader = target_shader;
- current_shader->bind();
- }
- else if (!use_shaders && current_shader != NULL)
- {
- LLGLSLShader::bindNoShader();
- current_shader = NULL;
- }
-
- if (use_shaders && mat)
- {
- // We have a material. Supply the appropriate data here.
- if (LLPipeline::sRenderDeferred)
- {
- current_shader->uniform4f(LLShaderMgr::SPECULAR_COLOR, params.mSpecColor.mV[0], params.mSpecColor.mV[1], params.mSpecColor.mV[2], params.mSpecColor.mV[3]);
- current_shader->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, params.mEnvIntensity);
- current_shader->uniform1f(LLShaderMgr::EMISSIVE_BRIGHTNESS, params.mFullbright ? 1.f : 0.f);
-
- if (params.mNormalMap)
- {
- params.mNormalMap->addTextureStats(params.mVSize);
- current_shader->bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap);
- }
+ if(use_shaders && (current_shader != target_shader))
+ {// If we need shaders, and we're not ALREADY using the proper shader, then bind it
+ // (this way we won't rebind shaders unnecessarily).
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_SHADER_BINDS);
+
+ current_shader = target_shader;
+ current_shader->bind();
+ }
+ else if (!use_shaders && current_shader != NULL)
+ {
+ LLGLSLShader::bindNoShader();
+ current_shader = NULL;
+ }
+
+ if (use_shaders && mat)
+ {
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MATS);
+
+ // We have a material. Supply the appropriate data here.
+ if (LLPipeline::sRenderDeferred)
+ {
+ current_shader->uniform4f(LLShaderMgr::SPECULAR_COLOR, params.mSpecColor.mV[0], params.mSpecColor.mV[1], params.mSpecColor.mV[2], params.mSpecColor.mV[3]);
+ current_shader->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, params.mEnvIntensity);
+ current_shader->uniform1f(LLShaderMgr::EMISSIVE_BRIGHTNESS, params.mFullbright ? 1.f : 0.f);
+
+ if (params.mNormalMap)
+ {
+ params.mNormalMap->addTextureStats(params.mVSize);
+ current_shader->bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap);
+ }
- if (params.mSpecularMap)
- {
- params.mSpecularMap->addTextureStats(params.mVSize);
- current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, params.mSpecularMap);
- }
- }
-
- } else if (LLPipeline::sRenderDeferred && current_shader && (current_shader == simple_shader))
- {
- current_shader->uniform4f(LLShaderMgr::SPECULAR_COLOR, 1.0f, 1.0f, 1.0f, 1.0f);
- current_shader->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, 0.0f);
- LLViewerFetchedTexture::sFlatNormalImagep->addTextureStats(params.mVSize);
- current_shader->bindTexture(LLShaderMgr::BUMP_MAP, LLViewerFetchedTexture::sFlatNormalImagep);
- LLViewerFetchedTexture::sWhiteImagep->addTextureStats(params.mVSize);
- current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep);
- }
-
- if (params.mGroup)
- {
- params.mGroup->rebuildMesh();
- }
+ if (params.mSpecularMap)
+ {
+ params.mSpecularMap->addTextureStats(params.mVSize);
+ current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, params.mSpecularMap);
+ }
+ }
+
+ }
+ else if (LLPipeline::sRenderDeferred && current_shader && (current_shader == simple_shader))
+ {
+ current_shader->uniform4f(LLShaderMgr::SPECULAR_COLOR, 1.0f, 1.0f, 1.0f, 1.0f);
+ current_shader->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, 0.0f);
+ LLViewerFetchedTexture::sFlatNormalImagep->addTextureStats(params.mVSize);
+ current_shader->bindTexture(LLShaderMgr::BUMP_MAP, LLViewerFetchedTexture::sFlatNormalImagep);
+ LLViewerFetchedTexture::sWhiteImagep->addTextureStats(params.mVSize);
+ current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep);
+ }
+
+ if (params.mGroup)
+ {
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MESH_REBUILD);
+
+ params.mGroup->rebuildMesh();
+ }
+
+ bool tex_setup = false;
+
+ if (use_shaders && params.mTextureList.size() > 1)
+ {
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_TEX_BINDS);
+ for (U32 i = 0; i < params.mTextureList.size(); ++i)
+ {
+ if (params.mTextureList[i].notNull())
+ {
+ gGL.getTexUnit(i)->bind(params.mTextureList[i], TRUE);
+ }
+ }
+ }
+ else
+ { //not batching textures or batch has only 1 texture -- might need a texture matrix
+ if (params.mTexture.notNull())
+ {
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_TEX_BINDS);
+
+ params.mTexture->addTextureStats(params.mVSize);
+ if (use_shaders && mat)
+ {
+ current_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, params.mTexture);
+ }
+ else
+ {
+ gGL.getTexUnit(0)->bind(params.mTexture, TRUE) ;
+ }
+
+ if (params.mTextureMatrix)
+ {
+ tex_setup = true;
+ gGL.getTexUnit(0)->activate();
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
+ gPipeline.mTextureMatrixOps++;
+ }
+ }
+ else
+ {
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ }
+ }
+
+ {
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_PUSH);
+
+ LLGLEnableFunc stencil_test(GL_STENCIL_TEST, params.mSelected, &LLGLCommonFunc::selected_stencil_test);
+
+ {
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_SETBUFFER);
+ gGL.blendFunc((LLRender::eBlendFactor) params.mBlendFuncSrc, (LLRender::eBlendFactor) params.mBlendFuncDst, mAlphaSFactor, mAlphaDFactor);
+ params.mVertexBuffer->setBuffer(mask & ~(params.mFullbright ? (LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2) : 0));
+ }
+
+ {
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_DRAW);
+ params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset);
+ }
+
+ gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
+ }
+
+ if (tex_setup)
+ {
+ gGL.getTexUnit(0)->activate();
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ }
+ }
+ }
+ }
+
+ bool draw_glow_for_this_partition = mShaderLevel > 0; // no shaders = no glow.
+
+ if (use_shaders && draw_glow_for_this_partition)
+ {
+ // install glow-accumulating blend mode
+ gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE, // don't touch color
+ LLRender::BF_ONE, LLRender::BF_ONE); // add to alpha (glow)
- bool tex_setup = false;
+ emissive_shader->bind();
- if (use_shaders && params.mTextureList.size() > 1)
- {
- for (U32 i = 0; i < params.mTextureList.size(); ++i)
- {
- if (params.mTextureList[i].notNull())
- {
- gGL.getTexUnit(i)->bind(params.mTextureList[i], TRUE);
- }
- }
- }
- else
- { //not batching textures or batch has only 1 texture -- might need a texture matrix
- if (params.mTexture.notNull())
- {
- params.mTexture->addTextureStats(params.mVSize);
- if (use_shaders && mat)
- {
- current_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, params.mTexture);
- }
- else
- {
- gGL.getTexUnit(0)->bind(params.mTexture, TRUE) ;
- }
-
- if (params.mTextureMatrix)
- {
- tex_setup = true;
- gGL.getTexUnit(0)->activate();
- gGL.matrixMode(LLRender::MM_TEXTURE);
- gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
- gPipeline.mTextureMatrixOps++;
- }
- }
- else
- {
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- }
- }
+ for (LLCullResult::sg_iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i)
+ {
+ LLSpatialGroup* group = *i;
+ llassert(group);
+ llassert(group->getSpatialPartition());
- {
- LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_PUSH);
+ if (group->getSpatialPartition()->mRenderByGroup &&
+ !group->isDead())
+ {
+ bool is_particle_or_hud_particle = group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_PARTICLE
+ || group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_HUD_PARTICLE;
- LLGLEnableFunc stencil_test(GL_STENCIL_TEST, params.mSelected, &LLGLCommonFunc::selected_stencil_test);
+
- gGL.blendFunc((LLRender::eBlendFactor) params.mBlendFuncSrc, (LLRender::eBlendFactor) params.mBlendFuncDst, mAlphaSFactor, mAlphaDFactor);
- params.mVertexBuffer->setBuffer(mask & ~(params.mFullbright ? (LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2) : 0));
+ bool disable_cull = is_particle_or_hud_particle;
+ LLGLDisable cull(disable_cull ? GL_CULL_FACE : 0);
- params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset);
- gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
- }
-
- // If this alpha mesh has glow, then draw it a second time to add the destination-alpha (=glow). Interleaving these state-changing calls could be expensive, but glow must be drawn Z-sorted with alpha.
- if (current_shader &&
- draw_glow_for_this_partition &&
- params.mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE))
- {
- // install glow-accumulating blend mode
- gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE, // don't touch color
- LLRender::BF_ONE, LLRender::BF_ONE); // add to alpha (glow)
+ LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[LLRenderPass::PASS_ALPHA];
- emissive_shader->bind();
-
- params.mVertexBuffer->setBuffer((mask & ~LLVertexBuffer::MAP_COLOR) | LLVertexBuffer::MAP_EMISSIVE);
-
- // do the actual drawing, again
- params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset);
- gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
+ for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
+ {
+ LLDrawInfo& params = **k;
- // restore our alpha blend mode
- gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
+ if ((params.mVertexBuffer->getTypeMask() & mask) != mask)
+ { //FIXME!
+ LL_WARNS_ONCE() << "Missing required components, expected mask: " << mask
+ << " present: " << (params.mVertexBuffer->getTypeMask() & mask)
+ << ". Skipping render batch." << LL_ENDL;
+ continue;
+ }
- current_shader->bind();
- }
-
- if (tex_setup)
- {
- gGL.getTexUnit(0)->activate();
- gGL.loadIdentity();
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- }
- }
- }
- }
+ LLRenderPass::applyModelMatrix(params);
+
+ // If this alpha mesh has glow, then draw it a second time to add the destination-alpha (=glow). Interleaving these state-changing calls could be expensive, but glow must be drawn Z-sorted with alpha.
+ if (emissive_shader &&
+ draw_glow_for_this_partition &&
+ params.mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE))
+ {
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_GLOW);
+
+ params.mVertexBuffer->setBuffer((mask & ~LLVertexBuffer::MAP_COLOR) | LLVertexBuffer::MAP_EMISSIVE);
+
+ // do the actual drawing, again
+ params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset);
+ gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
+ }
+ }
+ }
+ }
+
+ // restore our alpha blend mode
+ gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
+
+ emissive_shader->unbind();
+ }
+ }
gGL.setSceneBlendType(LLRender::BT_ALPHA);
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index e96e7cbe6c..3a083fd50d 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -696,14 +696,6 @@ void LLDrawPoolAvatar::beginRigid()
{ //eyeballs render with the specular shader
sVertexProgram->bind();
sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha);
- if (LLPipeline::sRenderingHUDs)
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
}
}
else
@@ -754,14 +746,6 @@ void LLDrawPoolAvatar::beginDeferredRigid()
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
sVertexProgram->bind();
sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha);
- if (LLPipeline::sRenderingHUDs)
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
}
void LLDrawPoolAvatar::endDeferredRigid()
@@ -805,14 +789,6 @@ void LLDrawPoolAvatar::beginSkinned()
sVertexProgram->bind();
sVertexProgram->enableTexture(LLViewerShaderMgr::BUMP_MAP);
- if (LLPipeline::sRenderingHUDs)
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
gGL.getTexUnit(0)->activate();
}
else
@@ -822,14 +798,6 @@ void LLDrawPoolAvatar::beginSkinned()
// software skinning, use a basic shader for windlight.
// TODO: find a better fallback method for software skinning.
sVertexProgram->bind();
- if (LLPipeline::sRenderingHUDs)
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
}
}
@@ -892,14 +860,6 @@ void LLDrawPoolAvatar::beginRiggedSimple()
{
sDiffuseChannel = 0;
sVertexProgram->bind();
- if (LLPipeline::sRenderingHUDs)
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
}
}
@@ -966,15 +926,6 @@ void LLDrawPoolAvatar::beginRiggedGlow()
sVertexProgram->uniform1f(LLShaderMgr::TEXTURE_GAMMA, LLPipeline::sRenderDeferred ? 2.2f : 1.1f);
- if (LLPipeline::sRenderingHUDs)
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
-
F32 gamma = gSavedSettings.getF32("RenderDeferredDisplayGamma");
sVertexProgram->uniform1f(LLShaderMgr::DISPLAY_GAMMA, (gamma > 0.1f) ? 1.0f / gamma : (1.0f/2.2f));
}
@@ -1025,12 +976,10 @@ void LLDrawPoolAvatar::beginRiggedFullbright()
if (LLPipeline::sRenderingHUDs)
{
sVertexProgram->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f);
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1);
}
else if (LLPipeline::sRenderDeferred)
{
sVertexProgram->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0);
F32 gamma = gSavedSettings.getF32("RenderDeferredDisplayGamma");
sVertexProgram->uniform1f(LLShaderMgr::DISPLAY_GAMMA, (gamma > 0.1f) ? 1.0f / gamma : (1.0f/2.2f));
}
@@ -1080,14 +1029,6 @@ void LLDrawPoolAvatar::beginRiggedShinySimple()
if (sShaderLevel > 0 || gPipeline.canUseVertexShaders())
{
sVertexProgram->bind();
- if (LLPipeline::sRenderingHUDs)
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
}
}
@@ -1138,32 +1079,22 @@ void LLDrawPoolAvatar::beginRiggedFullbrightShiny()
if (sShaderLevel > 0 || gPipeline.canUseVertexShaders())
{
sVertexProgram->bind();
- if (LLPipeline::sRenderingHUDs)
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
+
LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
if (LLPipeline::sRenderingHUDs)
{
sVertexProgram->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f);
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1);
}
else if (LLPipeline::sRenderDeferred)
{
sVertexProgram->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
F32 gamma = gSavedSettings.getF32("RenderDeferredDisplayGamma");
sVertexProgram->uniform1f(LLShaderMgr::DISPLAY_GAMMA, (gamma > 0.1f) ? 1.0f / gamma : (1.0f/2.2f));
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0);
}
else
{
sVertexProgram->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f);
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0);
}
}
}
@@ -1184,15 +1115,7 @@ void LLDrawPoolAvatar::beginDeferredRiggedSimple()
{
sVertexProgram = &gDeferredSkinnedDiffuseProgram;
sDiffuseChannel = 0;
- sVertexProgram->bind();
- if (LLPipeline::sRenderingHUDs)
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
+ sVertexProgram->bind();
}
void LLDrawPoolAvatar::endDeferredRiggedSimple()
@@ -1206,14 +1129,6 @@ void LLDrawPoolAvatar::beginDeferredRiggedBump()
{
sVertexProgram = &gDeferredSkinnedBumpProgram;
sVertexProgram->bind();
- if (LLPipeline::sRenderingHUDs)
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
normal_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::BUMP_MAP);
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
}
@@ -1246,14 +1161,6 @@ void LLDrawPoolAvatar::beginDeferredRiggedMaterial(S32 pass)
}
sVertexProgram->bind();
- if (LLPipeline::sRenderingHUDs)
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
normal_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::BUMP_MAP);
specular_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::SPECULAR_MAP);
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
@@ -1287,14 +1194,6 @@ void LLDrawPoolAvatar::beginDeferredSkinned()
sVertexProgram->bind();
sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha);
- if (LLPipeline::sRenderingHUDs)
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
gGL.getTexUnit(0)->activate();
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 14069fa6c2..3f36fd04ae 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -351,14 +351,6 @@ void LLDrawPoolBump::beginShiny(bool invisible)
shader = &gObjectShinyProgram;
}
shader->bind();
- if (LLPipeline::sRenderingHUDs)
- {
- shader->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- shader->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
}
else
{
@@ -542,14 +534,6 @@ void LLDrawPoolBump::beginFullbrightShiny()
LLVector4(gGLModelView+8),
LLVector4(gGLModelView+12));
shader->bind();
- if (LLPipeline::sRenderingHUDs)
- {
- shader->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- shader->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
LLVector3 vec = LLVector3(gShinyOrigin) * mat;
LLVector4 vec4(vec, gShinyOrigin.mV[3]);
diff --git a/indra/newview/lldrawpoolmaterials.cpp b/indra/newview/lldrawpoolmaterials.cpp
index 05b0c1f1a9..a9e948c16a 100644
--- a/indra/newview/lldrawpoolmaterials.cpp
+++ b/indra/newview/lldrawpoolmaterials.cpp
@@ -81,15 +81,6 @@ void LLDrawPoolMaterials::beginDeferredPass(S32 pass)
mShader->bind();
- if (LLPipeline::sRenderingHUDs)
- {
- mShader->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- mShader->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
-
diffuse_channel = mShader->enableTexture(LLShaderMgr::DIFFUSE_MAP);
LL_RECORD_BLOCK_TIME(FTM_RENDER_MATERIALS);
diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp
index f653920662..606e44185f 100644
--- a/indra/newview/lldrawpoolsimple.cpp
+++ b/indra/newview/lldrawpoolsimple.cpp
@@ -47,14 +47,6 @@ void LLDrawPoolGlow::beginPostDeferredPass(S32 pass)
{
gDeferredEmissiveProgram.bind();
gDeferredEmissiveProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
- if (LLPipeline::sRenderingHUDs)
- {
- gDeferredEmissiveProgram.uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- gDeferredEmissiveProgram.uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
}
static LLTrace::BlockTimerStatHandle FTM_RENDER_GLOW_PUSH("Glow Push");
@@ -127,15 +119,6 @@ void LLDrawPoolGlow::render(S32 pass)
shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.f);
}
- if (LLPipeline::sRenderingHUDs)
- {
- shader->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- shader->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
-
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
gGL.setColorMask(false, true);
@@ -187,15 +170,6 @@ void LLDrawPoolSimple::beginRenderPass(S32 pass)
if (mShaderLevel > 0)
{
simple_shader->bind();
-
- if (LLPipeline::sRenderingHUDs)
- {
- simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
}
else
{
@@ -289,15 +263,6 @@ void LLDrawPoolAlphaMask::beginRenderPass(S32 pass)
if (mShaderLevel > 0)
{
simple_shader->bind();
-
- if (LLPipeline::sRenderingHUDs)
- {
- simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
}
else
{
@@ -331,15 +296,6 @@ void LLDrawPoolAlphaMask::render(S32 pass)
simple_shader->bind();
simple_shader->setMinimumAlpha(0.33f);
- if (LLPipeline::sRenderingHUDs)
- {
- simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
-
pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
pushMaskBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
pushMaskBatches(LLRenderPass::PASS_SPECMAP_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
@@ -380,15 +336,6 @@ void LLDrawPoolFullbrightAlphaMask::beginRenderPass(S32 pass)
if (mShaderLevel > 0)
{
simple_shader->bind();
-
- if (LLPipeline::sRenderingHUDs)
- {
- simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
}
else
{
@@ -425,12 +372,10 @@ void LLDrawPoolFullbrightAlphaMask::render(S32 pass)
if (LLPipeline::sRenderingHUDs)
{
- simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1);
simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f);
}
else
{
- simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0);
if (LLPipeline::sRenderDeferred)
{
simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
@@ -462,15 +407,6 @@ void LLDrawPoolSimple::beginDeferredPass(S32 pass)
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_SIMPLE_DEFERRED);
gDeferredDiffuseProgram.bind();
-
- if (LLPipeline::sRenderingHUDs)
- {
- gDeferredDiffuseProgram.uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- gDeferredDiffuseProgram.uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
}
void LLDrawPoolSimple::endDeferredPass(S32 pass)
@@ -509,16 +445,6 @@ void LLDrawPoolAlphaMask::renderDeferred(S32 pass)
LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MASK_DEFERRED);
gDeferredDiffuseAlphaMaskProgram.bind();
gDeferredDiffuseAlphaMaskProgram.setMinimumAlpha(0.33f);
-
- if (LLPipeline::sRenderingHUDs)
- {
- gDeferredDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- gDeferredDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
-
pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
gDeferredDiffuseAlphaMaskProgram.unbind();
}
@@ -555,14 +481,6 @@ void LLDrawPoolGrass::beginRenderPass(S32 pass)
{
simple_shader->bind();
simple_shader->setMinimumAlpha(0.5f);
- if (LLPipeline::sRenderingHUDs)
- {
- simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
}
else
{
@@ -619,16 +537,7 @@ void LLDrawPoolGrass::renderDeferred(S32 pass)
LL_RECORD_BLOCK_TIME(FTM_RENDER_GRASS_DEFERRED);
gDeferredNonIndexedDiffuseAlphaMaskProgram.bind();
gDeferredNonIndexedDiffuseAlphaMaskProgram.setMinimumAlpha(0.5f);
-
- if (LLPipeline::sRenderingHUDs)
- {
- gDeferredNonIndexedDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- gDeferredNonIndexedDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
-
+ gDeferredNonIndexedDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0);
//render grass
LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask());
}
@@ -655,15 +564,6 @@ void LLDrawPoolFullbright::beginPostDeferredPass(S32 pass)
else
{
gDeferredFullbrightProgram.bind();
-
- if (LLPipeline::sRenderingHUDs)
- {
- gDeferredFullbrightProgram.uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- gDeferredFullbrightProgram.uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
}
}
@@ -732,15 +632,6 @@ void LLDrawPoolFullbright::render(S32 pass)
fullbright_shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 1.f);
fullbright_shader->uniform1f(LLViewerShaderMgr::TEXTURE_GAMMA, 1.f);
- if (LLPipeline::sRenderingHUDs)
- {
- fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 1);
- }
- else
- {
- fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 0);
- }
-
U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX;
pushBatches(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask, TRUE, TRUE);
pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, fullbright_mask, TRUE, TRUE);
@@ -775,7 +666,6 @@ void LLDrawPoolFullbrightAlphaMask::beginPostDeferredPass(S32 pass)
{
gObjectFullbrightAlphaMaskProgram.bind();
gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f);
- gObjectFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1);
}
else if (LLPipeline::sRenderDeferred)
{
@@ -783,20 +673,17 @@ void LLDrawPoolFullbrightAlphaMask::beginPostDeferredPass(S32 pass)
{
gDeferredFullbrightAlphaMaskWaterProgram.bind();
gDeferredFullbrightAlphaMaskWaterProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
- gDeferredFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1);
}
else
{
gDeferredFullbrightAlphaMaskProgram.bind();
gDeferredFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
- gDeferredFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0);
}
}
else
{
gObjectFullbrightAlphaMaskProgram.bind();
gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f);
- gObjectFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0);
}
}
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index 5760a28049..abda2d45fb 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -634,7 +634,7 @@ void LLDrawPoolWater::shade2(bool edge, LLGLSLShader* shader, const LLColor3& li
bool edge_patch = water->getIsEdgePatch();
if (edge_patch)
{
- sNeedsReflectionUpdate = TRUE;
+ //sNeedsReflectionUpdate = TRUE;
face->renderIndexed();
}
}
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index c66e46872d..319ae3b9a7 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -478,7 +478,6 @@ void LLViewerShaderMgr::setShaders()
S32 shadow_detail = gSavedSettings.getS32("RenderShadowDetail");
bool useRenderDeferred = canRenderDeferred && gSavedSettings.getBOOL("RenderDeferred") && gSavedSettings.getBOOL("RenderAvatarVP");
bool doingWindLight = hasWindLightShaders && gSavedSettings.getBOOL("WindLightUseAtmosShaders");
-
//using shaders, disable fixed function
LLGLSLShader::sNoFixedFunction = true;
@@ -487,9 +486,9 @@ void LLViewerShaderMgr::setShaders()
S32 env_class = 2;
S32 obj_class = 2;
S32 effect_class = 2;
- S32 wl_class = 2;
+ S32 wl_class = 1;
S32 water_class = 2;
- S32 deferred_class = 2;
+ S32 deferred_class = 0;
S32 transform_class = gGLManager.mHasTransformFeedback ? 1 : 0;
static LLCachedControl<bool> use_transform_feedback(gSavedSettings, "RenderUseTransformFeedback", false);
@@ -498,24 +497,31 @@ void LLViewerShaderMgr::setShaders()
transform_class = 0;
}
- if (useRenderDeferred && doingWindLight)
+ if (useRenderDeferred)
{
//shadows
switch (shadow_detail)
- {
- case 0: deferred_class = 1; break; // no shadows
- case 1: deferred_class = 2; break; // PCF shadows
- case 2: deferred_class = 2; break; // PCF shadows
+ {
+ case 1:
+ deferred_class = 2; // PCF shadows
+ break;
+
+ case 2:
+ deferred_class = 2; // PCF shadows
+ break;
+
+ case 0:
default:
- break;
+ deferred_class = 1; // no shadows
+ break;
}
}
- if (!doingWindLight)
+ if (doingWindLight)
{
// user has disabled WindLight in their settings, downgrade
// windlight shaders to stub versions.
- wl_class = 1;
+ wl_class = 2;
}
// Trigger a full rebuild of the fallback skybox / cubemap if we've toggled windlight shaders
@@ -524,7 +530,6 @@ void LLViewerShaderMgr::setShaders()
gSky.mVOSkyp->forceSkyUpdate();
}
-
// Load lighting shaders
mShaderLevel[SHADER_LIGHTING] = light_class;
mShaderLevel[SHADER_INTERFACE] = light_class;
@@ -986,10 +991,9 @@ BOOL LLViewerShaderMgr::loadBasicShaders()
index_channels.push_back(-1); shaders.push_back( make_pair( "environment/waterFogF.glsl", mShaderLevel[SHADER_WATER] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "environment/encodeNormF.glsl", mShaderLevel[SHADER_ENVIRONMENT] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "environment/srgbF.glsl", mShaderLevel[SHADER_ENVIRONMENT] ) );
- index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/deferredUtil.glsl", mShaderLevel[SHADER_DEFERRED] ) );
- index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/shadowUtil.glsl", mShaderLevel[SHADER_DEFERRED] ) );
- index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/aoUtil.glsl", mShaderLevel[SHADER_DEFERRED] ) );
- index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/indirect.glsl", mShaderLevel[SHADER_DEFERRED] ) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/deferredUtil.glsl", 1) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/shadowUtil.glsl", 1) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/aoUtil.glsl", 1) );
index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightAlphaMaskNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightNonIndexedF.glsl", mShaderLevel[SHADER_LIGHTING] ) );
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 333fae558a..73e78aadd0 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -235,7 +235,6 @@ LLTrace::BlockTimerStatHandle FTM_RENDER_UI("UI");
LLTrace::BlockTimerStatHandle FTM_RENDER_WATER("Water");
LLTrace::BlockTimerStatHandle FTM_RENDER_WL_SKY("Windlight Sky");
LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA("Alpha Objects");
-LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_DEFERRED("Alpha Deferred Objects");
LLTrace::BlockTimerStatHandle FTM_RENDER_CHARACTERS("Avatars");
LLTrace::BlockTimerStatHandle FTM_RENDER_BUMP("Bump");
LLTrace::BlockTimerStatHandle FTM_RENDER_MATERIALS("Render Materials");
@@ -893,14 +892,18 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
//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 (!mWaterDeferredScreen.allocate(water_buffer_res, water_buffer_res, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
- if (!mWaterDeferredDepth.allocate(water_buffer_res, water_buffer_res, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
- if (!mWaterOcclusionDepth.allocate(water_buffer_res >> 1, water_buffer_res >> 1, 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;
- if (!addDeferredAttachments(mWaterDeferredScreen)) return false;
+
+ bool materials_in_water = gSavedSettings.getS32("RenderWaterMaterials");
+
+ if(materials_in_water)
+ {
+ if (!mWaterDeferredScreen.allocate(water_buffer_res, water_buffer_res, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
+ if (!mWaterDeferredDepth.allocate(water_buffer_res, water_buffer_res, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
+ if (!mWaterOcclusionDepth.allocate(water_buffer_res >> 1, water_buffer_res >> 1, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
+ if (!addDeferredAttachments(mWaterDeferredScreen)) return false;
+ }
GLuint screenFormat = GL_RGBA16;
if (gGLManager.mIsATI)
@@ -9434,10 +9437,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
LLVector3 reflect_origin = camera_in.getOrigin() - reflection_offset;
LLVector3 reflect_interest_point = reflect_origin + (reflection_look_at * 5.0f);
- U32 reflected_objects_size = 0;
- U32 sky_and_clouds_size = 0;
- U32 refracted_objects_size = 0;
-
camera.setOriginAndLookAt(reflect_origin, LLVector3::z_axis, reflect_interest_point);
//plane params
@@ -9514,13 +9513,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
gGL.setColorMask(true, true);
glClearColor(0,0,0,0);
- static LLCullResult sky_and_clouds;
- updateCull(camera, sky_and_clouds);
- stateSort(camera, sky_and_clouds);
-
- sky_and_clouds_size = sky_and_clouds.getVisibleListSize();
-
- gPipeline.grabReferences(sky_and_clouds);
+ updateCull(camera, mSky);
+ stateSort(camera, mSky);
+ gPipeline.grabReferences(mSky);
if (materials_in_water)
{
@@ -9572,16 +9567,12 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
{
if (detail > 0)
{
- static LLCullResult reflected_objects;
LLGLDisable cull(GL_CULL_FACE);
-
LLGLUserClipPlane clip_plane(plane, mat, projection);
- updateCull(camera, reflected_objects);
- stateSort(camera, reflected_objects);
-
- reflected_objects_size = reflected_objects.getVisibleListSize();
- gPipeline.grabReferences(reflected_objects);
+ updateCull(camera, mReflectedObjects);
+ stateSort(camera, mReflectedObjects);
+ gPipeline.grabReferences(mReflectedObjects);
if (materials_in_water)
{
@@ -9670,14 +9661,12 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
clip_plane.disable();
}
- if (materials_in_water)
- {
- static LLCullResult refracted_objects;
- updateCull(camera, refracted_objects, water_clip, &plane);
- stateSort(camera, refracted_objects);
- refracted_objects_size = refracted_objects.getVisibleListSize();
- gPipeline.grabReferences(refracted_objects);
+ updateCull(camera, mRefractedObjects, water_clip, &plane);
+ stateSort(camera, mRefractedObjects);
+ gPipeline.grabReferences(mRefractedObjects);
+ if (materials_in_water)
+ {
mWaterDis.flush();
gGL.setColorMask(true, true);
glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f);
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 8a6ae1bc4f..c94a69eaf0 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -75,7 +75,6 @@ extern LLTrace::BlockTimerStatHandle FTM_RENDER_UI;
extern LLTrace::BlockTimerStatHandle FTM_RENDER_WATER;
extern LLTrace::BlockTimerStatHandle FTM_RENDER_WL_SKY;
extern LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA;
-extern LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_DEFERRED;
extern LLTrace::BlockTimerStatHandle FTM_RENDER_CHARACTERS;
extern LLTrace::BlockTimerStatHandle FTM_RENDER_BUMP;
extern LLTrace::BlockTimerStatHandle FTM_RENDER_MATERIALS;
@@ -615,6 +614,10 @@ public:
LLRenderTarget mHighlight;
LLRenderTarget mPhysicsDisplay;
+ LLCullResult mSky;
+ LLCullResult mReflectedObjects;
+ LLCullResult mRefractedObjects;
+
//utility buffer for rendering post effects, gets abused by renderDeferredLighting
LLPointer<LLVertexBuffer> mDeferredVB;