Fix T100700: Compositor crashes when disabled then enabled
The viewport compositor crashes when it is disabled then enabled after the compositor node tree is edited. This happens because the compositor engine uses the view_update callback of the draw engine type to detect changes in the node tree and reset its state for future evaluation. However, the draw manager only calls the view_update callback for enabled engines, so the compositor never receives the needed updates to properly reset its state and then crashes at draw time. This patch call the view_update callback for all registered engines regardless if they are enabled or not, that way, they always receive the potentially important updated needed to maintain a correct state. Aside from the compositor engine, this change affects the EEVEE and Workbench engines because they are the only engines that utilizes this callback. However, both of them only reset a flag that is checked at draw time. So the change should have no side effects. For the EEVEE engine, we just add a null check in case it was not instanced, while Workbench already have the appropriate null check. Differential Revision: https://developer.blender.org/D15821 Reviewed By: Clement Foucault
This commit is contained in:
parent
370b17a8c6
commit
2a13ce1e61
Notes:
blender-bot
2023-02-14 06:25:25 +01:00
Referenced by issue #100700, Viewport Compositor: Crash on disabling, editing a node, then enabling
|
@ -366,7 +366,7 @@ static void eevee_draw_scene(void *vedata)
|
|||
static void eevee_view_update(void *vedata)
|
||||
{
|
||||
EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
|
||||
if (stl->g_data) {
|
||||
if (stl && stl->g_data) {
|
||||
stl->g_data->view_updated = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1344,11 +1344,7 @@ void DRW_notify_view_update(const DRWUpdateContext *update_ctx)
|
|||
drw_engines_enable(view_layer, engine_type, gpencil_engine_needed);
|
||||
drw_engines_data_validate();
|
||||
|
||||
DRW_ENABLED_ENGINE_ITER (DST.view_data_active, draw_engine, data) {
|
||||
if (draw_engine->view_update) {
|
||||
draw_engine->view_update(data);
|
||||
}
|
||||
}
|
||||
DRW_view_data_engines_view_update(DST.view_data_active);
|
||||
|
||||
drw_engines_disable();
|
||||
}
|
||||
|
@ -1400,11 +1396,7 @@ static void drw_notify_view_update_offscreen(struct Depsgraph *depsgraph,
|
|||
drw_engines_enable(view_layer, engine_type, gpencil_engine_needed);
|
||||
drw_engines_data_validate();
|
||||
|
||||
DRW_ENABLED_ENGINE_ITER (DST.view_data_active, draw_engine, data) {
|
||||
if (draw_engine->view_update) {
|
||||
draw_engine->view_update(data);
|
||||
}
|
||||
}
|
||||
DRW_view_data_engines_view_update(DST.view_data_active);
|
||||
|
||||
drw_engines_disable();
|
||||
}
|
||||
|
|
|
@ -197,6 +197,16 @@ void DRW_view_data_free_unused(DRWViewData *view_data)
|
|||
}
|
||||
}
|
||||
|
||||
void DRW_view_data_engines_view_update(DRWViewData *view_data)
|
||||
{
|
||||
for (ViewportEngineData &engine_data : view_data->engines) {
|
||||
DrawEngineType *draw_engine = engine_data.engine_type->draw_engine;
|
||||
if (draw_engine->view_update) {
|
||||
draw_engine->view_update(&engine_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double *DRW_view_data_cache_time_get(DRWViewData *view_data)
|
||||
{
|
||||
return &view_data->cache_time;
|
||||
|
|
|
@ -107,6 +107,7 @@ ViewportEngineData *DRW_view_data_engine_data_get_ensure(DRWViewData *view_data,
|
|||
void DRW_view_data_use_engine(DRWViewData *view_data, struct DrawEngineType *engine_type);
|
||||
void DRW_view_data_reset(DRWViewData *view_data);
|
||||
void DRW_view_data_free_unused(DRWViewData *view_data);
|
||||
void DRW_view_data_engines_view_update(DRWViewData *view_data);
|
||||
double *DRW_view_data_cache_time_get(DRWViewData *view_data);
|
||||
DefaultFramebufferList *DRW_view_data_default_framebuffer_list_get(DRWViewData *view_data);
|
||||
DefaultTextureList *DRW_view_data_default_texture_list_get(DRWViewData *view_data);
|
||||
|
|
Loading…
Reference in New Issue