operations/transform: flush cl caches before threaded transform

There is a race condition due to each creation of sampler per thread flushing
the opencl buffer caches in parallel, doing a pre-emptive flush when opencl
accelerated makes sure the race doesnt need to happen.

Fixing bug #789690
parent 006b898d
......@@ -33,6 +33,8 @@
#include <gegl.h>
#include <gegl-plugin.h>
#include "buffer/gegl-buffer-cl-cache.h"
#include "gegl-config.h"
#include "transform-core.h"
......@@ -1200,6 +1202,11 @@ gegl_transform_process (GeglOperation *operation,
input = gegl_operation_context_get_source (context, "input");
output = gegl_operation_context_get_target (context, "output");
/* flush opencl caches, to avoid racy flushing
*/
if (gegl_cl_is_accelerated ())
gegl_buffer_cl_cache_flush (input, NULL);
if (gegl_operation_use_threading (operation, result))
{
gint threads = gegl_config_threads ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment