[Bf-blender-cvs] [7ad21c3876c] master: Fix T66604: Cycles bake crash on specific scene with volume

Sergey Sharybin noreply at git.blender.org
Thu Jul 11 15:44:42 CEST 2019


Commit: 7ad21c3876c2453f11fd509a0157639d615567fc
Author: Sergey Sharybin
Date:   Thu Jul 11 15:22:03 2019 +0200
Branches: master
https://developer.blender.org/rB7ad21c3876c2453f11fd509a0157639d615567fc

Fix T66604: Cycles bake crash on specific scene with volume

The issue was caused by un-initialized local storage for volume
intersection hits which are supposed to be stored in per-thread
KernelGlobals.

Fix is to make thread_shader() be the same as thread_render() in
respect of KernelGlobals.

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5230

===================================================================

M	intern/cycles/device/device_cpu.cpp

===================================================================

diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index dc9adcb1537..b2d923dfdf0 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -980,14 +980,11 @@ class CPUDevice : public Device {
 
   void thread_shader(DeviceTask &task)
   {
-    KernelGlobals kg = kernel_globals;
+    KernelGlobals *kg = new KernelGlobals(thread_kernel_globals_init());
 
-#ifdef WITH_OSL
-    OSLShader::thread_init(&kg, &kernel_globals, &osl_globals);
-#endif
     for (int sample = 0; sample < task.num_samples; sample++) {
       for (int x = task.shader_x; x < task.shader_x + task.shader_w; x++)
-        shader_kernel()(&kg,
+        shader_kernel()(kg,
                         (uint4 *)task.shader_input,
                         (float4 *)task.shader_output,
                         task.shader_eval_type,
@@ -1002,9 +999,8 @@ class CPUDevice : public Device {
       task.update_progress(NULL);
     }
 
-#ifdef WITH_OSL
-    OSLShader::thread_free(&kg);
-#endif
+    thread_kernel_globals_free(kg);
+    delete kg;
   }
 
   int get_split_task_count(DeviceTask &task)



More information about the Bf-blender-cvs mailing list