diff options
Diffstat (limited to 'indra')
20 files changed, 405 insertions, 81 deletions
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 78aed5eef6..3c25d6aaa8 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1319,6 +1319,7 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("single_mie_scattering_texture"); mReservedUniforms.push_back("irradiance_texture"); mReservedUniforms.push_back("blend_factor"); + mReservedUniforms.push_back("no_atmo"); llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 342f5d5507..7898b2d90a 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -233,6 +233,7 @@ public: ILLUMINANCE_TEX, BLEND_FACTOR, + NO_ATMO, END_RESERVED_UNIFORMS } eGLSLReservedUniforms; diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl index 3f81e3b0af..c1a9a6f454 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl @@ -51,13 +51,7 @@ VARYING vec2 vary_texcoord2; VARYING vec2 vary_texcoord3; /// Soft clips the light with a gamma correction -vec3 scaleSoftClip(vec3 light) { - //soft clip effect: - light = 1. - clamp(light, vec3(0.), vec3(1.)); - light = 1. - pow(light, gamma.xxx); - - return light; -} +vec3 scaleSoftClip(vec3 light); vec4 cloudNoise(vec2 uv) { diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 134e9c3b4c..0e21e5925d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -1,5 +1,5 @@ /** - * @file fullbrightF.glsl + * @file deferred/fullbrightF.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl index 8e4696cfaa..0613111632 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl @@ -40,13 +40,7 @@ VARYING vec4 vary_HazeColor; uniform vec4 gamma; /// Soft clips the light with a gamma correction -vec3 scaleSoftClip(vec3 light) { - //soft clip effect: - light = 1. - clamp(light, vec3(0.), vec3(1.)); - light = 1. - pow(light, gamma.xxx); - - return light; -} +vec3 scaleSoftClip(vec3 light); void main() { diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl index a54c0caf81..31a262f1db 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl @@ -1,5 +1,5 @@ /** - * @file fullbrightF.glsl + * @file objects/fullbrightF.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl index fee1a7f311..4ec5691a85 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl @@ -43,9 +43,14 @@ uniform float max_y; uniform vec4 glow; uniform float scene_light_strength; uniform mat3 ssao_effect_mat; +uniform int no_atmo; vec3 scaleFragSoftClip(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); @@ -54,14 +59,17 @@ vec3 scaleFragSoftClip(vec3 light) vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten) { - light *= atten.r; - light += additive; + if (no_atmo == 0) + { + light *= atten.r; + light += additive; + } return (2.0 * light); } vec3 atmosLighting(vec3 light) { - return atmosFragLighting(light, getAdditiveColor(), getAtmosAttenuation()); + return (no_atmo == 1) ? light : atmosFragLighting(light, getAdditiveColor(), getAtmosAttenuation()); } void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten) { diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl index e0c7e18a6f..24fdb45749 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl @@ -49,13 +49,7 @@ uniform vec4 cloud_pos_density2; uniform vec4 gamma; /// Soft clips the light with a gamma correction -vec3 scaleSoftClip(vec3 light) { - //soft clip effect: - light = 1. - clamp(light, vec3(0.), vec3(1.)); - light = 1. - pow(light, gamma.xxx); - - return light; -} +vec3 scaleSoftClip(vec3 light); vec4 cloudNoise(vec2 uv) { diff --git a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl index 2db633cd01..f2764b72c3 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl @@ -26,11 +26,16 @@ uniform vec4 gamma; +uniform int no_atmo; vec3 getAtmosAttenuation(); /// Soft clips the light with a gamma correction vec3 scaleSoftClip(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); @@ -40,10 +45,10 @@ vec3 scaleSoftClip(vec3 light) { vec3 fullbrightScaleSoftClipFrag(vec3 light, vec3 atten) { - return mix(scaleSoftClip(light.rgb), light.rgb, atten); + return (no_atmo == 1) ? light : mix(scaleSoftClip(light.rgb), light.rgb, atten); } vec3 fullbrightScaleSoftClip(vec3 light) { - return fullbrightScaleSoftClipFrag(light.rgb, getAtmosAttenuation()); + return (no_atmo == 1) ? light : fullbrightScaleSoftClipFrag(light.rgb, getAtmosAttenuation()); } diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl index 25fd0584f8..28d185b9af 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl @@ -38,13 +38,7 @@ VARYING vec4 vary_HazeColor; uniform vec4 gamma; /// Soft clips the light with a gamma correction -vec3 scaleSoftClip(vec3 light) { - //soft clip effect: - light = 1. - clamp(light, vec3(0.), vec3(1.)); - light = 1. - pow(light, gamma.xxx); - - return light; -} +vec3 scaleSoftClip(vec3 light); void main() { diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl index 82e1d7fe35..9627642b9d 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl @@ -32,31 +32,43 @@ vec3 getAtmosAttenuation(); uniform sampler2D cloudMap; uniform vec4 cloud_pos_density1; +uniform int no_atmo; vec3 atmosFragTransport(vec3 light, vec3 atten, vec3 additive) { - light *= atten.r; - light += additive * 2.0; + if (no_atmo == 0) + { + light *= atten.r; + light += additive * 2.0; + } return light; } vec3 fullbrightFragAtmosTransport(vec3 light, vec3 atten, vec3 additive) { + if (no_atmo == 1) + { + return light; + } float brightness = dot(light.rgb, vec3(0.33333)); return mix(atmosFragTransport(light.rgb, atten, additive), light.rgb + additive.rgb, brightness * brightness); } vec3 fullbrightFragShinyAtmosTransport(vec3 light, vec3 atten, vec3 additive) { + if (no_atmo == 1) + { + return light; + } float brightness = dot(light.rgb, vec3(0.33333)); return mix(atmosFragTransport(light.rgb, atten, additive), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness); } vec3 atmosTransport(vec3 light) { - return atmosFragTransport(light, getAtmosAttenuation(), getAdditiveColor()); + return (no_atmo == 1) ? light : atmosFragTransport(light, getAtmosAttenuation(), getAdditiveColor()); } vec3 fullbrightAtmosTransport(vec3 light) { - return fullbrightFragAtmosTransport(light, getAtmosAttenuation(), getAdditiveColor()); + return (no_atmo == 1) ? light : fullbrightFragAtmosTransport(light, getAtmosAttenuation(), getAdditiveColor()); } vec3 fullbrightShinyAtmosTransport(vec3 light) { - return fullbrightFragShinyAtmosTransport(light, getAtmosAttenuation(), getAdditiveColor()); + return (no_atmo == 1) ? light : fullbrightFragShinyAtmosTransport(light, getAtmosAttenuation(), getAdditiveColor()); } diff --git a/indra/newview/app_settings/shaders/class3/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class3/deferred/cloudsF.glsl index 44b41cc0b8..d9fcc0a9ea 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/cloudsF.glsl @@ -58,13 +58,7 @@ vec4 cloudNoise(vec2 uv) /// Soft clips the light with a gamma correction -vec3 scaleSoftClip(vec3 light) { - //soft clip effect: - light = 1. - clamp(light, vec3(0.), vec3(1.)); - light = 1. - pow(light, gamma.xxx); - - return light; -} +vec3 scaleSoftClip(vec3 light); void main() { diff --git a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl index 82e1d7fe35..e8e9c53c38 100644 --- a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl @@ -32,31 +32,43 @@ vec3 getAtmosAttenuation(); uniform sampler2D cloudMap; uniform vec4 cloud_pos_density1; +uniform int no_atmo; vec3 atmosFragTransport(vec3 light, vec3 atten, vec3 additive) { - light *= atten.r; - light += additive * 2.0; + if (no_atmo == 0) + { + light *= atten.r; + light += additive * 2.0; + } return light; } vec3 fullbrightFragAtmosTransport(vec3 light, vec3 atten, vec3 additive) { - float brightness = dot(light.rgb, vec3(0.33333)); + if (no_atmo) + { + return light; + } + loat brightness = dot(light.rgb, vec3(0.33333)); return mix(atmosFragTransport(light.rgb, atten, additive), light.rgb + additive.rgb, brightness * brightness); } vec3 fullbrightFragShinyAtmosTransport(vec3 light, vec3 atten, vec3 additive) { + if (no_atmo) + { + return light; + } float brightness = dot(light.rgb, vec3(0.33333)); return mix(atmosFragTransport(light.rgb, atten, additive), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness); } vec3 atmosTransport(vec3 light) { - return atmosFragTransport(light, getAtmosAttenuation(), getAdditiveColor()); + return no_atmo ? light : atmosFragTransport(light, getAtmosAttenuation(), getAdditiveColor()); } vec3 fullbrightAtmosTransport(vec3 light) { - return fullbrightFragAtmosTransport(light, getAtmosAttenuation(), getAdditiveColor()); + return no_atmo ? light : fullbrightFragAtmosTransport(light, getAtmosAttenuation(), getAdditiveColor()); } vec3 fullbrightShinyAtmosTransport(vec3 light) { - return fullbrightFragShinyAtmosTransport(light, getAtmosAttenuation(), getAdditiveColor()); + return no_atmo ? light : fullbrightFragShinyAtmosTransport(light, getAtmosAttenuation(), getAdditiveColor()); } diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 0873300cd2..7679d44826 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -117,6 +117,14 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass) fullbright_shader->uniform1f(LLShaderMgr::DISPLAY_GAMMA, (gamma > 0.1f) ? 1.0f / gamma : (1.0f/2.2f)); fullbright_shader->unbind(); + if (LLPipeline::sRenderingHUDs) + { + fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } //prime simple shader (loads shadow relevant uniforms) gPipeline.bindDeferredShader(*simple_shader); @@ -260,17 +268,49 @@ void LLDrawPoolAlpha::render(S32 pass) { if (LLPipeline::sImpostorRender) { - fullbright_shader->bind(); + fullbright_shader->bind(); fullbright_shader->setMinimumAlpha(0.5f); + if (LLPipeline::sRenderingHUDs) + { + fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } 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 { fullbright_shader->bind(); fullbright_shader->setMinimumAlpha(0.f); + if (LLPipeline::sRenderingHUDs) + { + fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } simple_shader->bind(); simple_shader->setMinimumAlpha(0.f); + if (LLPipeline::sRenderingHUDs) + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } } } else @@ -610,7 +650,14 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass) LLRender::BF_ONE, LLRender::BF_ONE); // add to alpha (glow) emissive_shader->bind(); - + if (LLPipeline::sRenderingHUDs) + { + emissive_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + emissive_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } params.mVertexBuffer->setBuffer((mask & ~LLVertexBuffer::MAP_COLOR) | LLVertexBuffer::MAP_EMISSIVE); // do the actual drawing, again diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index ef69990170..2651e3531b 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -670,6 +670,14 @@ 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 @@ -720,6 +728,14 @@ 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() @@ -763,6 +779,14 @@ 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 @@ -772,6 +796,14 @@ 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); + } } } @@ -834,6 +866,14 @@ void LLDrawPoolAvatar::beginRiggedSimple() { sDiffuseChannel = 0; sVertexProgram->bind(); + if (LLPipeline::sRenderingHUDs) + { + sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0); + } } } @@ -899,6 +939,16 @@ void LLDrawPoolAvatar::beginRiggedGlow() sVertexProgram->bind(); 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)); } @@ -946,16 +996,22 @@ void LLDrawPoolAvatar::beginRiggedFullbright() sDiffuseChannel = 0; sVertexProgram->bind(); - if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred) + 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, 1.0f); + 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)); } else { - 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->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); + sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 0); } } } @@ -998,6 +1054,14 @@ 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); } } @@ -1048,17 +1112,32 @@ 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 || !LLPipeline::sRenderDeferred) + if (LLPipeline::sRenderingHUDs) { sVertexProgram->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); - } - else + sVertexProgram->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else if (LLPipeline::sRenderDeferred) { - sVertexProgram->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); + 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); } } } @@ -1080,6 +1159,14 @@ 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); + } } void LLDrawPoolAvatar::endDeferredRiggedSimple() @@ -1093,6 +1180,14 @@ 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); } @@ -1125,6 +1220,14 @@ 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); @@ -1158,7 +1261,15 @@ 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 7b9fd5c6c6..e27b6867b9 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -351,6 +351,14 @@ 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 { @@ -534,6 +542,15 @@ 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]); shader->uniform4fv(LLViewerShaderMgr::SHINY_ORIGIN, 1, vec4.mV); diff --git a/indra/newview/lldrawpoolmaterials.cpp b/indra/newview/lldrawpoolmaterials.cpp index 63e96a93b5..113c198a9a 100644 --- a/indra/newview/lldrawpoolmaterials.cpp +++ b/indra/newview/lldrawpoolmaterials.cpp @@ -81,6 +81,15 @@ 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 bd180de6c6..bb50ad8e3e 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -47,6 +47,14 @@ 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"); @@ -119,6 +127,15 @@ 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); @@ -170,6 +187,15 @@ void LLDrawPoolSimple::beginRenderPass(S32 pass) if (mVertexShaderLevel > 0) { simple_shader->bind(); + + if (LLPipeline::sRenderingHUDs) + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } } else { @@ -263,6 +289,15 @@ void LLDrawPoolAlphaMask::beginRenderPass(S32 pass) if (mVertexShaderLevel > 0) { simple_shader->bind(); + + if (LLPipeline::sRenderingHUDs) + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } } else { @@ -296,6 +331,15 @@ 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); @@ -336,6 +380,15 @@ void LLDrawPoolFullbrightAlphaMask::beginRenderPass(S32 pass) if (mVertexShaderLevel > 0) { simple_shader->bind(); + + if (LLPipeline::sRenderingHUDs) + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } } else { @@ -369,12 +422,24 @@ void LLDrawPoolFullbrightAlphaMask::render(S32 pass) { simple_shader->bind(); simple_shader->setMinimumAlpha(0.33f); - if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred) - { - simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); - } else { - simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); - } + + 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); + } + else + { + simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); + } + } } pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); //LLGLSLShader::bindNoShader(); @@ -397,6 +462,15 @@ 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) @@ -435,6 +509,16 @@ 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(); } @@ -471,6 +555,14 @@ 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 { @@ -527,6 +619,16 @@ 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); + } + //render grass LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask()); } @@ -553,6 +655,15 @@ void LLDrawPoolFullbright::beginPostDeferredPass(S32 pass) else { gDeferredFullbrightProgram.bind(); + + if (LLPipeline::sRenderingHUDs) + { + gDeferredFullbrightProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + gDeferredFullbrightProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); + } } } @@ -621,6 +732,15 @@ 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); @@ -651,23 +771,32 @@ S32 LLDrawPoolFullbright::getNumPasses() void LLDrawPoolFullbrightAlphaMask::beginPostDeferredPass(S32 pass) { - if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred) - { - gObjectFullbrightAlphaMaskProgram.bind(); + if (LLPipeline::sRenderingHUDs) + { + gObjectFullbrightAlphaMaskProgram.bind(); gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); - } - else - { - if (LLPipeline::sUnderWaterRender) + gObjectFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else if (LLPipeline::sRenderDeferred) + { + if (LLPipeline::sUnderWaterRender) { 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/llhudtext.cpp b/indra/newview/llhudtext.cpp index 6b1e196182..486e077b9b 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -588,8 +588,6 @@ void LLHUDText::renderAllHUD() LLVertexBuffer::unbind(); - LLVertexBuffer::unbind(); - LLGLState::checkStates(); LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 568a8fc516..3fdcac8917 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -2110,6 +2110,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWLSkyProgram.mName = "Deferred Windlight Sky Shader"; //gWLSkyProgram.mFeatures.hasGamma = true; gDeferredWLSkyProgram.mShaderFiles.clear(); + gDeferredWLSkyProgram.mFeatures.hasGamma = true; gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT]; @@ -2126,6 +2127,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() { gDeferredWLCloudProgram.mName = "Deferred Windlight Cloud Program"; gDeferredWLCloudProgram.mShaderFiles.clear(); + gDeferredWLCloudProgram.mFeatures.hasGamma = true; gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredWLCloudProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; @@ -3526,6 +3528,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() gWLSkyProgram.mName = "Windlight Sky Shader"; //gWLSkyProgram.mFeatures.hasGamma = true; gWLSkyProgram.mShaderFiles.clear(); + gWLSkyProgram.mFeatures.hasGamma = true; gWLSkyProgram.mShaderFiles.push_back(make_pair("windlight/skyV.glsl", GL_VERTEX_SHADER_ARB)); gWLSkyProgram.mShaderFiles.push_back(make_pair("windlight/skyF.glsl", GL_FRAGMENT_SHADER_ARB)); gWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT]; @@ -3538,6 +3541,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() gWLCloudProgram.mName = "Windlight Cloud Program"; //gWLCloudProgram.mFeatures.hasGamma = true; gWLCloudProgram.mShaderFiles.clear(); + gWLCloudProgram.mFeatures.hasGamma = true; gWLCloudProgram.mShaderFiles.push_back(make_pair("windlight/cloudsV.glsl", GL_VERTEX_SHADER_ARB)); gWLCloudProgram.mShaderFiles.push_back(make_pair("windlight/cloudsF.glsl", GL_FRAGMENT_SHADER_ARB)); gWLCloudProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT]; |