Now ATIDLAS is standalone. Everything dynamic....
This commit is contained in:
36
lib/cl/lazy_compiler.cpp
Normal file
36
lib/cl/lazy_compiler.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "atidlas/cl/lazy_compiler.h"
|
||||
|
||||
namespace atidlas
|
||||
{
|
||||
|
||||
namespace cl
|
||||
{
|
||||
|
||||
lazy_compiler::lazy_compiler(cl::Context const & ctx, std::string const & name, std::string const & src, bool force_recompilation) :
|
||||
context_(ctx), program_(NULL), pname_(name), src_(src), force_recompilation_(force_recompilation)
|
||||
{ }
|
||||
|
||||
lazy_compiler::lazy_compiler(cl::Context const & ctx, std::string const & name, bool force_recompilation) :
|
||||
context_(ctx), program_(NULL), pname_(name), force_recompilation_(force_recompilation)
|
||||
{ }
|
||||
|
||||
void lazy_compiler::add(std::string const & src)
|
||||
{ src_+=src; }
|
||||
|
||||
std::string const & lazy_compiler::src() const
|
||||
{ return src_; }
|
||||
|
||||
cl::Program & lazy_compiler::program()
|
||||
{
|
||||
if(program_()==0)
|
||||
{
|
||||
if(force_recompilation_)
|
||||
pmap.erase(context_, pname_);
|
||||
program_ = pmap.add(context_, pname_, src_);
|
||||
}
|
||||
return program_;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user