forked from bartvdbraak/blender
Switch allocator to thread-safe when rendering from the command line
This is needed because render threads would do some allocations like part buffer allocation and so. This is likely harmless with the lock free allocator (not on Windows tho), but when using guarded allocator we need to be sure access to the list of MemHead is safe.
This commit is contained in:
parent
65bb121401
commit
cc0c94d535
@ -1001,6 +1001,7 @@ static int render_frame(int argc, const char **argv, void *data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BLI_begin_threaded_malloc();
|
||||||
BKE_reports_init(&reports, RPT_PRINT);
|
BKE_reports_init(&reports, RPT_PRINT);
|
||||||
|
|
||||||
frame = CLAMPIS(frame, MINAFRAME, MAXFRAME);
|
frame = CLAMPIS(frame, MINAFRAME, MAXFRAME);
|
||||||
@ -1008,6 +1009,7 @@ static int render_frame(int argc, const char **argv, void *data)
|
|||||||
RE_SetReports(re, &reports);
|
RE_SetReports(re, &reports);
|
||||||
RE_BlenderAnim(re, bmain, scene, NULL, scene->lay, frame, frame, scene->r.frame_step);
|
RE_BlenderAnim(re, bmain, scene, NULL, scene->lay, frame, frame, scene->r.frame_step);
|
||||||
RE_SetReports(re, NULL);
|
RE_SetReports(re, NULL);
|
||||||
|
BLI_end_threaded_malloc();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1029,10 +1031,12 @@ static int render_animation(int UNUSED(argc), const char **UNUSED(argv), void *d
|
|||||||
Main *bmain = CTX_data_main(C);
|
Main *bmain = CTX_data_main(C);
|
||||||
Render *re = RE_NewRender(scene->id.name);
|
Render *re = RE_NewRender(scene->id.name);
|
||||||
ReportList reports;
|
ReportList reports;
|
||||||
|
BLI_begin_threaded_malloc();
|
||||||
BKE_reports_init(&reports, RPT_PRINT);
|
BKE_reports_init(&reports, RPT_PRINT);
|
||||||
RE_SetReports(re, &reports);
|
RE_SetReports(re, &reports);
|
||||||
RE_BlenderAnim(re, bmain, scene, NULL, scene->lay, scene->r.sfra, scene->r.efra, scene->r.frame_step);
|
RE_BlenderAnim(re, bmain, scene, NULL, scene->lay, scene->r.sfra, scene->r.efra, scene->r.frame_step);
|
||||||
RE_SetReports(re, NULL);
|
RE_SetReports(re, NULL);
|
||||||
|
BLI_end_threaded_malloc();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("\nError: no blend loaded. cannot use '-a'.\n");
|
printf("\nError: no blend loaded. cannot use '-a'.\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user