When you check for undone work before acquiring a lock that ensures you
are the only one actually doing the work, you have to redo the check
*after* acquiring said lock.
Otherwise, there is room for nasty random race condition issues...
If the user only needs insertion and removal from top, there is
no need to allocate and manage separate HeapNode objects: the
data can be stored directly in the main tree array.
This measured a 24% FPS increase on a ~50% heap-heavy workload.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D3898
Now that the 3d grid is infinite, antialiased, not occluded, and overlaid
on top of rendered view, being able to decrease its opacity to reduce
visual strain is a must.
It's confusing that it says Image when it's also video or final result.
And also since the third option is called Sequencer/Preview, having the
others called Sequencer, and Preview, makes sense.
The index field of nodes is supposed to be its actual index, so
there is no need to read it in swap. On a 64-bit processor i and
j are already in registers, so this removes two memory reads.
In addition, cache the tree pointer, use branch hints, and
put the most frequently accessed 'value' field at 0 offset.
Produced a 20% FPS improvement for a 50% heap-heavy workload.
It was getting too impractical to call BKE_paint_brush_tool_info
which needed to lookup the scene pointers.
Now each store tool offset and brush mode in 'Paint.runtime'
Each mode had its own logic for initializing paint structs,
move to a single function.
Also remove "BKE_brush_get_gpencil_paint", entering grease pencil
mode is responsible for ensuring the data is created.
Now the grid is always controlled by the topbar selector and not in the canvas panel. To have two places to define orientation was confuse.
The orientation by default (no lock) is always to view plane.
The code this was taken from assumes a 'size_t' result,
which isn't the case here.
In practice the bucket distribution wasn't bad,
even so this was a nop so best fix.
Grease pencil tool now uses an icon for each tool,
previously it mapped icons to tool icons which is now not needed
because for each tool a different brush can be selected which has it's
own icon.