Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/render/render_shading.c
| Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "BKE_texture.h" | #include "BKE_texture.h" | ||||
| #include "BKE_workspace.h" | #include "BKE_workspace.h" | ||||
| #include "BKE_world.h" | #include "BKE_world.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_build.h" | #include "DEG_depsgraph_build.h" | ||||
| #include "GPU_extensions.h" | |||||
| #ifdef WITH_FREESTYLE | #ifdef WITH_FREESTYLE | ||||
| # include "BKE_freestyle.h" | # include "BKE_freestyle.h" | ||||
| # include "FRS_freestyle.h" | # include "FRS_freestyle.h" | ||||
| # include "RNA_enum_types.h" | # include "RNA_enum_types.h" | ||||
| #endif | #endif | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| ▲ Show 20 Lines • Show All 919 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| wmWindow *win = CTX_wm_window(C); | wmWindow *win = CTX_wm_window(C); | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| int delay = RNA_int_get(op->ptr, "delay"); | int delay = RNA_int_get(op->ptr, "delay"); | ||||
| const bool use_wm_job = !GPU_main_thread_workaround(); | |||||
| light_cache_bake_tag_cache(scene, op); | |||||
| if (!use_wm_job) { | |||||
| return light_cache_bake_exec(C, op); | |||||
| } | |||||
| wmJob *wm_job = EEVEE_lightbake_job_create( | wmJob *wm_job = EEVEE_lightbake_job_create( | ||||
| wm, win, bmain, view_layer, scene, delay, scene->r.cfra); | wm, win, bmain, view_layer, scene, delay, scene->r.cfra); | ||||
| if (!wm_job) { | if (!wm_job) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| /* add modal handler for ESC */ | /* add modal handler for ESC */ | ||||
| WM_event_add_modal_handler(C, op); | WM_event_add_modal_handler(C, op); | ||||
| light_cache_bake_tag_cache(scene, op); | |||||
| /* store actual owner of job, so modal operator could check for it, | /* store actual owner of job, so modal operator could check for it, | ||||
| * the reason of this is that active scene could change when rendering | * the reason of this is that active scene could change when rendering | ||||
| * several layers from compositor [#31800] | * several layers from compositor [#31800] | ||||
| */ | */ | ||||
| op->customdata = scene; | op->customdata = scene; | ||||
| WM_jobs_start(wm, wm_job); | WM_jobs_start(wm, wm_job); | ||||
| ▲ Show 20 Lines • Show All 1,159 Lines • Show Last 20 Lines | |||||