Skip to content

Context pool#135

Merged
kunitoki merged 27 commits into
mainfrom
dev/faster_lottie_context_pool
Jul 11, 2026
Merged

Context pool#135
kunitoki merged 27 commits into
mainfrom
dev/faster_lottie_context_pool

Conversation

@kunitoki

@kunitoki kunitoki commented Jul 10, 2026

Copy link
Copy Markdown
Owner

This pull request introduces significant improvements to GPU offscreen rendering, especially for Lottie alpha/luma mattes, isolated-opacity layers, and cached precomps. The main focus is on efficient reuse and management of GPU resources, enabling recursive and sequential rendering without unnecessary allocations or context switches. The changes add a new resource pooling mechanism for offscreen canvases and update the rendering code to leverage these pools, resulting in better performance and reduced GPU memory usage. Documentation and comments are also updated to clarify the new behavior.

GPU Resource Pooling and Management:

  • Added a persistent resource pool in AnimationRenderResources for offscreen GPU canvases (target/source/result triples) and precomp canvases, with context-aware pooling and automatic reuse across frames and recursive renders. This includes the new MatteCanvasLease move-only class to manage canvas lifetimes. [1] [2] [3] [4]
  • Updated AnimationRenderer to use the new resource pool for mattes and precomps, replacing per-frame allocation with pooled canvases. This affects both matte rendering and precomp rendering, and ensures correct resource sharing and cleanup. [1] [2] [3] [4] [5] [6] [7] [8]

Backend and Context Handling:

  • Revised GraphicsContext and OffscreenTarget APIs and documentation to clarify that offscreen targets can now be nested and that contexts are reserved only while a target frame is active, allowing for safe recursive and sequential rendering. [1] [2] [3]
  • Added a destructor to Graphics to ensure that offscreen targets are properly ended if not already committed, preventing resource leaks.

Bug Fixes and Documentation:

  • Updated the changelog to reflect that offscreen GPU rendering now supports recursive targets on all major backends, with improved resource management and fallback behavior.
  • Improved comments and class documentation throughout the affected files to explain the new resource pooling, context requirements, and usage patterns. [1] [2]

These changes collectively make GPU-based matte and precomp rendering more robust, efficient, and easier to maintain, especially in complex Lottie animation scenarios.

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.47619% with 83 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.33%. Comparing base (8895f79) to head (454416a).

Files with missing lines Patch % Lines
...nimation/renderer/yup_AnimationRenderResources.cpp 53.19% 44 Missing ⚠️
modules/yup_graphics/rhi/yup_GpuTarget.cpp 72.58% 17 Missing ⚠️
...s/yup_animation/renderer/yup_AnimationRenderer.cpp 28.57% 10 Missing ⚠️
modules/yup_graphics/rhi/yup_GpuCanvas.cpp 60.00% 10 Missing ⚠️
modules/yup_graphics/rhi/yup_GpuTarget.h 33.33% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #135      +/-   ##
==========================================
+ Coverage   79.24%   79.33%   +0.09%     
==========================================
  Files         710      712       +2     
  Lines       70247    70398     +151     
==========================================
+ Hits        55664    55848     +184     
+ Misses      14583    14550      -33     
Files with missing lines Coverage Δ
..._animation/renderer/yup_AnimationRenderResources.h 66.66% <100.00%> (+16.66%) ⬆️
...dules/yup_graphics/context/yup_GraphicsContext.cpp 44.44% <ø> (ø)
modules/yup_graphics/context/yup_GraphicsContext.h 83.33% <ø> (ø)
modules/yup_graphics/context/yup_OffscreenTarget.h 25.00% <ø> (+5.00%) ⬆️
modules/yup_graphics/graphics/yup_Graphics.cpp 81.15% <100.00%> (+3.92%) ⬆️
modules/yup_graphics/graphics/yup_Graphics.h 100.00% <ø> (ø)
...p_graphics/native/yup_GraphicsContext_headless.cpp 38.88% <100.00%> (+1.74%) ⬆️
modules/yup_graphics/rhi/yup_GpuCanvas.h 50.00% <ø> (ø)
modules/yup_graphics/rhi/yup_GpuFrame.h 100.00% <ø> (ø)
modules/yup_graphics/rhi/yup_GpuRenderPass.h 40.00% <ø> (ø)
... and 6 more

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8895f79...454416a. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Base automatically changed from dev/faster_lottie_drag_and_drop to main July 10, 2026 17:24
@kunitoki kunitoki merged commit ceebb70 into main Jul 11, 2026
39 of 40 checks passed
@kunitoki kunitoki deleted the dev/faster_lottie_context_pool branch July 11, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant