Blender Git Loki

Git Commits -> Revision c5efd09

Revision c5efd09 by Martijn Versteegh (master)
September 22, 2020, 08:30 (GMT)
Fix T80859: Thread safe pixeldata concersion from float to uchar and v.v.

I created a bugreport T80859 earlier.

The problem is in the file source/blender/editors/sculpt_paint/paint_image_proj.c (line numbers against commit d376aea61)

at the lines 5309 and 5320 the functions `IMB_rect_from_float(...)` and `IMB_float_from_rect(...)` are called from threaded code on a shared ibuf.
However, ps->reproject_ibuf is shared between threads, so this is not thread-safe.
This is a race condition and leads to wrong output when projecting float data onto a uchar texture or vice versa on a multithreaded system.
The checks on line 5308 and 5319 are already a race condition.

I created this patch which fixes the problem , but I'm not sure if I'm overlooking something.
This makes sure reproject_ibuf contains the correct formats *before* the threadpool is started.

I replaced the original location of the conversions with BLI_asserts(). That may be overkill?

Reviewed By: #sculpt_paint_texture, mont29

Maniphest Tasks: T80859

Differential Revision: https://developer.blender.org/D8936

Commit Details:

Full Hash: c5efd0939f72eea1547812ccc0adb3c594734de2
Parent Commit: af7378b
Committed By: Bastien Montagne
Lines Changed: +33, -8

1 Modified Path:

/source/blender/editors/sculpt_paint/paint_image_proj.c (+33, -8) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021