#if defined(MAGICKCORE_OPENCL_SUPPORT)
extern MagickPrivate cl_mem
- GetAuthenticOpenCLBuffer(const Image *,MagickCLDevice,ExceptionInfo *);
+ GetAuthenticOpenCLBuffer(Image *,MagickCLDevice,ExceptionInfo *);
extern MagickPrivate void
SyncAuthenticOpenCLBuffer(const Image *);
%
% The format of the GetAuthenticOpenCLBuffer() method is:
%
-% cl_mem GetAuthenticOpenCLBuffer(const Image *image,
+% cl_mem GetAuthenticOpenCLBuffer(Image *image,
% MagickCLDevice device,ExceptionInfo *exception)
%
% A description of each parameter follows:
% o exception: return any errors or warnings in this structure.
%
*/
-MagickPrivate cl_mem GetAuthenticOpenCLBuffer(const Image *image,
+MagickPrivate cl_mem GetAuthenticOpenCLBuffer(Image *image,
MagickCLDevice device,ExceptionInfo *exception)
{
CacheInfo
assert(image != (const Image *) NULL);
assert(device != (const MagickCLDevice) NULL);
cache_info=(CacheInfo *) image->cache;
- if (cache_info->type == UndefinedCache)
- SyncImagePixelCache((Image *) image,exception);
+ if ((cache_info->type == UndefinedCache) || (cache_info->reference_count > 1))
+ {
+ SyncImagePixelCache(image,exception);
+ cache_info=(CacheInfo *) image->cache;
+ }
if ((cache_info->type != MemoryCache) || (cache_info->mapped != MagickFalse))
return((cl_mem) NULL);
LockSemaphoreInfo(cache_info->semaphore);