diff options
Diffstat (limited to 'source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h')
-rw-r--r-- | source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h b/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h index 1a197c8b4b7..e3e9866d2c7 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h @@ -82,7 +82,7 @@ void lineart_count_and_print_render_buffer_memory(struct LineartRenderBuffer *rb /* Initial bounding area row/column count, setting 4 is the simplest way algorithm could function * efficiently. */ -#define LRT_BA_ROWS 4 +#define LRT_BA_ROWS 10 #ifdef __cplusplus extern "C" { @@ -93,3 +93,32 @@ void lineart_sort_adjacent_items(LineartAdjacentEdge *ai, int length); #ifdef __cplusplus } #endif + +#ifndef __cplusplus /* Compatibility code for atomics, only for C. */ + +# if defined __has_include /* Try to use C11 atomics support. */ +# if __has_include(<stdatomic.h>) +# include <stdatomic.h> +# define lineart_atomic_load(p) atomic_load((volatile size_t *)p) +# define lineart_atomic_store(p, d) atomic_store((volatile size_t *)p, (size_t)d) +# endif +# endif + +# ifdef _MSC_VER /* Atomics walkaround for windows. */ +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +# define lineart_atomic_load(p) (MemoryBarrier(), *(p)) +# define lineart_atomic_store(p, d) \ + do { \ + *(p) = (d); \ + MemoryBarrier(); \ + } while (0) +# endif + +# if !defined lineart_atomic_load /* Fallback */ +# include "atomic_ops.h" +# define lineart_atomic_load(p) atomic_add_and_fetch_z((size_t *)p, 0) +# define lineart_atomic_store(p, d) atomic_add_and_fetch_z((size_t *)p, (size_t)d) +# endif + +#endif /* !__cplusplus */ |