diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-05-15 10:12:10 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-05-15 11:22:47 +0300 |
commit | 960d7df56f11cd8161bc7ba4478d5c6988c8232f (patch) | |
tree | 01154b6b99ce32a077286d61f2b77abcba37b172 /intern/cycles/device/device_opencl.cpp | |
parent | 650fbd09f7c3d85719aad89d5a50080a56fc4c49 (diff) |
Cycles: Pass device compute capabilities to kernel via build options
This way it's possible to do device-selective feature disabling/enabling.
Currently only supported for NVidia devices via OpenCL extension.
Diffstat (limited to 'intern/cycles/device/device_opencl.cpp')
-rw-r--r-- | intern/cycles/device/device_opencl.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp index 76821e8c021..05c8530a7a7 100644 --- a/intern/cycles/device/device_opencl.cpp +++ b/intern/cycles/device/device_opencl.cpp @@ -1097,6 +1097,16 @@ protected: build_options += "-D__KERNEL_OPENCL_NVIDIA__ " "-cl-nv-maxrregcount=32 " "-cl-nv-verbose "; + + uint compute_capability_major, compute_capability_minor; + clGetDeviceInfo(cdDevice, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV, + sizeof(cl_uint), &compute_capability_major, NULL); + clGetDeviceInfo(cdDevice, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV, + sizeof(cl_uint), &compute_capability_minor, NULL); + + build_options += string_printf("-D__COMPUTE_CAPABILITY__=%d ", + compute_capability_major * 100 + + compute_capability_minor * 10); } else if(platform_name == "Apple") |