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
This commit is contained in:
Sergey Sharybin 2019-07-11 15:22:03 +02:00
parent f0b72a776e
commit 7ad21c3876
Notes: blender-bot 2023-02-14 02:30:10 +01:00
Referenced by issue #66754, macOS missing shortcuts and menu entries with 2.80 RC1
Referenced by issue #66604, Cycles crash when baking and Pricipled Volume materials are in the scene
1 changed files with 4 additions and 8 deletions

View File

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