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
path: root/intern
diff options
context:
space:
mode:
authorMatt McClellan <mlmcclel>2020-10-05 15:01:33 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-10-05 15:04:06 +0300
commit1d985159ad29c07ade95bbaa6876d7b39e97dc65 (patch)
treea63dd27b40ee6952db1bb6be754247de12b266f3 /intern
parent2bbaa8df592f321fb643578e9c022af78603f91e (diff)
Fix Cycles OpenCL failing when extension string is long
This can happen for Intel OpenCL, now support arbitrary string length. Differential Revision: https://developer.blender.org/D9020
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/device/opencl/opencl_util.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/intern/cycles/device/opencl/opencl_util.cpp b/intern/cycles/device/opencl/opencl_util.cpp
index b8b07cf2947..a72fbbad635 100644
--- a/intern/cycles/device/opencl/opencl_util.cpp
+++ b/intern/cycles/device/opencl/opencl_util.cpp
@@ -1172,9 +1172,20 @@ bool OpenCLInfo::get_device_extensions(cl_device_id device_id,
string *device_extensions,
cl_int *error)
{
- char buffer[1024];
+ size_t extension_length = 0;
cl_int err;
- if ((err = clGetDeviceInfo(device_id, CL_DEVICE_EXTENSIONS, sizeof(buffer), &buffer, NULL)) !=
+ /* Determine the size of the extension string*/
+ if ((err = clGetDeviceInfo(device_id, CL_DEVICE_EXTENSIONS, 0, 0, &extension_length)) !=
+ CL_SUCCESS) {
+ if (error != NULL) {
+ *error = err;
+ }
+ *device_extensions = "";
+ return false;
+ }
+ vector<char> buffer(extension_length);
+ if ((err = clGetDeviceInfo(
+ device_id, CL_DEVICE_EXTENSIONS, extension_length, buffer.data(), NULL)) !=
CL_SUCCESS) {
if (error != NULL) {
*error = err;
@@ -1185,7 +1196,7 @@ bool OpenCLInfo::get_device_extensions(cl_device_id device_id,
if (error != NULL) {
*error = CL_SUCCESS;
}
- *device_extensions = buffer;
+ *device_extensions = string(buffer.data());
return true;
}