[Bf-blender-cvs] [7245f72b8a0] greasepencil-object: Remove old tonemapping code

Antonio Vazquez noreply at git.blender.org
Sun Feb 18 12:25:59 CET 2018


Commit: 7245f72b8a043b12fd27438eeddd50d194e35182
Author: Antonio Vazquez
Date:   Sun Feb 18 12:16:55 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB7245f72b8a043b12fd27438eeddd50d194e35182

Remove old tonemapping code

This code was slower than current fragment code.

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

M	source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/draw/engines/gpencil/gpencil_engine.h
M	source/blender/draw/engines/gpencil/gpencil_geom.c

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index dd179bd3c07..67f6985eceb 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -47,7 +47,6 @@
 #include "DEG_depsgraph.h"
 
 #include "IMB_imbuf_types.h"
-#include "IMB_colormanagement.h"
 
 #include "draw_cache_impl.h"
 #include "gpencil_engine.h"
@@ -524,7 +523,7 @@ DRWShadingGroup *DRW_gpencil_shgroup_point_create(GPENCIL_e_data *e_data, GPENCI
 /* add fill shading group to pass */
 static void gpencil_add_fill_shgroup(GpencilBatchCache *cache, DRWShadingGroup *fillgrp, 
 	Object *ob, bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps,
-	const float tintcolor[4], const bool onion, const bool custonion, ColorSpace *colorspace)
+	const float tintcolor[4], const bool onion, const bool custonion)
 {
 	if (gps->totpoints >= 3) {
 		float tfill[4];
@@ -547,7 +546,7 @@ static void gpencil_add_fill_shgroup(GpencilBatchCache *cache, DRWShadingGroup *
 			}
 			if (cache->is_dirty) {
 				gpencil_batch_cache_check_free_slots(ob);
-				cache->batch_fill[cache->cache_idx] = DRW_gpencil_get_fill_geom(gps, color, colorspace);
+				cache->batch_fill[cache->cache_idx] = DRW_gpencil_get_fill_geom(gps, color);
 			}
 			DRW_shgroup_call_add(fillgrp, cache->batch_fill[cache->cache_idx], gpf->viewmatrix);
 		}
@@ -557,8 +556,7 @@ static void gpencil_add_fill_shgroup(GpencilBatchCache *cache, DRWShadingGroup *
 /* add stroke shading group to pass */
 static void gpencil_add_stroke_shgroup(GpencilBatchCache *cache, DRWShadingGroup *strokegrp,
 	Object *ob, bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps,
-	const float opacity, const float tintcolor[4], const bool onion, const bool custonion,
-	ColorSpace *colorspace)
+	const float opacity, const float tintcolor[4], const bool onion, const bool custonion)
 {
 	float tcolor[4];
 	float ink[4];
@@ -592,10 +590,10 @@ static void gpencil_add_stroke_shgroup(GpencilBatchCache *cache, DRWShadingGroup
 	if (cache->is_dirty) {
 		gpencil_batch_cache_check_free_slots(ob);
 		if ((gps->totpoints > 1) && ((gps->palcolor->flag & PAC_COLOR_DOT) == 0)) {
-			cache->batch_stroke[cache->cache_idx] = DRW_gpencil_get_stroke_geom(gpf, gps, sthickness, ink, colorspace);
+			cache->batch_stroke[cache->cache_idx] = DRW_gpencil_get_stroke_geom(gpf, gps, sthickness, ink);
 		}
 		else {
-			cache->batch_stroke[cache->cache_idx] = DRW_gpencil_get_point_geom(gps, sthickness, ink, colorspace);
+			cache->batch_stroke[cache->cache_idx] = DRW_gpencil_get_point_geom(gps, sthickness, ink);
 		}
 	}
 	DRW_shgroup_call_add(strokegrp, cache->batch_stroke[cache->cache_idx], gpf->viewmatrix);
@@ -674,7 +672,7 @@ static void gpencil_draw_onion_strokes(GpencilBatchCache *cache, GPENCIL_e_data
 		}
 
 		/* stroke */
-		gpencil_add_stroke_shgroup(cache, stl->shgroups[id].shgrps_stroke, ob, gpd, gpl, gpf, gps, opacity, tintcolor, true, custonion, NULL);
+		gpencil_add_stroke_shgroup(cache, stl->shgroups[id].shgrps_stroke, ob, gpd, gpl, gpf, gps, opacity, tintcolor, true, custonion);
 
 		stl->storage->shgroup_id++;
 		cache->cache_idx++;
@@ -698,8 +696,7 @@ static void gpencil_init_evalctx_from_drawctx(const DRWContextState *draw_ctx, E
 /* main function to draw strokes */
 static void gpencil_draw_strokes(GpencilBatchCache *cache, GPENCIL_e_data *e_data, void *vedata, ToolSettings *ts, Object *ob,
 	bGPdata *gpd, bGPDlayer *gpl, bGPDframe *src_gpf, bGPDframe *derived_gpf,
-	const float opacity, const float tintcolor[4], const bool custonion,
-	ColorSpace *colorspace)
+	const float opacity, const float tintcolor[4], const bool custonion)
 {
 	GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl;
 	GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
@@ -810,11 +807,11 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache, GPENCIL_e_data *e_dat
 			}
 			/* fill */
 			if ((fillgrp) && (!GP_SIMPLIFY_FILL(ts, playing))) {
-				gpencil_add_fill_shgroup(cache, fillgrp, ob, gpd, gpl, derived_gpf, gps, tintcolor, false, custonion, colorspace);
+				gpencil_add_fill_shgroup(cache, fillgrp, ob, gpd, gpl, derived_gpf, gps, tintcolor, false, custonion);
 			}
 			/* stroke */
 			if (strokegrp) {
-				gpencil_add_stroke_shgroup(cache, strokegrp, ob, gpd, gpl, derived_gpf, gps, opacity, tintcolor, false, custonion, colorspace);
+				gpencil_add_stroke_shgroup(cache, strokegrp, ob, gpd, gpl, derived_gpf, gps, opacity, tintcolor, false, custonion);
 			}
 		}
 
@@ -1107,7 +1104,7 @@ void DRW_gpencil_populate_multiedit(GPENCIL_e_data *e_data, void *vedata, Scene
 			for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
 				if ((gpf == gpl->actframe) || (gpf->flag & GP_FRAME_SELECT)) {
 					gpencil_draw_strokes(cache, e_data, vedata, ts, ob, gpd, gpl, gpf, gpf,
-						gpl->opacity, gpl->tintcolor, false, NULL);
+						gpl->opacity, gpl->tintcolor, false);
 				}
 			}
 		}
