diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class3/deferred')
-rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl index 025bcdaf3e..13619a82d3 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl @@ -35,10 +35,26 @@ float getDepth(vec2 pos_screen); vec4 getWaterFogView(vec3 pos); +uniform int above_water; + void main() { vec2 tc = vary_fragcoord.xy/vary_fragcoord.w*0.5+0.5; float depth = getDepth(tc.xy); + + if (above_water > 0) + { + // we want to depth test when the camera is above water, but some GPUs have a hard time + // with depth testing against render targets that are bound for sampling in the same shader + // so we do it manually here + + float cur_depth = vary_fragcoord.z/vary_fragcoord.w*0.5+0.5; + if (cur_depth > depth) + { + discard; + } + } + vec4 pos = getPositionWithDepth(tc, depth); vec4 norm = texture(normalMap, tc); |