[Bf-blender-cvs] [8677b823578] greasepencil-refactor: GPencil: Refactor: Fix green clear color and use srgb only in viewport

Clément Foucault noreply at git.blender.org
Thu Jan 9 16:17:14 CET 2020


Commit: 8677b82357828e11f272b4f5f5dd4dda7cf87f3a
Author: Clément Foucault
Date:   Thu Jan 9 16:17:06 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB8677b82357828e11f272b4f5f5dd4dda7cf87f3a

GPencil: Refactor: Fix green clear color and use srgb only in viewport

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

M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/draw/engines/gpencil/shaders/gpencil_composite_frag.glsl

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index beaf64648d5..aa813c9e5f8 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -261,6 +261,7 @@ void GPENCIL_cache_init(void *ved)
     grp = DRW_shgroup_create(sh, psl->composite_ps);
     DRW_shgroup_uniform_texture_ref(grp, "colorBuf", &pd->color_tx);
     DRW_shgroup_uniform_texture_ref(grp, "revealBuf", &pd->reveal_tx);
+    DRW_shgroup_uniform_bool_copy(grp, "doSrgb", txl->render_depth_tx == NULL);
     DRW_shgroup_call_procedural_triangles(grp, NULL, 1);
   }
   {
@@ -705,7 +706,7 @@ static void GPENCIL_draw_object(GPENCIL_Data *vedata, GPENCIL_tObject *ob)
   GPENCIL_PassList *psl = vedata->psl;
   GPENCIL_PrivateData *pd = vedata->stl->pd;
   GPENCIL_FramebufferList *fbl = vedata->fbl;
-  float clear_cols[2][4] = {{0.0f, 0.5f, 0.0f, 0.0f}, {1.0f, 0.5f, 1.0f, 1.0f}};
+  float clear_cols[2][4] = {{0.0f, 0.0f, 0.0f, 0.0f}, {1.0f, 1.0f, 1.0f, 1.0f}};
 
   DRW_stats_group_start("GPencil Object");
 
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_composite_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_composite_frag.glsl
index 80358a9cf85..bc283952322 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_composite_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_composite_frag.glsl
@@ -1,6 +1,7 @@
 
 uniform sampler2D colorBuf;
 uniform sampler2D revealBuf;
+uniform bool doSrgb;
 
 in vec4 uvcoordsvar;
 
@@ -29,9 +30,12 @@ void main()
   fragColor.rgb = textureLod(colorBuf, uvcoordsvar.xy, 0.0).rgb;
   /* Add the alpha. */
   fragColor.a = 1.0 - fragRevealage.a;
-  /* Temporary srgb conversion.
-   * TODO do color management / tonemapping here. */
-  fragColor.r = linearrgb_to_srgb(fragColor.r);
-  fragColor.g = linearrgb_to_srgb(fragColor.g);
-  fragColor.b = linearrgb_to_srgb(fragColor.b);
+
+  if (doSrgb) {
+    /* Temporary srgb conversion.
+     * TODO do color management / tonemapping here. */
+    fragColor.r = linearrgb_to_srgb(fragColor.r);
+    fragColor.g = linearrgb_to_srgb(fragColor.g);
+    fragColor.b = linearrgb_to_srgb(fragColor.b);
+  }
 }



More information about the Bf-blender-cvs mailing list