[Bf-blender-cvs] [9c49c2ef0c5] master: GPU: Change multisample resolve shader to output min depth
Clément Foucault
noreply at git.blender.org
Mon Feb 18 14:18:19 CET 2019
Commit: 9c49c2ef0c52594a4ad6e90b617ec1007819a526
Author: Clément Foucault
Date: Wed Feb 13 14:56:29 2019 +0100
Branches: master
https://developer.blender.org/rB9c49c2ef0c52594a4ad6e90b617ec1007819a526
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.
===================================================================
M source/blender/gpu/shaders/gpu_shader_image_multisample_resolve_frag.glsl
===================================================================
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;
More information about the Bf-blender-cvs
mailing list