@@ -542,17 +542,29 @@ int process_cl(dt_iop_module_t *self,
542542 const uint32_t filters = pipe -> dsc .filters ;
543543 const int devid = pipe -> devid ;
544544
545+ if (pipe -> mask_display == DT_DEV_PIXELPIPE_DISPLAY_PASSTHRU )
546+ {
547+ if (!filters )
548+ return dt_iop_clip_and_zoom_roi_cl (devid , dev_out , dev_in , roi_out , roi_in );
549+ else
550+ {
551+ size_t iorigin [] = { roi_out -> x , roi_out -> y , 0 };
552+ size_t oorigin [] = { 0 , 0 , 0 };
553+ size_t region [] = { roi_out -> width , roi_out -> height , 1 };
554+ return dt_opencl_enqueue_copy_image (devid , dev_in , dev_out , iorigin , oorigin , region );
555+ }
556+ }
557+
545558 const gboolean fullpipe = pipe -> type & DT_DEV_PIXELPIPE_FULL ;
546- const gboolean passthru = pipe -> mask_display == DT_DEV_PIXELPIPE_DISPLAY_PASSTHRU ;
547- const dt_iop_highlights_mode_t dmode = passthru && fullpipe ? DT_IOP_HIGHLIGHTS_CLIP : d -> mode ;
559+ const dt_iop_highlights_mode_t dmode = d -> mode ;
548560
549- gboolean announce = passthru ? FALSE : dt_iop_piece_is_raster_mask_used (piece , BLEND_RASTER_ID );
561+ gboolean announce = dt_iop_piece_is_raster_mask_used (piece , BLEND_RASTER_ID );
550562
551563 cl_int err = DT_OPENCL_DEFAULT_ERROR ;
552564 cl_mem dev_xtrans = NULL ;
553565 cl_mem dev_clips = NULL ;
554566
555- if (g && fullpipe && ! passthru )
567+ if (g && fullpipe )
556568 {
557569 if (g -> hlr_mask_mode != DT_HIGHLIGHTS_MASK_OFF )
558570 {
@@ -585,7 +597,7 @@ int process_cl(dt_iop_module_t *self,
585597 }
586598 }
587599
588- const float clip = passthru ? FLT_MAX : ( d -> clip * dt_iop_get_processed_minimum (piece ) );
600+ const float clip = d -> clip * dt_iop_get_processed_minimum (piece );
589601
590602 if (!filters )
591603 {
@@ -671,7 +683,6 @@ int process_cl(dt_iop_module_t *self,
671683 CLARG (filters ), CLARG (dev_xtrans ));
672684 }
673685 if (err != CL_SUCCESS ) goto finish ;
674- if (passthru ) goto finish ;
675686
676687 float * mask = NULL ;
677688 if (announce )
@@ -826,16 +837,24 @@ void process(dt_iop_module_t *self,
826837 dt_iop_highlights_data_t * d = piece -> data ;
827838 dt_iop_highlights_gui_data_t * g = self -> gui_data ;
828839
840+ if (pipe -> mask_display == DT_DEV_PIXELPIPE_DISPLAY_PASSTHRU )
841+ {
842+ if (!filters )
843+ dt_iop_clip_and_zoom_roi ((float * )ovoid , (float * )ivoid , roi_out , roi_in );
844+ else
845+ dt_iop_copy_image_roi ((float * )ovoid , (float * )ivoid , 1 , roi_in , roi_out );
846+ return ;
847+ }
848+
829849 const gboolean fullpipe = pipe -> type & DT_DEV_PIXELPIPE_FULL ;
830850 const gboolean fastmode = pipe -> type & DT_DEV_PIXELPIPE_FAST ;
831-
832- const gboolean passthru = pipe -> mask_display == DT_DEV_PIXELPIPE_DISPLAY_PASSTHRU ;
833- dt_iop_highlights_mode_t dmode = passthru ? DT_IOP_HIGHLIGHTS_CLIP : d -> mode ;
834-
851+ const dt_iop_highlights_mode_t dmode = fastmode && (d -> mode == DT_IOP_HIGHLIGHTS_SEGMENTS )
852+ ? DT_IOP_HIGHLIGHTS_OPPOSED
853+ : d -> mode ;
835854 const gboolean scaled = filters == 0 && dmode != DT_IOP_HIGHLIGHTS_CLIP ;
836855
837856 float * out = scaled ? dt_alloc_align_float ((size_t )roi_in -> width * roi_in -> height * 4 ) : NULL ;
838- const gboolean announce = passthru ? FALSE : dt_iop_piece_is_raster_mask_used (piece , BLEND_RASTER_ID );
857+ const gboolean announce = dt_iop_piece_is_raster_mask_used (piece , BLEND_RASTER_ID );
839858
840859 if (!out && scaled )
841860 {
@@ -847,7 +866,7 @@ void process(dt_iop_module_t *self,
847866 return ;
848867 }
849868
850- if (g && fullpipe && ! passthru )
869+ if (g && fullpipe )
851870 {
852871 if (g -> hlr_mask_mode != DT_HIGHLIGHTS_MASK_OFF )
853872 {
@@ -879,19 +898,15 @@ void process(dt_iop_module_t *self,
879898 high_quality = (level >= min_s );
880899 }
881900
882- const float clip = passthru ? FLT_MAX : d -> clip * dt_iop_get_processed_minimum (piece );
901+ const float clip = d -> clip * dt_iop_get_processed_minimum (piece );
883902
884903 if (filters == 0 )
885904 {
886905 if (dmode == DT_IOP_HIGHLIGHTS_CLIP )
887906 {
888907 process_clip (self , piece , ivoid , ovoid , roi_in , roi_out , clip );
889- if (!passthru )
890- {
891- const float m = dt_iop_get_processed_minimum (piece );
892- for_three_channels (k )
893- pipe -> dsc .processed_maximum [k ] = m ;
894- }
908+ const float m = dt_iop_get_processed_minimum (piece );
909+ for_three_channels (k ) pipe -> dsc .processed_maximum [k ] = m ;
895910 }
896911 else
897912 {
@@ -900,16 +915,13 @@ void process(dt_iop_module_t *self,
900915 dt_free_align (out );
901916 }
902917
903- if (passthru ) return ;
904-
905918 float * mask = announce ? _provide_raster_mask (roi_in , roi_out , (float * )ovoid , d -> clip , piece ) : NULL ;
906919 if (mask ) dt_iop_piece_set_raster (piece , mask , roi_in , roi_out );
907920 else dt_iop_piece_clear_raster (piece , NULL );
908921
909922 return ;
910923 }
911924
912- dmode = fastmode && (dmode == DT_IOP_HIGHLIGHTS_SEGMENTS ) ? DT_IOP_HIGHLIGHTS_OPPOSED : dmode ;
913925 switch (dmode )
914926 {
915927 case DT_IOP_HIGHLIGHTS_INPAINT : // a1ex's (magiclantern) idea of color inpainting:
@@ -998,14 +1010,12 @@ void process(dt_iop_module_t *self,
9981010 }
9991011 }
10001012
1001- if (passthru ) return ;
1002-
10031013 float * mask = announce ? _provide_raster_mask (roi_in , roi_out , (float * )ovoid , d -> clip , piece ) : NULL ;
10041014 if (mask ) dt_iop_piece_set_raster (piece , mask , roi_in , roi_out );
10051015 else dt_iop_piece_clear_raster (piece , NULL );
10061016
10071017 // update processed maximum
1008- if ((dmode != DT_IOP_HIGHLIGHTS_LAPLACIAN ) && (dmode != DT_IOP_HIGHLIGHTS_SEGMENTS ) && (dmode != DT_IOP_HIGHLIGHTS_OPPOSED ) && ! passthru )
1018+ if ((dmode != DT_IOP_HIGHLIGHTS_LAPLACIAN ) && (dmode != DT_IOP_HIGHLIGHTS_SEGMENTS ) && (dmode != DT_IOP_HIGHLIGHTS_OPPOSED ))
10091019 {
10101020 // The guided laplacian, inpaint opposed and segmentation modes keep signal scene-referred and don't clip highlights to 1
10111021 // For the other modes, we need to notify the pipeline that white point has changed
0 commit comments