size_t imageMaxBufferSize() const;
size_t imageMaxArraySize() const;
+ enum
+ {
+ UNKNOWN_VENDOR=0,
+ AMD=1,
+ INTEL=2,
+ NVIDIA=3
+ };
+
+ bool isAMD() const;
+ bool isIntel() const;
+ bool isNvidia() const;
+
int maxClockFrequency() const;
int maxComputeUnits() const;
int maxConstantArgs() const;
String deviceVersion_ = getStrProp(CL_DEVICE_VERSION);
parseDeviceVersion(deviceVersion_, deviceVersionMajor_, deviceVersionMinor_);
+
+ vendorName = getStrProp(CL_DEVICE_VENDOR);
+ if (vendorName == "Advanced Micro Devices, Inc." ||
+ vendorName == "AMD")
+ vendor_ = AMD;
+ else if (vendorName == "Intel(R) Corporation")
+ vendor_ = INTEL;
+ else if (vendorName == "NVIDIA Corporation")
+ vendor_ = NVIDIA;
+ else
+ vendor_ = UNKNOWN_VENDOR;
}
template<typename _TpCL, typename _TpOut>
int deviceVersionMajor_;
int deviceVersionMinor_;
String driverVersion_;
+ String vendorName;
+ int vendor_;
};
{ return p ? p->version_ : String(); }
String Device::vendor() const
-{ return p ? p->getStrProp(CL_DEVICE_VENDOR) : String(); }
+{ return p ? p->vendorName : String(); }
String Device::OpenCL_C_Version() const
{ return p ? p->getStrProp(CL_DEVICE_OPENCL_C_VERSION) : String(); }
{ CV_REQUIRE_OPENCL_1_2_ERROR; }
#endif
+bool Device::isAMD() const
+{
+ return p->vendor_ == AMD;
+}
+
+bool Device::isIntel() const
+{
+ return p->vendor_ == INTEL;
+}
+
+bool Device::isNvidia() const
+{
+ return p->vendor_ == NVIDIA;
+}
+
int Device::maxClockFrequency() const
{ return p ? p->getProp<cl_uint, int>(CL_DEVICE_MAX_CLOCK_FREQUENCY) : 0; }
localSize = lbufSize = Size(0, 0);
if (ocl::haveOpenCL())
{
- String vname = ocl::Device::getDefault().vendor();
- if (vname == "Advanced Micro Devices, Inc." ||
- vname == "AMD")
+ if (ocl::Device::getDefault().isAMD())
{
localSize = Size(8, 8);
lbufSize = Size(origWinSize.width + localSize.width,
if (ocl::haveOpenCL())
{
const ocl::Device& device = ocl::Device::getDefault();
- String vname = device.vendor();
- if ((vname == "Advanced Micro Devices, Inc." ||
- vname == "AMD") && !device.hostUnifiedMemory())
+ if (device.isAMD() && !device.hostUnifiedMemory())
localSize = Size(8, 8);
}
return true;