From 05d6818aa25c2ed8948526e090eefcdc2a57014d Mon Sep 17 00:00:00 2001 From: Falk David Date: Thu, 2 Nov 2023 17:08:36 +0100 Subject: [PATCH 1/2] Fix #110038: Crash when sculpting on GP object with modifier When trying to sculpt a Grease Pencil object with a line art modifier (other modifiers probably also casue issues), Blender would crash. I wasn't able to track down the exact issue but it's related to how the update-cache stores pointers to original data. This reverts part of e2befa425a to not make use of the update cache while sculpting. Combined with modifiers, this approach is just too unstable right now. Pull Request: https://projects.blender.org/blender/blender/pulls/114410 --- .../blender/editors/gpencil_legacy/gpencil_sculpt_paint.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/source/blender/editors/gpencil_legacy/gpencil_sculpt_paint.cc b/source/blender/editors/gpencil_legacy/gpencil_sculpt_paint.cc index f88ff0930ef..456bd592e78 100644 --- a/source/blender/editors/gpencil_legacy/gpencil_sculpt_paint.cc +++ b/source/blender/editors/gpencil_legacy/gpencil_sculpt_paint.cc @@ -304,7 +304,6 @@ static void gpencil_update_geometry(bGPdata *gpd) LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { if (gps->flag & GP_STROKE_TAG) { BKE_gpencil_stroke_geometry_update(gpd, gps); - BKE_gpencil_tag_full_update(gpd, gpl, gpf, gps); gps->flag &= ~GP_STROKE_TAG; changed = true; } @@ -1389,7 +1388,6 @@ static void gpencil_sculpt_brush_init_stroke(bContext *C, tGP_BrushEditData *gso */ if (IS_AUTOKEY_ON(scene) && (gpf->framenum != cfra)) { BKE_gpencil_frame_addcopy(gpl, cfra); - BKE_gpencil_tag_full_update(gpd, gpl, nullptr, nullptr); /* Need tag to recalculate evaluated data to avoid crashes. */ DEG_id_tag_update(&gso->gpd->id, ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, nullptr); @@ -1760,9 +1758,6 @@ static bool gpencil_sculpt_brush_do_frame(bContext *C, /* Delay a full recalculation for other frames. */ gpencil_recalc_geometry_tag(gps_active); } - bGPDlayer *gpl_active = (gpl->runtime.gpl_orig) ? gpl->runtime.gpl_orig : gpl; - bGPDframe *gpf_active = (gpf->runtime.gpf_orig) ? gpf->runtime.gpf_orig : gpf; - BKE_gpencil_tag_full_update(gpd, gpl_active, gpf_active, gps_active); } } From 49c3dc9d7fc04a2501cab325f4651250cc9a43ca Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 2 Nov 2023 16:59:48 +0100 Subject: [PATCH 2/2] Fix 114336: Cycles crash switching render pass in the viewport --- intern/cycles/integrator/path_trace_tile.cpp | 5 +++++ intern/cycles/integrator/path_trace_work.cpp | 5 +++++ intern/cycles/integrator/path_trace_work_cpu.cpp | 3 +++ intern/cycles/integrator/path_trace_work_gpu.cpp | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/intern/cycles/integrator/path_trace_tile.cpp b/intern/cycles/integrator/path_trace_tile.cpp index 0eb2c5d6320..20d9adfc326 100644 --- a/intern/cycles/integrator/path_trace_tile.cpp +++ b/intern/cycles/integrator/path_trace_tile.cpp @@ -54,6 +54,11 @@ bool PathTraceTile::get_pass_pixels(const string_view pass_name, } pass = buffer_params.get_actual_display_pass(pass); + if (pass == nullptr) { + /* Happens when interactive sesssion changes display pass but render + * buffer does not contain it yet. */ + return false; + } const float exposure = buffer_params.exposure; const int num_samples = path_trace_.get_num_render_tile_samples(); diff --git a/intern/cycles/integrator/path_trace_work.cpp b/intern/cycles/integrator/path_trace_work.cpp index a811a8bb205..cc93af390f0 100644 --- a/intern/cycles/integrator/path_trace_work.cpp +++ b/intern/cycles/integrator/path_trace_work.cpp @@ -154,6 +154,11 @@ PassAccessor::PassAccessInfo PathTraceWork::get_display_pass_access_info(PassMod const BufferParams ¶ms = buffers_->params; const BufferPass *display_pass = params.get_actual_display_pass(film_->get_display_pass()); + if (display_pass == nullptr) { + /* Happens when interactive sesssion changes display pass but render + * buffer does not contain it yet. */ + return PassAccessor::PassAccessInfo(); + } PassAccessor::PassAccessInfo pass_access_info; pass_access_info.type = display_pass->type; diff --git a/intern/cycles/integrator/path_trace_work_cpu.cpp b/intern/cycles/integrator/path_trace_work_cpu.cpp index 7e1f3a286e3..239bab989f6 100644 --- a/intern/cycles/integrator/path_trace_work_cpu.cpp +++ b/intern/cycles/integrator/path_trace_work_cpu.cpp @@ -176,6 +176,9 @@ void PathTraceWorkCPU::copy_to_display(PathTraceDisplay *display, const KernelFilm &kfilm = device_scene_->data.film; const PassAccessor::PassAccessInfo pass_access_info = get_display_pass_access_info(pass_mode); + if (pass_access_info.type == PASS_NONE) { + return; + } const PassAccessorCPU pass_accessor(pass_access_info, kfilm.exposure, num_samples); diff --git a/intern/cycles/integrator/path_trace_work_gpu.cpp b/intern/cycles/integrator/path_trace_work_gpu.cpp index b29a50eb668..2d1bab41b06 100644 --- a/intern/cycles/integrator/path_trace_work_gpu.cpp +++ b/intern/cycles/integrator/path_trace_work_gpu.cpp @@ -1025,6 +1025,10 @@ void PathTraceWorkGPU::get_render_tile_film_pixels(const PassAccessor::Destinati const KernelFilm &kfilm = device_scene_->data.film; const PassAccessor::PassAccessInfo pass_access_info = get_display_pass_access_info(pass_mode); + if (pass_access_info.type == PASS_NONE) { + return; + } + const PassAccessorGPU pass_accessor(queue_.get(), pass_access_info, kfilm.exposure, num_samples); pass_accessor.get_render_tile_pixels(buffers_.get(), effective_buffer_params_, destination);