Page MenuHome

Fix T74811: GreasePencil Stereo Rendering
ClosedPublic

Authored by Jeroen Bakker (jbakker) on Mon, Mar 16, 6:00 PM.

Details

Summary

When using grease pencil in a stereo rendering the grease pencil objects are only visible in the left eye. In the viewport it renders both.

Issue is related that DRW_render_gpencil only renders a single view. But DRW_render_to_image renders all views. Aftetr adding a similar loop it renders.

Diff Detail

Repository
rB Blender

Event Timeline

Reuse already created textures

Memory leak detected

Direct leak of 216 byte(s) in 1 object(s) allocated from:

#0 0x7f56b457cd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
#1 0x56098f0c0268 in MEM_lockfree_callocN /home/jeroen/blender-git/blender/intern/guardedalloc/intern/mallocn_lockfree_impl.c:267
#2 0x56098d658703 in GPU_texture_create_nD /home/jeroen/blender-git/blender/source/blender/gpu/intern/gpu_texture.c:684
#3 0x56098d65d1a6 in GPU_texture_create_2d /home/jeroen/blender-git/blender/source/blender/gpu/intern/gpu_texture.c:1108
#4 0x560977eae512 in DRW_texture_create_2d /home/jeroen/blender-git/blender/source/blender/draw/intern/draw_manager_texture.c:91
#5 0x560977f71188 in GPENCIL_render_init /home/jeroen/blender-git/blender/source/blender/draw/engines/gpencil/gpencil_render.c:107
#6 0x560977f734f0 in GPENCIL_render_to_image /home/jeroen/blender-git/blender/source/blender/draw/engines/gpencil/gpencil_render.c:241
#7 0x560977e63b66 in DRW_render_gpencil_to_image /home/jeroen/blender-git/blender/source/blender/draw/intern/draw_manager.c:1639
#8 0x560977e643bc in DRW_render_gpencil /home/jeroen/blender-git/blender/source/blender/draw/intern/draw_manager.c:1712
#9 0x56098bc158fc in RE_engine_render /home/jeroen/blender-git/blender/source/blender/render/intern/source/external_engine.c:787
#10 0x56098bc566a4 in do_render_3d /home/jeroen/blender-git/blender/source/blender/render/intern/source/pipeline.c:1165
#11 0x56098bc5767d in do_render /home/jeroen/blender-git/blender/source/blender/render/intern/source/pipeline.c:1242
#12 0x56098bc59381 in do_render_composite /home/jeroen/blender-git/blender/source/blender/render/intern/source/pipeline.c:1463
#13 0x56098bc5c295 in do_render_all_options /home/jeroen/blender-git/blender/source/blender/render/intern/source/pipeline.c:1726
#14 0x56098bc5fb5e in RE_RenderFrame /home/jeroen/blender-git/blender/source/blender/render/intern/source/pipeline.c:2128
#15 0x56097db8a554 in render_startjob /home/jeroen/blender-git/blender/source/blender/editors/render/render_internal.c:670
#16 0x560977545e3b in do_job_thread /home/jeroen/blender-git/blender/source/blender/windowmanager/intern/wm_jobs.c:396
#17 0x56098f09edbe in tslot_thread_start /home/jeroen/blender-git/blender/source/blender/blenlib/intern/threads.c:260
#18 0x7f56b40836da in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76da)

Direct leak of 216 byte(s) in 1 object(s) allocated from:

#0 0x7f56b457cd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
#1 0x56098f0c0268 in MEM_lockfree_callocN /home/jeroen/blender-git/blender/intern/guardedalloc/intern/mallocn_lockfree_impl.c:267
#2 0x56098d658703 in GPU_texture_create_nD /home/jeroen/blender-git/blender/source/blender/gpu/intern/gpu_texture.c:684
#3 0x56098d65d1a6 in GPU_texture_create_2d /home/jeroen/blender-git/blender/source/blender/gpu/intern/gpu_texture.c:1108
#4 0x560977eae512 in DRW_texture_create_2d /home/jeroen/blender-git/blender/source/blender/draw/intern/draw_manager_texture.c:91
#5 0x560977f71210 in GPENCIL_render_init /home/jeroen/blender-git/blender/source/blender/draw/engines/gpencil/gpencil_render.c:109
#6 0x560977f734f0 in GPENCIL_render_to_image /home/jeroen/blender-git/blender/source/blender/draw/engines/gpencil/gpencil_render.c:241
#7 0x560977e63b66 in DRW_render_gpencil_to_image /home/jeroen/blender-git/blender/source/blender/draw/intern/draw_manager.c:1639
#8 0x560977e643bc in DRW_render_gpencil /home/jeroen/blender-git/blender/source/blender/draw/intern/draw_manager.c:1712
#9 0x56098bc158fc in RE_engine_render /home/jeroen/blender-git/blender/source/blender/render/intern/source/external_engine.c:787
#10 0x56098bc566a4 in do_render_3d /home/jeroen/blender-git/blender/source/blender/render/intern/source/pipeline.c:1165
#11 0x56098bc5767d in do_render /home/jeroen/blender-git/blender/source/blender/render/intern/source/pipeline.c:1242
#12 0x56098bc59381 in do_render_composite /home/jeroen/blender-git/blender/source/blender/render/intern/source/pipeline.c:1463
#13 0x56098bc5c295 in do_render_all_options /home/jeroen/blender-git/blender/source/blender/render/intern/source/pipeline.c:1726
#14 0x56098bc5fb5e in RE_RenderFrame /home/jeroen/blender-git/blender/source/blender/render/intern/source/pipeline.c:2128
#15 0x56097db8a554 in render_startjob /home/jeroen/blender-git/blender/source/blender/editors/render/render_internal.c:670
#16 0x560977545e3b in do_job_thread /home/jeroen/blender-git/blender/source/blender/windowmanager/intern/wm_jobs.c:396
#17 0x56098f09edbe in tslot_thread_start /home/jeroen/blender-git/blender/source/blender/blenlib/intern/threads.c:260
#18 0x7f56b40836da in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76da)

Leak isn't in master. The issue was that the engine render pipeline wasn't setup to be called multiple times. The textures on the second run overwritten the previous one.
We could solve this by reusing the textures and reupload the new data when they were available or by freeing it at the end of the render iteration.
I would

Clément Foucault (fclem) requested changes to this revision.EditedWed, Mar 18, 12:10 AM

We could solve this by reusing the textures and reupload the new data when they were available or by freeing it at the end of the render iteration.

Yes. I would go for the later. But I would fix that in this patch rather than in master.

This revision now requires changes to proceed.Wed, Mar 18, 12:10 AM
Jeroen Bakker (jbakker) requested review of this revision.Thu, Mar 19, 7:53 AM

@Clément Foucault (fclem) that is the current implementation of the patch. It uses GPU_texture_update when the texture already exists.

This revision is now accepted and ready to land.Thu, Mar 19, 5:17 PM
This revision was automatically updated to reflect the committed changes.