[Bf-blender-cvs] [6aa7843de7d] blender2.8: Fix wrong attributes and shader binding in sequencer when using OCIO

Sergey Sharybin noreply at git.blender.org
Mon May 8 17:06:01 CEST 2017


Commit: 6aa7843de7d579724cb0cea0c66a5ddc4c03c959
Author: Sergey Sharybin
Date:   Mon May 8 16:38:49 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB6aa7843de7d579724cb0cea0c66a5ddc4c03c959

Fix wrong attributes and shader binding in sequencer when using OCIO

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

M	source/blender/editors/space_sequencer/sequencer_draw.c

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

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index e7c7b3d67b9..4d1e878868a 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1221,6 +1221,13 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	}
 
+	/* Format needs to be created prior to any immBindProgram call.
+	 * Do it here because OCIO binds it's own shader.
+	 */
+	VertexFormat *imm_format = immVertexFormat();
+	unsigned int pos = VertexFormat_add_attrib(imm_format, "pos", COMP_F32, 2, KEEP_FLOAT);
+	unsigned int texCoord = VertexFormat_add_attrib(imm_format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
+
 	if (scope) {
 		IMB_freeImBuf(ibuf);
 		ibuf = scope;
@@ -1311,13 +1318,11 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
 	else
 		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, format, type, display_buffer);
 
-	VertexFormat *imm_format = immVertexFormat();
-	unsigned int pos = VertexFormat_add_attrib(imm_format, "pos", COMP_F32, 2, KEEP_FLOAT);
-	unsigned int texCoord = VertexFormat_add_attrib(imm_format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
-
-	immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR);
-	immUniformColor3f(1.0f, 1.0f, 1.0f);
-	immUniform1i("image", GL_TEXTURE0);
+	if (!glsl_used) {
+		immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR);
+		immUniformColor3f(1.0f, 1.0f, 1.0f);
+		immUniform1i("image", GL_TEXTURE0);
+	}
 
 	immBegin(PRIM_TRIANGLE_FAN, 4);
 
@@ -1403,7 +1408,9 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
 
 	glBindTexture(GL_TEXTURE_2D, 0);
 
-	immUnbindProgram();
+	if (!glsl_used) {
+		immUnbindProgram();
+	}
 
 	if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA) {
 		glDisable(GL_BLEND);




More information about the Bf-blender-cvs mailing list