Merge pull request #19584 from diablodale:fix19573_ocl_move

This commit is contained in:
Alexander Alekhin
2021-02-21 19:20:03 +00:00
4 changed files with 311 additions and 7 deletions
+155 -2
View File
@@ -1480,6 +1480,23 @@ Platform& Platform::operator = (const Platform& pl)
return *this;
}
Platform::Platform(Platform&& pl) CV_NOEXCEPT
{
p = pl.p;
pl.p = nullptr;
}
Platform& Platform::operator = (Platform&& pl) CV_NOEXCEPT
{
if (this != &pl) {
if(p)
p->release();
p = pl.p;
pl.p = nullptr;
}
return *this;
}
void* Platform::ptr() const
{
return p ? p->handle : 0;
@@ -1706,6 +1723,23 @@ Device& Device::operator = (const Device& d)
return *this;
}
Device::Device(Device&& d) CV_NOEXCEPT
{
p = d.p;
d.p = nullptr;
}
Device& Device::operator = (Device&& d) CV_NOEXCEPT
{
if (this != &d) {
if(p)
p->release();
p = d.p;
d.p = nullptr;
}
return *this;
}
Device::~Device()
{
if(p)
@@ -2919,6 +2953,23 @@ Context& Context::operator = (const Context& c)
return *this;
}
Context::Context(Context&& c) CV_NOEXCEPT
{
p = c.p;
c.p = nullptr;
}
Context& Context::operator = (Context&& c) CV_NOEXCEPT
{
if (this != &c) {
if(p)
p->release();
p = c.p;
c.p = nullptr;
}
return *this;
}
void* Context::ptr() const
{
return p == NULL ? NULL : p->handle;
@@ -3260,6 +3311,23 @@ Queue& Queue::operator = (const Queue& q)
return *this;
}
Queue::Queue(Queue&& q) CV_NOEXCEPT
{
p = q.p;
q.p = nullptr;
}
Queue& Queue::operator = (Queue&& q) CV_NOEXCEPT
{
if (this != &q) {
if(p)
p->release();
p = q.p;
q.p = nullptr;
}
return *this;
}
Queue::~Queue()
{
if(p)
@@ -3315,7 +3383,7 @@ static cl_command_queue getQueue(const Queue& q)
/////////////////////////////////////////// KernelArg /////////////////////////////////////////////
KernelArg::KernelArg()
KernelArg::KernelArg() CV_NOEXCEPT
: flags(0), m(0), obj(0), sz(0), wscale(1), iwscale(1)
{
}
@@ -3493,6 +3561,23 @@ Kernel& Kernel::operator = (const Kernel& k)
return *this;
}
Kernel::Kernel(Kernel&& k) CV_NOEXCEPT
{
p = k.p;
k.p = nullptr;
}
Kernel& Kernel::operator = (Kernel&& k) CV_NOEXCEPT
{
if (this != &k) {
if(p)
p->release();
p = k.p;
k.p = nullptr;
}
return *this;
}
Kernel::~Kernel()
{
if(p)
@@ -4091,6 +4176,23 @@ ProgramSource& ProgramSource::operator = (const ProgramSource& prog)
return *this;
}
ProgramSource::ProgramSource(ProgramSource&& prog) CV_NOEXCEPT
{
p = prog.p;
prog.p = nullptr;
}
ProgramSource& ProgramSource::operator = (ProgramSource&& prog) CV_NOEXCEPT
{
if (this != &prog) {
if(p)
p->release();
p = prog.p;
prog.p = nullptr;
}
return *this;
}
const String& ProgramSource::source() const
{
CV_Assert(p);
@@ -4586,6 +4688,23 @@ Program& Program::operator = (const Program& prog)
return *this;
}
Program::Program(Program&& prog) CV_NOEXCEPT
{
p = prog.p;
prog.p = nullptr;
}
Program& Program::operator = (Program&& prog) CV_NOEXCEPT
{
if (this != &prog) {
if(p)
p->release();
p = prog.p;
prog.p = nullptr;
}
return *this;
}
Program::~Program()
{
if(p)
@@ -6647,6 +6766,23 @@ PlatformInfo& PlatformInfo::operator =(const PlatformInfo& i)
return *this;
}
PlatformInfo::PlatformInfo(PlatformInfo&& i) CV_NOEXCEPT
{
p = i.p;
i.p = nullptr;
}
PlatformInfo& PlatformInfo::operator = (PlatformInfo&& i) CV_NOEXCEPT
{
if (this != &i) {
if(p)
p->release();
p = i.p;
i.p = nullptr;
}
return *this;
}
int PlatformInfo::deviceNumber() const
{
return p ? (int)p->devices.size() : 0;
@@ -7187,7 +7323,7 @@ struct Image2D::Impl
cl_mem handle;
};
Image2D::Image2D()
Image2D::Image2D() CV_NOEXCEPT
{
p = NULL;
}
@@ -7245,6 +7381,23 @@ Image2D & Image2D::operator = (const Image2D & i)
return *this;
}
Image2D::Image2D(Image2D&& i) CV_NOEXCEPT
{
p = i.p;
i.p = nullptr;
}
Image2D& Image2D::operator = (Image2D&& i) CV_NOEXCEPT
{
if (this != &i) {
if (p)
p->release();
p = i.p;
i.p = nullptr;
}
return *this;
}
Image2D::~Image2D()
{
if (p)
+20 -2
View File
@@ -38,6 +38,8 @@ Device::Device() CV_NOEXCEPT : p(NULL) { }
Device::Device(void* d) : p(NULL) { OCL_NOT_AVAILABLE(); }
Device::Device(const Device& d) : p(NULL) { }
Device& Device::operator=(const Device& d) { return *this; }
Device::Device(Device&&) CV_NOEXCEPT : p(NULL) { }
Device& Device::operator=(Device&&) CV_NOEXCEPT { return *this; }
Device::~Device() { }
void Device::set(void* d) { OCL_NOT_AVAILABLE(); }
@@ -152,6 +154,8 @@ Context::Context(int dtype) : p(NULL) { }
Context::~Context() { }
Context::Context(const Context& c) : p(NULL) { }
Context& Context::operator=(const Context& c) { return *this; }
Context::Context(Context&&) CV_NOEXCEPT : p(NULL) { }
Context& Context::operator=(Context&&) CV_NOEXCEPT { return *this; }
bool Context::create() { return false; }
bool Context::create(int dtype) { return false; }
@@ -182,6 +186,8 @@ Platform::Platform() CV_NOEXCEPT : p(NULL) { }
Platform::~Platform() { }
Platform::Platform(const Platform&) : p(NULL) { }
Platform& Platform::operator=(const Platform&) { return *this; }
Platform::Platform(Platform&&) CV_NOEXCEPT : p(NULL) { }
Platform& Platform::operator=(Platform&&) CV_NOEXCEPT { return *this; }
void* Platform::ptr() const { return NULL; }
@@ -203,6 +209,8 @@ Queue::Queue(const Context& c, const Device& d) : p(NULL) { OCL_NOT_AVAILABLE();
Queue::~Queue() { }
Queue::Queue(const Queue& q) {}
Queue& Queue::operator=(const Queue& q) { return *this; }
Queue::Queue(Queue&&) CV_NOEXCEPT : p(NULL) { }
Queue& Queue::operator=(Queue&&) CV_NOEXCEPT { return *this; }
bool Queue::create(const Context& c, const Device& d) { OCL_NOT_AVAILABLE(); }
void Queue::finish() {}
@@ -218,7 +226,7 @@ Queue& Queue::getDefault()
const Queue& Queue::getProfilingQueue() const { OCL_NOT_AVAILABLE(); }
KernelArg::KernelArg()
KernelArg::KernelArg() CV_NOEXCEPT
: flags(0), m(0), obj(0), sz(0), wscale(1), iwscale(1)
{
}
@@ -241,6 +249,8 @@ Kernel::Kernel(const char* kname, const ProgramSource& prog, const String& build
Kernel::~Kernel() { }
Kernel::Kernel(const Kernel& k) : p(NULL) { }
Kernel& Kernel::operator=(const Kernel& k) { return *this; }
Kernel::Kernel(Kernel&&) CV_NOEXCEPT : p(NULL) { }
Kernel& Kernel::operator=(Kernel&&) CV_NOEXCEPT { return *this; }
bool Kernel::empty() const { return true; }
bool Kernel::create(const char* kname, const Program& prog) { OCL_NOT_AVAILABLE(); }
@@ -268,6 +278,8 @@ Program::Program() CV_NOEXCEPT : p(NULL) { }
Program::Program(const ProgramSource& src, const String& buildflags, String& errmsg) : p(NULL) { OCL_NOT_AVAILABLE(); }
Program::Program(const Program& prog) : p(NULL) { }
Program& Program::operator=(const Program& prog) { return *this; }
Program::Program(Program&&) CV_NOEXCEPT : p(NULL) { }
Program& Program::operator=(Program&&) CV_NOEXCEPT { return *this; }
Program::~Program() { }
bool Program::create(const ProgramSource& src, const String& buildflags, String& errmsg) { OCL_NOT_AVAILABLE(); }
@@ -290,6 +302,8 @@ ProgramSource::ProgramSource(const char* prog) : p(NULL) { }
ProgramSource::~ProgramSource() { }
ProgramSource::ProgramSource(const ProgramSource& prog) : p(NULL) { }
ProgramSource& ProgramSource::operator=(const ProgramSource& prog) { return *this; }
ProgramSource::ProgramSource(ProgramSource&&) CV_NOEXCEPT : p(NULL) { }
ProgramSource& ProgramSource::operator=(ProgramSource&&) CV_NOEXCEPT { return *this; }
const String& ProgramSource::source() const { OCL_NOT_AVAILABLE(); }
ProgramSource::hash_t ProgramSource::hash() const { OCL_NOT_AVAILABLE(); }
@@ -304,6 +318,8 @@ PlatformInfo::~PlatformInfo() { }
PlatformInfo::PlatformInfo(const PlatformInfo& i) : p(NULL) { }
PlatformInfo& PlatformInfo::operator=(const PlatformInfo& i) { return *this; }
PlatformInfo::PlatformInfo(PlatformInfo&&) CV_NOEXCEPT : p(NULL) { }
PlatformInfo& PlatformInfo::operator=(PlatformInfo&&) CV_NOEXCEPT { return *this; }
String PlatformInfo::name() const { OCL_NOT_AVAILABLE(); }
String PlatformInfo::vendor() const { OCL_NOT_AVAILABLE(); }
@@ -341,11 +357,13 @@ int predictOptimalVectorWidthMax(InputArray src1, InputArray src2, InputArray sr
void buildOptionsAddMatrixDescription(String& buildOptions, const String& name, InputArray _m) { OCL_NOT_AVAILABLE(); }
Image2D::Image2D() : p(NULL) { }
Image2D::Image2D() CV_NOEXCEPT : p(NULL) { }
Image2D::Image2D(const UMat &src, bool norm, bool alias) { OCL_NOT_AVAILABLE(); }
Image2D::Image2D(const Image2D & i) : p(NULL) { OCL_NOT_AVAILABLE(); }
Image2D::~Image2D() { }
Image2D& Image2D::operator=(const Image2D & i) { return *this; }
Image2D::Image2D(Image2D&&) CV_NOEXCEPT : p(NULL) { }
Image2D& Image2D::operator=(Image2D&&) CV_NOEXCEPT { return *this; }
/* static */ bool Image2D::canCreateAlias(const UMat &u) { OCL_NOT_AVAILABLE(); }
/* static */ bool Image2D::isFormatSupported(int depth, int cn, bool norm) { OCL_NOT_AVAILABLE(); }