canvas: prune vello scene on each render and make rendering cacheable (#38406)

As noted in #38345, vello scenes only grow. While we can reset them when
clearing viewport (#38356) that is not enough. We need to reset scene on
each render (~each frame) and providing old frame as backdrop to new
scene. Be do this lazily so multiple rendering without any changes
should be cheaper, we still do GPUBuffer mapping, because that would
require more complex work.

Testing: Code functionality is covered by existing WPT tests, but we do
not have any performance test.

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
sagudev 2025-08-01 15:48:44 +02:00 committed by GitHub
parent 5ac9f40625
commit 413fd15264
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 282 additions and 120 deletions

View file

@ -11,3 +11,6 @@
[Test scenario 12: sx = -20, sy = -20, sw = 50, sh = 50, dx = 20, dy = 20, dw = 125, dh = 125 --- Pixel 70,99 should be light purple.]
expected: FAIL
[Test scenario 14: sx = 64, sy = 64, sw = 384, sh = 384, dx = 0, dy = 0, dw = 32, dh = 64 --- Pixel 16,0 should be gray.]
expected:
if subsuite == "vello_canvas": FAIL

View file

@ -2,4 +2,4 @@
[putImageData(getImageData(...), ...) has no effect]
expected:
if subsuite == "": FAIL
if subsuite == "vello_cpu": FAIL
if subsuite == "vello_cpu_canvas": FAIL