Blender Git Commit Log

Git Commits -> Revision 86991fb

Revision 86991fb by Sergey Sharybin (master)
January 21, 2013, 08:49 (GMT)
Fixed render time regression in Blender Internal

It was caused by image threading safe commit and it was noticeable
only on really multi-core CPU (like dual-socket Xeon stations), was
not visible on core i7 machine.

The reason of slowdown was spinlock around image buffer referencing,
which lead to lots of cores waiting for single core and using image
buffer after it was referenced was not so much longer than doing
reference itself.

The most clear solution here seemed to be introducing Image Pool
which will contain list of loaded and referenced image buffers, so
all threads could skip lock if the pool is used for reading only.
Lock only needed in cases when buffer for requested image user is
missing in the pool. This lock will happen only once per image so
overall amount of locks is much less that it was before.

To operate with pool:
- BKE_image_pool_new() creates new pool
- BKE_image_pool_free() destroys pool and dereferences all image
buffers which were loaded to it
- BKE_image_pool_acquire_ibuf() returns image buffer for given
image and user. Pool could be NULL and in this case fallback to
BKE_image_acquire_ibuf will happen.

This helps to avoid lots to if(poll) checks in image sampling
code.

- BKE_image_pool_release_ibuf releases image buffer. In fact, it
will only do something if pool is NULL, in all other case it'll
equal to DoNothing operation.

Commit Details:

Full Hash: 86991fbcb0e8a1c65acff5aed85ce55f8b108baa
SVN Revision: 53946
Parent Commit: 2b9ab87
Lines Changed: +324, -124

30 Modified Paths:

/source/blender/blenkernel/BKE_image.h (+6, -0) (Diff)
/source/blender/blenkernel/BKE_paint.h (+2, -0) (Diff)
/source/blender/blenkernel/intern/dynamicpaint.c (+6, -3) (Diff)
/source/blender/blenkernel/intern/effect.c (+4, -4) (Diff)
/source/blender/blenkernel/intern/image.c (+135, -0) (Diff)
/source/blender/blenkernel/intern/object.c (+4, -0) (Diff)
/source/blender/blenkernel/intern/smoke.c (+1, -1) (Diff)
/source/blender/compositor/operations/COM_TextureOperation.cpp (+5, -1) (Diff)
/source/blender/compositor/operations/COM_TextureOperation.h (+1, -0) (Diff)
/source/blender/editors/sculpt_paint/paint_cursor.c (+10, -1) (Diff)
/source/blender/editors/sculpt_paint/paint_image_2d.c (+1, -1) (Diff)
/source/blender/editors/sculpt_paint/paint_intern.h (+2, -1) (Diff)
/source/blender/editors/sculpt_paint/paint_utils.c (+2, -2) (Diff)
/source/blender/editors/sculpt_paint/sculpt.c (+8, -1) (Diff)
/source/blender/makesrna/intern/rna_texture_api.c (+1, -1) (Diff)
/source/blender/modifiers/intern/MOD_util.c (+1, -1) (Diff)
/source/blender/nodes/shader/nodes/node_shader_texture.c (+4, -4) (Diff)
/source/blender/nodes/texture/nodes/node_texture_proc.c (+1, -1) (Diff)
/source/blender/nodes/texture/nodes/node_texture_texture.c (+1, -1) (Diff)
/source/blender/render/extern/include/RE_shader_ext.h (+4, -3) (Diff)
/source/blender/render/intern/include/envmap.h (+2, -1) (Diff)
/source/blender/render/intern/include/pixelshading.h (+2, -0) (Diff)
/source/blender/render/intern/include/render_types.h (+5, -0) (Diff)
/source/blender/render/intern/include/texture.h (+4, -3) (Diff)
/source/blender/render/intern/source/convertblender.c (+1, -0) (Diff)
/source/blender/render/intern/source/envmap.c (+7, -7) (Diff)
/source/blender/render/intern/source/imagetexture.c (+30, -30) (Diff)
/source/blender/render/intern/source/pipeline.c (+10, -0) (Diff)
/source/blender/render/intern/source/renderdatabase.c (+4, -0) (Diff)
/source/blender/render/intern/source/render_texture.c (+60, -57) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021