fixed some bugs in OpenCL branch of UMat implementation; maybe now the tests will finally pass?! (please ;( )
This commit is contained in:
parent
ace0d4bad0
commit
6416c33020
@ -592,7 +592,7 @@ static void* initOpenCLAndLoad(const char* funcname)
|
|||||||
{
|
{
|
||||||
if(!initialized)
|
if(!initialized)
|
||||||
{
|
{
|
||||||
handle = dlopen("/System/Library/Frameworks/OpenСL.framework/Versions/Current/OpenСL", RTLD_LAZY);
|
handle = dlopen("/System/Library/Frameworks/OpenCL.framework/Versions/Current/OpenCL", RTLD_LAZY);
|
||||||
initialized = true;
|
initialized = true;
|
||||||
g_haveOpenCL = handle != 0 && dlsym(handle, oclFuncToCheck) != 0;
|
g_haveOpenCL = handle != 0 && dlsym(handle, oclFuncToCheck) != 0;
|
||||||
}
|
}
|
||||||
@ -1831,18 +1831,18 @@ const Device& Context::device(size_t idx) const
|
|||||||
Context& Context::getDefault()
|
Context& Context::getDefault()
|
||||||
{
|
{
|
||||||
static Context ctx;
|
static Context ctx;
|
||||||
if( !ctx.p->handle && haveOpenCL() )
|
if( !ctx.p && haveOpenCL() )
|
||||||
{
|
{
|
||||||
// do not create new Context right away.
|
// do not create new Context right away.
|
||||||
// First, try to retrieve existing context of the same type.
|
// First, try to retrieve existing context of the same type.
|
||||||
// In its turn, Platform::getContext() may call Context::create()
|
// In its turn, Platform::getContext() may call Context::create()
|
||||||
// if there is no such context.
|
// if there is no such context.
|
||||||
ctx.create(Device::TYPE_ACCELERATOR);
|
ctx.create(Device::TYPE_ACCELERATOR);
|
||||||
if(!ctx.p->handle)
|
if(!ctx.p)
|
||||||
ctx.create(Device::TYPE_DGPU);
|
ctx.create(Device::TYPE_DGPU);
|
||||||
if(!ctx.p->handle)
|
if(!ctx.p)
|
||||||
ctx.create(Device::TYPE_IGPU);
|
ctx.create(Device::TYPE_IGPU);
|
||||||
if(!ctx.p->handle)
|
if(!ctx.p)
|
||||||
ctx.create(Device::TYPE_CPU);
|
ctx.create(Device::TYPE_CPU);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1946,7 +1946,7 @@ void* Queue::ptr() const
|
|||||||
Queue& Queue::getDefault()
|
Queue& Queue::getDefault()
|
||||||
{
|
{
|
||||||
Queue& q = TLSData::get()->oclQueue;
|
Queue& q = TLSData::get()->oclQueue;
|
||||||
if( !q.p->handle )
|
if( !q.p )
|
||||||
q.create(Context::getDefault());
|
q.create(Context::getDefault());
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
@ -2684,7 +2684,7 @@ public:
|
|||||||
total = sz[dims-1];
|
total = sz[dims-1];
|
||||||
for( int i = dims-2; i >= 0; i-- )
|
for( int i = dims-2; i >= 0; i-- )
|
||||||
{
|
{
|
||||||
if( i > 0 && (total != srcstep[i] || total != dststep[i]) )
|
if( i >= 0 && (total != srcstep[i] || total != dststep[i]) )
|
||||||
iscontinuous = false;
|
iscontinuous = false;
|
||||||
total *= sz[i];
|
total *= sz[i];
|
||||||
if( srcofs )
|
if( srcofs )
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
#include "opencv2/core/ocl.hpp"
|
||||||
|
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -123,6 +124,10 @@ bool CV_UMatTest::TestUMat()
|
|||||||
|
|
||||||
void CV_UMatTest::run( int /* start_from */)
|
void CV_UMatTest::run( int /* start_from */)
|
||||||
{
|
{
|
||||||
|
printf("Use OpenCL: %s\nHave OpenCL: %s\n",
|
||||||
|
ocl::useOpenCL() ? "TRUE" : "FALSE",
|
||||||
|
ocl::haveOpenCL() ? "TRUE" : "FALSE" );
|
||||||
|
|
||||||
if (!TestUMat())
|
if (!TestUMat())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user