mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 14:36:36 +08:00
Merge pull request #10167 from alalek:ocl_fix_issue_contrib1467
This commit is contained in:
commit
c4b158ff91
@ -2029,6 +2029,7 @@ struct Context::Impl
|
|||||||
{
|
{
|
||||||
if (prefix.empty())
|
if (prefix.empty())
|
||||||
{
|
{
|
||||||
|
CV_Assert(!devices.empty());
|
||||||
const Device& d = devices[0];
|
const Device& d = devices[0];
|
||||||
prefix = d.vendorName() + "--" + d.name() + "--" + d.driverVersion();
|
prefix = d.vendorName() + "--" + d.name() + "--" + d.driverVersion();
|
||||||
// sanitize chars
|
// sanitize chars
|
||||||
@ -3298,6 +3299,8 @@ struct Program::Impl
|
|||||||
refcount = 1;
|
refcount = 1;
|
||||||
const Context ctx = Context::getDefault();
|
const Context ctx = Context::getDefault();
|
||||||
Device device = ctx.device(0);
|
Device device = ctx.device(0);
|
||||||
|
if (ctx.ptr() == NULL || device.ptr() == NULL)
|
||||||
|
return;
|
||||||
if (device.isAMD())
|
if (device.isAMD())
|
||||||
buildflags += " -D AMD_DEVICE";
|
buildflags += " -D AMD_DEVICE";
|
||||||
else if (device.isIntel())
|
else if (device.isIntel())
|
||||||
@ -3308,6 +3311,7 @@ struct Program::Impl
|
|||||||
bool compile(const Context& ctx, String& errmsg)
|
bool compile(const Context& ctx, String& errmsg)
|
||||||
{
|
{
|
||||||
#if OPENCV_HAVE_FILESYSTEM_SUPPORT
|
#if OPENCV_HAVE_FILESYSTEM_SUPPORT
|
||||||
|
CV_Assert(ctx.getImpl());
|
||||||
OpenCLBinaryCacheConfigurator& config = OpenCLBinaryCacheConfigurator::getSingletonInstance();
|
OpenCLBinaryCacheConfigurator& config = OpenCLBinaryCacheConfigurator::getSingletonInstance();
|
||||||
const std::string base_dir = config.prepareCacheDirectoryForContext(
|
const std::string base_dir = config.prepareCacheDirectoryForContext(
|
||||||
ctx.getImpl()->getPrefixString(),
|
ctx.getImpl()->getPrefixString(),
|
||||||
|
Loading…
Reference in New Issue
Block a user