1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Merge pull request #18593 from masa-iwm:master

Add support thread-local directx (OpenCL interop) initialization

* support thread-local directx (OpenCL interop) initialization

* reflect reviews

* Remove verbose function prototype declarations

* Countermeasures for VC warnings. (declaration of 'platform' hides class member)

* core(directx): remove internal stuff from public headers
This commit is contained in:
masa-iwm
2020-10-19 06:22:06 +09:00
committed by GitHub
parent adac1da64e
commit 5ac0712cf1
3 changed files with 295 additions and 185 deletions
+34
View File
@@ -113,6 +113,10 @@
#include "opencv2/core/opencl/runtime/opencl_core.hpp"
#ifdef HAVE_DIRECTX
#include "directx.hpp"
#endif
#ifdef HAVE_OPENCL_SVM
#include "opencv2/core/opencl/runtime/opencl_svm_20.hpp"
#include "opencv2/core/opencl/runtime/opencl_svm_hsa_extension.hpp"
@@ -2327,6 +2331,9 @@ protected:
, contextId(CV_XADD(&g_contextId, 1))
, configuration(configuration_)
, handle(0)
#ifdef HAVE_DIRECTX
, p_directx_impl(0)
#endif
#ifdef HAVE_OPENCL_SVM
, svmInitialized(false)
#endif
@@ -2352,6 +2359,9 @@ protected:
handle = NULL;
}
devices.clear();
#ifdef HAVE_DIRECTX
directx::internal::deleteDirectXImpl(&p_directx_impl);
#endif
}
{
@@ -2658,6 +2668,19 @@ public:
return *bufferPoolHostPtr_.get();
}
#ifdef HAVE_DIRECTX
directx::internal::OpenCLDirectXImpl* p_directx_impl;
directx::internal::OpenCLDirectXImpl* getDirectXImpl()
{
if (!p_directx_impl)
{
p_directx_impl = directx::internal::createDirectXImpl();
}
return p_directx_impl;
}
#endif
#ifdef HAVE_OPENCL_SVM
bool svmInitialized;
bool svmAvailable;
@@ -7286,4 +7309,15 @@ uint64 Timer::durationNS() const
}} // namespace
#ifdef HAVE_DIRECTX
namespace cv { namespace directx { namespace internal {
OpenCLDirectXImpl* getDirectXImpl(ocl::Context& ctx)
{
ocl::Context::Impl* i = ctx.getImpl();
CV_Assert(i);
return i->getDirectXImpl();
}
}}} // namespace cv::directx::internal
#endif
#endif // HAVE_OPENCL