From a36acf26dfe38662c8f1c64fe2cf2284e54963cc Mon Sep 17 00:00:00 2001 From: johannes hanika Date: Fri, 6 Dec 2024 19:33:51 +0100 Subject: [PATCH] keyframes: some brush strokes fixes and optimisations --- src/gui/api.h | 2 +- src/gui/render_darkroom.c | 7 ++++--- src/gui/widget_image.h | 2 +- src/pipe/graph-run-nodes-upload.h | 3 ++- src/pipe/graph.c | 11 +++++------ src/pipe/graph.h | 3 +-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/gui/api.h b/src/gui/api.h index c4b65d59..b2f9e91d 100644 --- a/src/gui/api.h +++ b/src/gui/api.h @@ -581,7 +581,7 @@ dt_gui_dr_draw_position( vx[v] = dt_draw_vertex(xi, yi, pressure * radius, opacity, hardness); } // trigger draw list upload and recomputation: - vkdt.graph_dev.runflags = s_graph_run_record_cmd_buf | s_graph_run_upload_source | s_graph_run_wait_done; + vkdt.graph_dev.runflags = s_graph_run_record_cmd_buf; vkdt.graph_dev.module[vkdt.wstate.active_widget_modid].flags = s_module_request_read_source; } else diff --git a/src/gui/render_darkroom.c b/src/gui/render_darkroom.c index a607146d..ab2fa9a6 100644 --- a/src/gui/render_darkroom.c +++ b/src/gui/render_darkroom.c @@ -574,7 +574,8 @@ void render_darkroom() vkdt.state.anim_frame = anim_frame; vkdt.graph_dev.frame = vkdt.state.anim_frame; vkdt.state.anim_no_keyframes = 0; // (re-)enable keyframes - vkdt.graph_dev.runflags = dt_graph_apply_keyframes(&vkdt.graph_dev); // rerun once + dt_graph_apply_keyframes(&vkdt.graph_dev); // rerun once + vkdt.graph_dev.runflags = s_graph_run_record_cmd_buf; } char text[50]; snprintf(text, sizeof(text), "frame %d/%d", vkdt.state.anim_frame, vkdt.state.anim_max_frame); @@ -868,9 +869,9 @@ darkroom_process() dt_log(s_log_snd, "frame drop warning, audio may stutter!"); vkdt.graph_dev.frame = vkdt.state.anim_frame; if(!vkdt.state.anim_no_keyframes) - vkdt.graph_dev.runflags |= dt_graph_apply_keyframes(&vkdt.graph_dev); + dt_graph_apply_keyframes(&vkdt.graph_dev); if(vkdt.graph_dev.frame_cnt == 0 || vkdt.state.anim_frame < vkdt.state.anim_max_frame+1) - vkdt.graph_dev.runflags |= s_graph_run_record_cmd_buf; + vkdt.graph_dev.runflags = s_graph_run_record_cmd_buf; } if(vkdt.state.anim_frame == vkdt.graph_dev.frame_cnt - 1) dt_gui_dr_anim_stop(); // reached the end, stop. diff --git a/src/gui/widget_image.h b/src/gui/widget_image.h index 3deb0c4b..74b4465e 100644 --- a/src/gui/widget_image.h +++ b/src/gui/widget_image.h @@ -232,7 +232,7 @@ dt_image_events(struct nk_context *ctx, dt_image_widget_t *w, int hovered, int m } } // trigger recomputation: - vkdt.graph_dev.runflags = s_graph_run_record_cmd_buf | s_graph_run_wait_done; + vkdt.graph_dev.runflags = s_graph_run_record_cmd_buf; vkdt.graph_dev.module[vkdt.wstate.active_widget_modid].flags = s_module_request_read_source; } float yoff = ctx->input.mouse.scroll_delta.y; diff --git a/src/pipe/graph-run-nodes-upload.h b/src/pipe/graph-run-nodes-upload.h index cb85dc32..7b1d50a8 100644 --- a/src/pipe/graph-run-nodes-upload.h +++ b/src/pipe/graph-run-nodes-upload.h @@ -40,7 +40,8 @@ dt_graph_run_nodes_upload( { if(node->module->so->read_source) { - int run_node = (node->flags & s_module_request_read_source) || + int run_node = (node->module->flags & s_module_request_read_source) || + (node->flags & s_module_request_read_source) || (run & s_graph_run_upload_source); const int c = 0; if(run_node || (dynamic_array && (node->connector[c].flags & s_conn_dynamic_array))) diff --git a/src/pipe/graph.c b/src/pipe/graph.c index ab9188c1..e7659532 100644 --- a/src/pipe/graph.c +++ b/src/pipe/graph.c @@ -358,8 +358,10 @@ VkResult dt_graph_run( dt_log(s_log_pipe|s_log_err, "too many nodes in graph!"); return VK_INCOMPLETE; } -#define TRAVERSE_POST \ - nodeid[cnt++] = curr; +#define TRAVERSE_POST {\ + module_flags |= arr[curr].flags;\ + nodeid[cnt++] = curr;\ + } #include "graph-traverse.inc" if(cnt == 0) @@ -607,11 +609,10 @@ void dt_graph_reset(dt_graph_t *g) #endif } -dt_graph_run_t +void dt_graph_apply_keyframes( dt_graph_t *g) { - dt_graph_run_t ret = s_graph_run_record_cmd_buf; for(int m=0;mnum_modules;m++) { if(g->module[m].name == 0) continue; // skip deleted modules @@ -677,7 +678,6 @@ dt_graph_apply_keyframes( if(src1[0] < src0[0]) for(int i=vcnt;imodule[m].flags = s_module_request_read_source; // make sure the draw list is updated - ret |= s_graph_run_upload_source; } else { // apply directly @@ -685,5 +685,4 @@ dt_graph_apply_keyframes( } } } - return ret; } diff --git a/src/pipe/graph.h b/src/pipe/graph.h index 0162204a..624fb352 100644 --- a/src/pipe/graph.h +++ b/src/pipe/graph.h @@ -165,8 +165,7 @@ dt_graph_connector_image( // apply all keyframes found in the module list and write to the modules parameters according to // the current frame in the graph (g->frame). floating point parameters will be interpolated. -dt_graph_run_t // return required runflags on graph -dt_graph_apply_keyframes( +void dt_graph_apply_keyframes( dt_graph_t *g); static inline dt_token_t