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.
This commit is contained in:
Sergey Sharybin
2015-05-15 12:12:10 +05:00
parent 650fbd09f7
commit 960d7df56f

View File

@@ -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")