Fix #109662: Overlay: Always use 0 for retopo min offset when disabled

Using 0.0015f as minimum value on Apple makes sense when the retopology
overlay is enabled.
When disabled however, this will cause the shader to think the overlay
is enabled when it's not, affecting the color of faces.
Therefore the offset when disabled should always be zero.
I've removed the unnecessary define and shortened the name of the other
one.

Pull Request: https://projects.blender.org/blender/blender/pulls/109658
This commit is contained in:
bonj
2023-07-11 12:05:51 +02:00
committed by Clément Foucault
parent 53e1bae929
commit d3315422ae

View File

@@ -1329,17 +1329,15 @@ void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrAr
(((overlay).edit_flag & V3D_OVERLAY_EDIT_RETOPOLOGY) != 0)
#ifdef __APPLE__
/* Apple silicon tile depth test requires a higher value to reduce drawing artifacts. */
# define OVERLAY_RETOPOLOGY_MIN_OFFSET_ENABLED 0.0015f
# define OVERLAY_RETOPOLOGY_MIN_OFFSET_DISABLED 0.0015f
# define OVERLAY_RETOPOLOGY_MIN_OFFSET 0.0015f
#else
# define OVERLAY_RETOPOLOGY_MIN_OFFSET_ENABLED FLT_EPSILON
# define OVERLAY_RETOPOLOGY_MIN_OFFSET_DISABLED 0.0f
# define OVERLAY_RETOPOLOGY_MIN_OFFSET FLT_EPSILON
#endif
#define OVERLAY_RETOPOLOGY_OFFSET(overlay) \
(OVERLAY_RETOPOLOGY_ENABLED(overlay) ? \
max_ff((overlay).retopology_offset, OVERLAY_RETOPOLOGY_MIN_OFFSET_ENABLED) : \
OVERLAY_RETOPOLOGY_MIN_OFFSET_DISABLED)
max_ff((overlay).retopology_offset, OVERLAY_RETOPOLOGY_MIN_OFFSET) : \
0.0f)
#define RETOPOLOGY_ENABLED(v3d) (OVERLAY_RETOPOLOGY_ENABLED((v3d)->overlay))
#define RETOPOLOGY_OFFSET(v3d) (OVERLAY_RETOPOLOGY_OFFSET((v3d)->overlay))