diff options
author | Graham Linden <graham@lindenlab.com> | 2018-08-30 17:54:59 +0100 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2018-08-30 17:54:59 +0100 |
commit | 6dd9dd3ab63cb0daa7682a400ff0408fd894ba77 (patch) | |
tree | 35b303a95601c39f0881c51a4f6f7753788c2d5e /indra/newview | |
parent | 51451e0b92177ee887ba8310e304bb30e90685a9 (diff) |
MAINT-9064
Fix binding of current/next sun/moon textures.
Remove redundant code in GLSLShader determination of tex uniform bindings.
Unhack mix calls in sun/moon shaders to reverse sense of blending (was working around reversed bindings).
Diffstat (limited to 'indra/newview')
5 files changed, 15 insertions, 16 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl index 2bfc4f3d2f..e86bca3ddd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl @@ -49,7 +49,7 @@ void main() { vec4 moonA = texture2D(diffuseMap, vary_texcoord0.xy); vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy); - vec4 c = mix(moonB, moonA, blend_factor); + vec4 c = mix(moonA, moonB, blend_factor); c.rgb = pow(c.rgb, vec3(0.7f)); c.rgb = fullbrightAtmosTransport(c.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl index bbc5049f1c..3557c0766e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl @@ -45,7 +45,7 @@ void main() { vec4 sunDiscA = texture2D(diffuseMap, vary_texcoord0.xy); vec4 sunDiscB = texture2D(altDiffuseMap, vary_texcoord0.xy); - vec4 c = mix(sunDiscB, sunDiscA, blend_factor); + vec4 c = mix(sunDiscA, sunDiscB, blend_factor); c.rgb = clamp(c.rgb, vec3(0), vec3(1)); c.rgb = pow(c.rgb, vec3(0.7f)); c.rgb = fullbrightAtmosTransport(c.rgb); diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl index 480a0e1dc4..933625986c 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl @@ -49,7 +49,7 @@ void main() { vec4 moonA = texture2D(diffuseMap, vary_texcoord0.xy); vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy); - vec4 c = mix(moonB, moonA, blend_factor); + vec4 c = mix(moonA, moonB, blend_factor); c.rgb = pow(c.rgb, vec3(0.45f)); c.rgb = fullbrightAtmosTransport(c.rgb); diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl index 05251e7e96..3f2375ee4d 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl @@ -45,7 +45,7 @@ void main() { vec4 sunA = texture2D(diffuseMap, vary_texcoord0.xy); vec4 sunB = texture2D(altDiffuseMap, vary_texcoord0.xy); - vec4 c = mix(sunB, sunA, blend_factor); + vec4 c = mix(sunA, sunB, blend_factor); c.rgb = pow(c.rgb, vec3(0.7f)); c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 6b32c196dc..4bf47f4fd6 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -379,6 +379,9 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() LLViewerTexture* tex_a = face->getTexture(LLRender::DIFFUSE_MAP); LLViewerTexture* tex_b = face->getTexture(LLRender::ALTERNATE_DIFFUSE_MAP); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + // if we even have sun disc textures to work with... if (tex_a || tex_b) { @@ -391,20 +394,18 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() if (tex_a && (!tex_b || (tex_a == tex_b))) { // Bind current and next sun textures - gGL.getTexUnit(0)->bind(tex_a); - gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); blend_factor = 0; } else if (tex_b && !tex_a) { - gGL.getTexUnit(0)->bind(tex_b); - gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); blend_factor = 0; } else if (tex_b != tex_a) { - gGL.getTexUnit(0)->bind(tex_a); - gGL.getTexUnit(1)->bind(tex_b); + sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); + sun_shader->bindTexture(LLShaderMgr::ALTERNATE_DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); } LLColor4 color(gSky.mVOSkyp->getSun().getInterpColor()); @@ -445,20 +446,18 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() if (tex_a && (!tex_b || (tex_a == tex_b))) { // Bind current and next sun textures - gGL.getTexUnit(0)->bind(tex_a); - gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); blend_factor = 0; } else if (tex_b && !tex_a) { - gGL.getTexUnit(0)->bind(tex_b); - gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); blend_factor = 0; } else if (tex_b != tex_a) { - gGL.getTexUnit(0)->bind(tex_a); - gGL.getTexUnit(1)->bind(tex_b); + moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); + moon_shader->bindTexture(LLShaderMgr::ALTERNATE_DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); } if (can_use_vertex_shaders) |