diff options
author | Dave Parks <davep@lindenlab.com> | 2012-02-06 18:56:19 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2012-02-06 18:56:19 -0600 |
commit | 38e0b7de96de02243453eeaf5710b924f68abc7a (patch) | |
tree | 34ec45d563aedc10877e91fa1e157556dc3d5b2e /indra/newview | |
parent | ae7d475aebc836203984654912df036a11c365fc (diff) |
SH-2729 Fix for horizontal line of glitching graphics when DoF enabled
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl | 12 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 9 |
2 files changed, 18 insertions, 3 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl index 01e3505359..0cf5afc568 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl @@ -37,14 +37,24 @@ uniform vec2 screen_res; uniform float max_cof; uniform float res_scale; +uniform float dof_width; +uniform float dof_height; VARYING vec2 vary_fragcoord; +vec4 dofSample(sampler2DRect tex, vec2 tc) +{ + tc.x = min(tc.x, dof_width); + tc.y = min(tc.y, dof_height); + + return texture2DRect(tex, tc); +} + void main() { vec2 tc = vary_fragcoord.xy; - vec4 dof = texture2DRect(diffuseRect, vary_fragcoord.xy*res_scale); + vec4 dof = dofSample(diffuseRect, vary_fragcoord.xy*res_scale); vec4 diff = texture2DRect(lightMap, vary_fragcoord.xy); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index a64655960f..dffc541001 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6642,9 +6642,12 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) mDeferredLight.flush(); } + U32 dof_width = mScreen.getWidth()*CameraDoFResScale; + U32 dof_height = mScreen.getHeight()*CameraDoFResScale; + { //perform DoF sampling at half-res (preserve alpha channel) mScreen.bindTarget(); - glViewport(0,0,(GLsizei) (mScreen.getWidth()*CameraDoFResScale), (GLsizei) (mScreen.getHeight()*CameraDoFResScale)); + glViewport(0,0, dof_width, dof_height); gGL.setColorMask(true, false); shader = &gDeferredPostProgram; @@ -6657,7 +6660,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) shader->uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF); shader->uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale); - + gGL.begin(LLRender::TRIANGLE_STRIP); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); gGL.vertex2f(-1,-1); @@ -6702,6 +6705,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) shader->uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF); shader->uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale); + shader->uniform1f(LLShaderMgr::DOF_WIDTH, dof_width-1); + shader->uniform1f(LLShaderMgr::DOF_HEIGHT, dof_height-1); gGL.begin(LLRender::TRIANGLE_STRIP); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); |