@@ -1115,7 +1112,7 @@ void DRW_gpencil_populate_multiedit(GPENCIL_e_data *e_data, void *vedata, Scene
 			gpf = BKE_gpencil_layer_getframe(gpl, CFRA, 0);
 			if (gpf) {
 				gpencil_draw_strokes(cache, e_data, vedata, ts, ob, gpd, gpl, gpf, gpf,
-					gpl->opacity, gpl->tintcolor, false, NULL);
+					gpl->opacity, gpl->tintcolor, false);
 			}
 		}
 
@@ -1192,7 +1189,7 @@ void DRW_gpencil_populate_datablock(GPENCIL_e_data *e_data, void *vedata, Scene
 
 		/* draw normal strokes */
 		gpencil_draw_strokes(cache, e_data, vedata, ts, ob, gpd, gpl, gpf, derived_gpf,
-			gpl->opacity, gpl->tintcolor, false, stl->storage->colorspace);
+			gpl->opacity, gpl->tintcolor, false);
 
 	}
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 460f5abf52b..6c5f1861769 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -41,8 +41,6 @@
 
 #include "UI_resources.h"
 
-#include "IMB_colormanagement.h"
-
 #include "RE_pipeline.h"
 
 #include "gpencil_engine.h"
@@ -304,9 +302,6 @@ static void GPENCIL_cache_init(void *vedata)
 			stl->storage->pixsize = &stl->storage->render_pixsize;
 		}
 
-		/* save color space */
-		stl->storage->colorspace = colormanage_colorspace_get_named(colormanage_display_get_default_name());
-
 		/* detect if painting session */
 		bGPdata *obact_gpd = NULL;
 		if ((obact) && (obact->type == OB_GPENCIL) && (obact->data))
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index d66fd35653b..ff1cd627f7f 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -31,7 +31,6 @@
 struct tGPspoint;
 struct ModifierData;
 struct GPENCIL_StorageList;
-struct ColorSpace;
 
  /* TODO: these could be system parameter in userprefs screen */
 #define GPENCIL_MAX_GP_OBJ 256 
