DRW: Convert common theme color to linear for viewport render
[blender.git] / source / blender / draw / intern / draw_common.c
index 4e903b264c67eb7abb285e29014fd628303fcd6b..3d6b2015e4922616717027c08ff7418b74a59031 100644 (file)
@@ -132,6 +132,16 @@ void DRW_globals_update(void)
        ts.sizeEdge = U.pixelsize * (1.0f / 2.0f); /* TODO Theme */
        ts.sizeEdgeFix = U.pixelsize * (0.5f + 2.0f * (2.0f * (MAX2(ts.sizeVertex, ts.sizeEdge)) * (float)M_SQRT1_2));
 
+       /* Color management. */
+       if (DRW_state_is_image_render()) {
+               float *color = ts.UBO_FIRST_COLOR;
+               do {
+                       /* TODO more accurate transform. */
+                       srgb_to_linearrgb_v4(color, color);
+                       color += 4;
+               } while (color != ts.UBO_LAST_COLOR);
+       }
+
        if (globals_ubo == NULL) {
                globals_ubo = DRW_uniformbuffer_create(sizeof(GlobalsUboStorage), &ts);
        }