diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-02-13 16:56:29 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-02-18 16:17:57 +0300 |
commit | 9c49c2ef0c52594a4ad6e90b617ec1007819a526 (patch) | |
tree | e1bfb2596da210f20445f9bd26dbc1a39b8feac6 /source/blender/gpu | |
parent | 600da00a94e6b7ad65daf3a077353c8837b582bf (diff) |
GPU: Change multisample resolve shader to output min depth
This will effectively make the AA passes thicker in some cases but it is
required for better AA on wireframes. The trick is to occlude the wire
passes so that they do not output fragment that could be behind actual
geometry.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_image_multisample_resolve_frag.glsl | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_image_multisample_resolve_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_multisample_resolve_frag.glsl index 1f59c9dfdbd..f763b491b59 100644 --- a/source/blender/gpu/shaders/gpu_shader_image_multisample_resolve_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_image_multisample_resolve_frag.glsl @@ -89,25 +89,17 @@ void main() #endif #ifdef USE_DEPTH - d1 *= 1.0 - step(1.0, d1); /* make far plane depth = 0 */ # if SAMPLES > 8 - d4 *= 1.0 - step(1.0, d4); - d3 *= 1.0 - step(1.0, d3); - d1 = max(d1, max(d3, d4)); + d1 = min(d1, min(d3, d4)); # endif # if SAMPLES > 4 - d2 *= 1.0 - step(1.0, d2); - d1 = max(d1, d2); - d1 = max(d1, d2); + d1 = min(d1, d2); + d1 = min(d1, d2); # endif # if SAMPLES > 2 - d1.xy = max(d1.xy, d1.zw); + d1.xy = min(d1.xy, d1.zw); # endif - gl_FragDepth = max(d1.x, d1.y); - /* Don't let the 0.0 farplane occlude other things */ - if (gl_FragDepth == 0.0) { - gl_FragDepth = 1.0; - } + gl_FragDepth = min(d1.x, d1.y); #endif c1 = c1 + c2; |