diff options
author | Sergey Sharybin <sergey@blender.org> | 2021-05-03 16:07:14 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2021-05-03 16:07:14 +0300 |
commit | 1b4f0bf32aa5215325ca33f81898a7eeef9da2f8 (patch) | |
tree | 19c444c5c3a0759f44132b9576137cd87080f435 /source/blender/compositor/intern/COM_WorkScheduler.cc | |
parent | 6899dbef77cd26df3588888040887e4e41c1ec43 (diff) |
Fix T87989: Crash using OpenCL in compositor
Initial report was mentioning the Classroom demo scene, but this is
probably because the scene was pre-configured to be used with OpenCL.
Would expect any OpenCL compositing to be failing prior to this fix.
The reason why crash was happening is due to OpenCL queue being
released from OpenCLDevice destructor. Is not that obvious, but
when Vector (including std::vector) is holding elements by value
a destructor will be called on "old" memory when vector capacitance
changes.
Solved by making forbidding copy semantic for compositor devices and
forcing move semantic to be used.
Also use emplace semantic in the devices vector initialization.
Diffstat (limited to 'source/blender/compositor/intern/COM_WorkScheduler.cc')
-rw-r--r-- | source/blender/compositor/intern/COM_WorkScheduler.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cc b/source/blender/compositor/intern/COM_WorkScheduler.cc index ee3a6dedd44..d578ac24a4a 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cc +++ b/source/blender/compositor/intern/COM_WorkScheduler.cc @@ -263,10 +263,10 @@ static void opencl_initialize(const bool use_opencl) if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error2, clewErrorString(error2)); } - g_work_scheduler.opencl.devices.append(OpenCLDevice(g_work_scheduler.opencl.context, - device, - g_work_scheduler.opencl.program, - vendorID)); + g_work_scheduler.opencl.devices.append_as(g_work_scheduler.opencl.context, + device, + g_work_scheduler.opencl.program, + vendorID); } } MEM_freeN(cldevices); @@ -368,7 +368,7 @@ static void threading_model_queue_initialize(const int num_cpu_threads) /* Initialize CPU threads. */ if (!g_work_scheduler.queue.initialized) { for (int index = 0; index < num_cpu_threads; index++) { - g_work_scheduler.queue.devices.append(CPUDevice(index)); + g_work_scheduler.queue.devices.append_as(index); } BLI_thread_local_create(g_thread_device); g_work_scheduler.queue.initialized = true; |