summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2010-06-20 10:40:22 +1000
committerRhys Weatherley <rhys.weatherley@nokia.com>2010-06-20 10:40:22 +1000
commitd491e9e15e35205895aecd4bbb68cf1bb0905dcc (patch)
tree321323a43adacdd07fcb7c4f13e6f797d0c70c23
parent7045dbb981f535346699c06bb77449e9070b9255 (diff)
Language version device query from OpenCL 1.1.
-rw-r--r--src/opencl/qcldevice.cpp17
-rw-r--r--src/opencl/qcldevice.h1
-rw-r--r--util/clinfo/clinfo.cpp1
3 files changed, 19 insertions, 0 deletions
diff --git a/src/opencl/qcldevice.cpp b/src/opencl/qcldevice.cpp
index 0a90b95..6940e52 100644
--- a/src/opencl/qcldevice.cpp
+++ b/src/opencl/qcldevice.cpp
@@ -864,6 +864,23 @@ QStringList QCLDevice::extensions() const
return QStringList();
}
+/*!
+ Returns the highest version of the OpenCL language supported by
+ this device's compiler. For example, \c{OpenCL 1.1}.
+*/
+QString QCLDevice::languageVersion() const
+{
+ QString vers = qt_cl_paramString(m_id, CL_DEVICE_OPENCL_C_VERSION);
+
+ // The define was introduced in OpenCL 1.1. If the device is
+ // only OpenCL 1.0 and doesn't respond to the query, then assume
+ // that the device supports at least the OpenCL 1.0 language.
+ if (vers.isEmpty() && !(versionFlags() & QCLPlatform::Version_1_1))
+ vers = QLatin1String("OpenCL 1.0");
+
+ return vers;
+}
+
bool qt_cl_has_extension(const char *list, size_t listLen, const char *name)
{
size_t nameLen = qstrlen(name);
diff --git a/src/opencl/qcldevice.h b/src/opencl/qcldevice.h
index cb3438f..91661dc 100644
--- a/src/opencl/qcldevice.h
+++ b/src/opencl/qcldevice.h
@@ -154,6 +154,7 @@ public:
QString name() const;
QString vendor() const;
QStringList extensions() const;
+ QString languageVersion() const;
bool hasExtension(const char *name) const;
diff --git a/util/clinfo/clinfo.cpp b/util/clinfo/clinfo.cpp
index f28cd09..4375cb4 100644
--- a/util/clinfo/clinfo.cpp
+++ b/util/clinfo/clinfo.cpp
@@ -86,6 +86,7 @@ int main(int argc, char *argv[])
printf(" Profile : %s\n", dev.profile().toLatin1().constData());
printf(" Version : %s\n", dev.version().toLatin1().constData());
printf(" Driver Version : %s\n", dev.driverVersion().toLatin1().constData());
+ printf(" Language Version : %s\n", dev.languageVersion().toLatin1().constData());
printf(" Name : %s\n", dev.name().toLatin1().constData());
printf(" Vendor : %s\n", dev.vendor().toLatin1().constData());
printf(" Available : %s\n",