Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Werner <stefan.werner@tangent-animation.com>2018-07-06 12:42:34 +0300
committerStefan Werner <stefan.werner@tangent-animation.com>2018-07-06 12:42:34 +0300
commitdf30b50f2f5ee66e055fc795fea91c0f7f4954d5 (patch)
tree4fe16bd326c1592c9637d168b4055e546fe12c18 /intern/cycles/device/opencl/opencl_util.cpp
parentd20d2bcb7fe76a5a8241eefb2f2f3374e4d101bd (diff)
Cycles: Enabled half precision textures for OpenCL devices that support the cl_khr_fp16 extension.
Diffstat (limited to 'intern/cycles/device/opencl/opencl_util.cpp')
-rw-r--r--intern/cycles/device/opencl/opencl_util.cpp38
1 files changed, 37 insertions, 1 deletions
diff --git a/intern/cycles/device/opencl/opencl_util.cpp b/intern/cycles/device/opencl/opencl_util.cpp
index 78ed401bff5..9104f64bedd 100644
--- a/intern/cycles/device/opencl/opencl_util.cpp
+++ b/intern/cycles/device/opencl/opencl_util.cpp
@@ -831,13 +831,15 @@ void OpenCLInfo::get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices
FIRST_VLOG(2) << "Adding new device "
<< readable_device_name << ".";
string hardware_id = get_hardware_id(platform_name, device_id);
+ string device_extensions = get_device_extensions(device_id);
usable_devices->push_back(OpenCLPlatformDevice(
platform_id,
platform_name,
device_id,
device_type,
readable_device_name,
- hardware_id));
+ hardware_id,
+ device_extensions));
}
else {
FIRST_VLOG(2) << "Ignoring device " << device_name
@@ -1047,6 +1049,40 @@ string OpenCLInfo::get_device_name(cl_device_id device_id)
return device_name;
}
+bool OpenCLInfo::get_device_extensions(cl_device_id device_id,
+ string *device_extensions,
+ cl_int* error)
+{
+ char buffer[1024];
+ cl_int err;
+ if((err = clGetDeviceInfo(device_id,
+ CL_DEVICE_EXTENSIONS,
+ sizeof(buffer),
+ &buffer,
+ NULL)) != CL_SUCCESS)
+ {
+ if(error != NULL) {
+ *error = err;
+ }
+ *device_extensions = "";
+ return false;
+ }
+ if(error != NULL) {
+ *error = CL_SUCCESS;
+ }
+ *device_extensions = buffer;
+ return true;
+}
+
+string OpenCLInfo::get_device_extensions(cl_device_id device_id)
+{
+ string device_extensions;
+ if(!get_device_extensions(device_id, &device_extensions)) {
+ return "";
+ }
+ return device_extensions;
+}
+
bool OpenCLInfo::get_device_type(cl_device_id device_id,
cl_device_type *device_type,
cl_int* error)