@@ -177,7 +176,6 @@ typedef struct GPENCIL_Storage {
 	float viewmat[4][4], viewinv[4][4];
 	float winmat[4][4], wininv[4][4];
 	float view_vecs[2][4]; /* vec4[2] */
-	struct ColorSpace *colorspace;
 } GPENCIL_Storage;
 
 typedef struct GPENCIL_StorageList {
@@ -331,9 +329,9 @@ void DRW_gpencil_populate_datablock(struct GPENCIL_e_data *e_data, void *vedata,
 void DRW_gpencil_populate_buffer_strokes(struct GPENCIL_e_data *e_data, void *vedata, struct ToolSettings *ts, struct Object *ob);
 void DRW_gpencil_populate_multiedit(struct GPENCIL_e_data *e_data, void *vedata, struct Scene *scene, struct Object *ob, struct ToolSettings *ts, struct bGPdata *gpd);
 
-struct Gwn_Batch *DRW_gpencil_get_point_geom(struct bGPDstroke *gps, short thickness, const float ink[4], struct ColorSpace *colorspace);
-struct Gwn_Batch *DRW_gpencil_get_stroke_geom(struct bGPDframe *gpf, struct bGPDstroke *gps, short thickness, const float ink[4], struct ColorSpace *colorspace);
-struct Gwn_Batch *DRW_gpencil_get_fill_geom(struct bGPDstroke *gps, const float color[4], struct ColorSpace *colorspace);
+struct Gwn_Batch *DRW_gpencil_get_point_geom(struct bGPDstroke *gps, short thickness, const float ink[4]);
+struct Gwn_Batch *DRW_gpencil_get_stroke_geom(struct bGPDframe *gpf, struct bGPDstroke *gps, short thickness, const float ink[4]);
+struct Gwn_Batch *DRW_gpencil_get_fill_geom(struct bGPDstroke *gps, const float color[4]);
 struct Gwn_Batch *DRW_gpencil_get_edit_geom(struct bGPDstroke *gps, float alpha, short dflag);
 struct Gwn_Batch *DRW_gpencil_get_edlin_geom(struct bGPDstroke *gps, float alpha, short dflag);
 struct Gwn_Batch *DRW_gpencil_get_buffer_stroke_geom(struct bGPdata *gpd, float matrix[4][4], short thickness);
diff --git a/source/blender/draw/engines/gpencil/gpencil_geom.c b/source/blender/draw/engines/gpencil/gpencil_geom.c
index 6aa5bdea1ac..92046d14506 100644
--- a/source/blender/draw/engines/gpencil/gpencil_geom.c
+++ b/source/blender/draw/engines/gpencil/gpencil_geom.c
@@ -48,39 +48,23 @@
 
 #include "UI_resources.h"
 
-#include "IMB_colormanagement.h"
-
 #include "gpencil_engine.h"
 
-/* helper to convert color space to linear */
-static void gpencil_linear_colorspace(const float color[4], ColorSpace *colorspace, float r_color[4])
-{
-	//if ((DRW_state_is_image_render()) && (colorspace != NULL)) { 
-	//	copy_v4_v4(r_color, color);
-	//	IMB_colormanagement_colorspace_to_scene_linear_v4(r_color, false, colorspace);
-	//}
-	//else {
-		copy_v4_v4(r_color, color);
-	//}
-}
-
 /* set stroke point to vbo */
 static void gpencil_set_stroke_point(
         Gwn_VertBuf *vbo, float matrix[4][4], const bGPDspoint *pt, int idx,
         uint pos_id, uint color_id,
         uint thickness_id, short thickness,
-        const float ink[4], ColorSpace *colorspace)
+        const float ink[4])
 {
 	float viewfpt[3];
-	float space_color[4];
 
 	float alpha = ink[3] * pt->strength;
 	CLAMP(alpha, GPENCIL_STRENGTH_MIN, 1.0f);
 	float col[4];
 	ARRAY_SET_ITEMS(col, ink[0], ink[1], ink[2], alpha);
 
-	gpencil_linear_colorspace(col, colorspace, space_color);
-	GWN_vertbuf_attr_set(vbo, color_id, idx, space_color);
+	GWN_vertbuf_attr_set(vbo, color_id, idx, col);
 
 	/* the thickness of the stroke must be affected 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list