Own runtime threads and thin platform/canvas seams

This commit is contained in:
2026-06-16 07:34:59 +02:00
parent 17b603536b
commit 6f4bd4b26f
10 changed files with 354 additions and 200 deletions

View File

@@ -94,6 +94,22 @@ struct LegacyCanvasDrawMergeLayerCompositeExecution {
std::function<void()> execute_layer_blend;
};
struct LegacyCanvasDrawMergeLayerPlaneExecution {
std::function<void()> bind_blender_framebuffer;
std::function<void()> clear_blender_framebuffer;
std::function<void()> unbind_blender_framebuffer;
std::function<void()> prepare_temporary_erase;
std::function<void(int, float)> draw_temporary_erase_frame;
std::function<void()> cleanup_temporary_erase;
std::function<void()> prepare_temporary_paint;
std::function<void(int, float)> draw_temporary_paint_frame;
std::function<void()> cleanup_temporary_paint;
std::function<void()> prepare_layer_texture;
std::function<void(int, float)> draw_layer_texture_frame;
std::function<void()> cleanup_layer_texture;
std::function<void()> draw_blend;
};
struct LegacyCanvasDrawMergeTemporaryCompositeExecution {
std::function<void()> setup;
std::function<void()> bind_samplers;
@@ -419,6 +435,46 @@ inline void execute_legacy_canvas_draw_merge_layer_composite(
}
}
inline void execute_legacy_canvas_draw_merge_layer_plane(
bool is_temporary_erase,
bool is_temporary_paint,
bool use_blend,
int first_frame,
int last_frame,
const std::function<float(int)>& frame_alpha,
const LegacyCanvasDrawMergeLayerPlaneExecution& execution)
{
if (use_blend) {
execution.bind_blender_framebuffer();
execution.clear_blender_framebuffer();
}
if (is_temporary_erase) {
execution.prepare_temporary_erase();
for (int frame = first_frame; frame <= last_frame; frame++) {
execution.draw_temporary_erase_frame(frame, frame_alpha(frame));
}
execution.cleanup_temporary_erase();
} else if (is_temporary_paint) {
execution.prepare_temporary_paint();
for (int frame = first_frame; frame <= last_frame; frame++) {
execution.draw_temporary_paint_frame(frame, frame_alpha(frame));
}
execution.cleanup_temporary_paint();
} else {
execution.prepare_layer_texture();
for (int frame = first_frame; frame <= last_frame; frame++) {
execution.draw_layer_texture_frame(frame, frame_alpha(frame));
}
execution.cleanup_layer_texture();
}
if (use_blend) {
execution.unbind_blender_framebuffer();
execution.draw_blend();
}
}
inline void execute_legacy_canvas_draw_merge_temporary_composite(
const LegacyCanvasDrawMergeTemporaryCompositeExecution& execution)
{