Page MenuHome

Grease Pencil + OpenGL crash in VSE
Closed, ResolvedPublic

Description

System Information
Geforce 1060
Ubuntu 16.04 64bits

Blender Version
Broken:
*2.78a

  • latest on buildbot: 8b29059 (Wed Nov 16 04:25:24 2016 )

Short description of error
Crash of Blender while doing an opengl render of grease pencil

System Information
Operating system and graphics card

Exact steps for others to reproduce the error
1- set the current frame to 1
2- render the animation in opengl "OpenGL render active viewport"
3- set the current from to 10
4-hit "refresh sequencer"
5-enjoy the crash...

It's not the same bug as:
https://developer.blender.org/T49996 or https://developer.blender.org/T49975
but that's at least the third bug i encounter in this area, maybe there is a bigger issue underneath

Event Timeline

Crepe (CrepeC) updated the task description. (Show Details)

Same bug on windows 64 NVIDIA gtx780

Antonio Vazquez (antoniov) triaged this task as Confirmed, Medium priority.

I can reproduce on Windows 10. Maybe this is related to one previous fix, we need to look in detail.

I have running some debugs running the operator and I got the error here:

  sequencer_refresh_all_exec->
  	BKE_sequencer_free_imbuf->
		BKE_sequencer_cache_cleanup->
			BKE_sequencer_preprocessed_cache_cleanup->
				IMB_freeImBuf->
					imb_freerectfloatImBuf (!Error)

I have seen you only need run opengl render with GP and then press refresh button to get the error. If you remove grease pencil or don't run the opengl render, works.

There is a problem when the function try to free the memory because ibuf->rect_float has an invalid value here:

  void imb_freerectfloatImBuf(ImBuf *ibuf)
  {
  	if (ibuf == NULL) return;
	
  	if (ibuf->rect_float && (ibuf->mall & IB_rectfloat)) {
		MEM_freeN(ibuf->rect_float);   // THIS VALUE IS NOT VALID !!!! ERROR!!!
		ibuf->rect_float = NULL;
  	}.
  ..
  ..

@Dalai Felinto (dfelinto) I don't know this part of the code and how imbuffers works and it looks this bug can be related to T49975, could you please take a look?

Hi @Antonio Vazquez (antoniov) this bug is present even in Blender 2.78a. And even if we revert rB0b9b8ab2 the problem is still there. But I will try to debug a bit to see if I have an idea of what can it be.

By the way I'm getting the crash by doing:

  1. F12
  2. Opengl render
  3. F12

In Blender 2.78 doing (1) + (2) is enough to get a crash.

The bug was actually introduced in rBeaea4ea5 (Grease Pencil v2 branch)

Let me see if it is related to the GP render passes.

@Dalai Felinto (dfelinto) I think the reason is the renderpasses must not be created in sequence mode. I have tested this change and I 'm unable to get the error again, could you test before commit?

diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 16842ef..e1e2314 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -553,7 +553,9 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
 		RE_SetActiveRenderView(oglrender->re, rv->name);
 		oglrender->view_id = view_id;
 		/* add grease pencil passes */
-		add_gpencil_renderpass(oglrender, rr, rv);
+		if (!oglrender->is_sequencer) {
+			add_gpencil_renderpass(oglrender, rr, rv);
+		}
 		/* render composite */
 		screen_opengl_render_doit(oglrender, rr);
 	}

That certainly stops the crashes. I really think the grease pencil and sequencer should be rethought. But the patch at least seems to prevent the crash. That said it would be nice to understand what's going on, and add it as a code comment before the if (!oglrender->is_sequencer) { line.

Yes, we need to rethink not only opengl render of grease pencil in sequencer, but for all modes.

Now, make compositing with grease pencil is not easy and we need integrate better the render workflow. I think this must be a topic for the 2.8 version and it's one of the points we are working.

I'm going to commit the fix because what is sure is we don't need render passes in the sequencer.

It works ! Thanks Antonio and Dalai :)