From d3315422ae4cb8c907a278caad75cb3e5a97fdd7 Mon Sep 17 00:00:00 2001 From: bonj Date: Tue, 11 Jul 2023 12:05:51 +0200 Subject: [PATCH] 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 --- source/blender/editors/include/ED_view3d.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 4adafb40c34..b6f123a7fe3 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -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))