From f716eb17e2e89059e79ff6512137146d8f8cd62f Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sat, 27 Apr 2013 15:01:17 +0000 Subject: [PATCH] Some color space issues in sequencer: Sequencer was always trying to do GLSL color space conversion, not respecting user settings at all. This failed a lot when RGB curves a used in color management settings. Now sequencer will fallback if GLSL can not be used and will also respect user settings (however, draw pixels are not supported, sequencer always uses 2D textures). --- .../editors/space_sequencer/sequencer_draw.c | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 021972d93a6..81305bca164 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1060,7 +1060,16 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq type = GL_UNSIGNED_BYTE; } else { - if (ibuf->rect_float) { + bool force_fallback = false; + + force_fallback |= !ELEM(U.image_draw_method, IMAGE_DRAW_METHOD_AUTO, IMAGE_DRAW_METHOD_GLSL); + force_fallback |= ibuf->dither != 0.0f; + + if (force_fallback) { + /* Fallback to CPU based color space conversion */ + glsl_used = false; + } + else if (ibuf->rect_float) { display_buffer = ibuf->rect_float; if (ibuf->channels == 4) { @@ -1096,6 +1105,15 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq type = GL_UNSIGNED_BYTE; display_buffer = NULL; } + + /* there's a data to be displayed, but GLSL is not initialized + * properly, in this case we fallback to CPU-based display transform + */ + if ((ibuf->rect || ibuf->rect_float) && !glsl_used) { + display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle); + format = GL_RGBA; + type = GL_UNSIGNED_BYTE; + } } glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);