Skip to content
Permalink
Browse files

[opencl] Cache the context

  • Loading branch information
elpaso committed Aug 8, 2018
1 parent e29c7e5 commit 54b5821f992f2e59031170cc3d9c24f9bb9481a1
Showing with 9 additions and 7 deletions.
  1. +9 −7 src/core/qgsopenclutils.cpp
@@ -294,14 +294,16 @@ QString QgsOpenClUtils::errorText( const int errorCode )

cl::Context QgsOpenClUtils::context()
{
if ( available() && sPlatform() && sDevice() )
static cl::Context context;
static std::once_flag contextCreated;
std::call_once( contextCreated, [ = ]()
{
return cl::Context( sDevice );
}
else
{
return cl::Context();
}
if ( available() && sPlatform() && sDevice() )
{
context = cl::Context( sDevice );
}
} );
return context;
}

cl::Program QgsOpenClUtils::buildProgram( const cl::Context &context, const QString &source, ExceptionBehavior exceptionBehavior )

0 comments on commit 54b5821

Please sign in to comment.
You can’t perform that action at this time.