Fixed issue: Mat::copyTo(UMat) if device copy is obsolete. Added test.

This commit is contained in:
Alexander Karsakov
2014-08-07 12:31:50 +04:00
parent d30729a816
commit 00221e96fd
2 changed files with 22 additions and 3 deletions

View File

@@ -593,15 +593,16 @@ void* UMat::handle(int accessFlags) const
if( !u )
return 0;
if ((accessFlags & ACCESS_WRITE) != 0)
u->markHostCopyObsolete(true);
// check flags: if CPU copy is newer, copy it back to GPU.
if( u->deviceCopyObsolete() )
{
CV_Assert(u->refcount == 0);
u->currAllocator->unmap(u);
}
if ((accessFlags & ACCESS_WRITE) != 0)
u->markHostCopyObsolete(true);
return u->handle;
}