[Bf-blender-cvs] [1e480840a21] master: Overlay: Fix vertex discard issue on Nvidia hardware

Clément Foucault noreply at git.blender.org
Mon Dec 2 18:32:05 CET 2019


Commit: 1e480840a2123a6b61e7aa3e6f7935b6654f9981
Author: Clément Foucault
Date:   Mon Dec 2 19:02:51 2019 +0100
Branches: master
https://developer.blender.org/rB1e480840a2123a6b61e7aa3e6f7935b6654f9981

Overlay: Fix vertex discard issue on Nvidia hardware

Instead of relying on undefined behavior to discard the line, we put the
vertex at the camera origin so that interpolation does not produce any
fragment. We don't use FLT_MAX as it also gives unpredicatble results on
NVidia.

===================================================================

M	source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl

===================================================================

diff --git a/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl b/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl
index 5801c7cb474..c627e912d6c 100644
--- a/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl
+++ b/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl
@@ -104,8 +104,8 @@ void main()
   gl_Position = point_world_to_ndc(wpos);
 
   if (get_edge_sharpness(wd) < 0.0) {
-    /* Discard primitive. */
-    gl_Position = vec4(0.0);
+    /* Discard primitive by placing any of the verts at the camera origin. */
+    gl_Position = vec4(0.0, 0.0, -3e36, 0.0);
   }
 
 #ifndef SELECT_EDGES



More information about the Bf-blender-cvs mailing list