feat(renderer): femtovg partial rendering, stages 2-4 (#617)
Stage 2 (frozen-blit): render the scene into a persistent femtovg image target (image passes use LoadOp::Load — the buffer-age-infinite backing store the wgpu swapchain cannot provide) and blit it whole to the swapchain with CompositeOperation::Copy (no prior clear; exact alpha for the transparent miniplayer). GLItemRenderer::new now takes the initial render target so layer passes restore to the scene texture, not Screen. Env-gated via SLINT_FEMTOVG_PARTIAL_RENDERING (default off = current behavior; "frozen-blit" = this stage only). Stage 3 (dirty regions): wrap GLItemRenderer in the core PartialRenderer proxy and repaint only the dirty bounding rect of the persistent texture (ReusedBuffer semantics). Canvas-level scissor on the main pass only, set after the canvas reset — never a wgpu-pass-level scissor (it would clip persistent layer/shadow clears and smear stale texels). Per-dirty- rect clear_rect as the scoped clear (it ignores canvas scissor by design). "visualize"/"log" modes, mirroring SLINT_SKIA_PARTIAL_RENDERING. Stage 4 (lifecycle): mark_dirty_region override (popup-close repaints; core default is a no-op), free_graphics_resources forwarding, partial-cache clear on set_window_adapter/reset_canvas, force_screen_refresh on texture recreate (resize/DPR/UI-scale), on transformed frames that bypass the persistent texture, and on the metrics collector's FullSpeed mode. cargo check clean. Full behavior unchanged when the env gate is off. km
This commit is contained in:
2 files changed
+387
-35
No files matched your search
@@ -1068,6 +1068,12 @@ impl<'a, R: femtovg::Renderer + TextureImporter> GLItemRenderer<'a, R> {
|
||||
window: &'a i_slint_core::api::Window,
|
||||
width: u32,
|
||||
height: u32,
|
||||
// #617 (stage 2): the render target the canvas is set to when this item
|
||||
// renderer starts — Screen normally, the persistent scene texture when
|
||||
// the partial-rendering path is active. Layer passes restore to this
|
||||
// target after rendering into their offscreen image, so seeding it
|
||||
// wrong would route post-layer scene draws to the swapchain directly.
|
||||
initial_render_target: femtovg::RenderTarget,
|
||||
) -> Self {
|
||||
let scale_factor = ScaleFactor::new(window.scale_factor());
|
||||
Self {
|
||||
@@ -1085,7 +1091,7 @@ impl<'a, R: femtovg::Renderer + TextureImporter> GLItemRenderer<'a, R> {
|
||||
PhysicalSize::new(width as f32, height as f32) / scale_factor,
|
||||
),
|
||||
global_alpha: 1.,
|
||||
current_render_target: femtovg::RenderTarget::Screen,
|
||||
current_render_target: initial_render_target,
|
||||
transform: ItemTransform::identity(),
|
||||
}],
|
||||
metrics: RenderingMetrics { layers_created: Some(0), ..Default::default() },
|
||||
|
||||
Reference in new issue
Block a user