@@ -273,8 +273,12 @@ static void _refine_with_detail_mask(dt_iop_module_t *self,
273273 float * lum = dt_masks_calc_detail_mask (piece , threshold , detail );
274274 if (lum == NULL ) goto error ;
275275
276+ // src_hash encodes what the thresholded mask depends on (scharr data + slider value),
277+ // so the distortion cache is invalidated when the details slider changes.
278+ const dt_hash_t src_hash = dt_hash (p -> scharr .hash , & level , sizeof (level ));
279+
276280 // here we have the slightly blurred full detail mask available
277- float * warp_mask = dt_dev_distort_detail_mask (piece , lum , self );
281+ float * warp_mask = dt_dev_distort_detail_mask (piece , lum , self , src_hash );
278282 dt_free_align (lum );
279283
280284 if (warp_mask == NULL ) goto error ;
@@ -815,8 +819,12 @@ static void _refine_with_detail_mask_cl(dt_iop_module_t *self,
815819 out = NULL ;
816820 blur = NULL ;
817821
822+ // src_hash encodes what the thresholded mask depends on (scharr data + slider value),
823+ // so the distortion cache is invalidated when the details slider changes.
824+ const dt_hash_t src_hash = dt_hash (p -> scharr .hash , & level , sizeof (level ));
825+
818826 // here we have the slightly blurred full detail mask available
819- float * warp_mask = dt_dev_distort_detail_mask (piece , lum , self );
827+ float * warp_mask = dt_dev_distort_detail_mask (piece , lum , self , src_hash );
820828 dt_free_align (lum );
821829 if (warp_mask == NULL )
822830 {
0 commit comments